Skip to content

Commit

Permalink
z80: Rewrite the core to handle interruptibility
Browse files Browse the repository at this point in the history
  • Loading branch information
holub committed Aug 30, 2023
1 parent 8fbfd49 commit a94254a
Show file tree
Hide file tree
Showing 10 changed files with 2,852 additions and 3,253 deletions.
22 changes: 4 additions & 18 deletions src/devices/cpu/z80/kc82.cpp
Expand Up @@ -206,7 +206,7 @@ bool kc82_device::memory_translate(int spacenum, int intention, offs_t &address,
// rm - read one byte from memory
//-------------------------------------------------

u8 kc82_device::rm(u16 addr)
u8 kc82_device::data_read(u16 addr)
{
return m_data.read_byte(addr + m_mmu_base[addr >> 10]);
}
Expand All @@ -216,7 +216,7 @@ u8 kc82_device::rm(u16 addr)
// wm - write one byte to memory
//-------------------------------------------------

void kc82_device::wm(u16 addr, u8 value)
void kc82_device::data_write(u16 addr, u8 value)
{
m_data.write_byte(addr + m_mmu_base[addr >> 10], value);
}
Expand All @@ -226,10 +226,9 @@ void kc82_device::wm(u16 addr, u8 value)
// rop - read opcode
//-------------------------------------------------

u8 kc82_device::rop()
u8 kc82_device::opcode_read()
{
u32 pc = m_pc.w.l + m_mmu_base[m_pc.b.h >> 2];
m_pc.w.l++;
// no refresh
return m_opcodes.read_byte(pc);
}
Expand All @@ -239,21 +238,8 @@ u8 kc82_device::rop()
// arg - read 8-bit argument
//-------------------------------------------------

u8 kc82_device::arg()
u8 kc82_device::arg_read()
{
u32 pc = m_pc.w.l + m_mmu_base[m_pc.b.h >> 2];
m_pc.w.l++;
return m_args.read_byte(pc);
}


//-------------------------------------------------
// arg16 - read 16-bit argument
//-------------------------------------------------

u16 kc82_device::arg16()
{
u16 d16 = arg();
d16 |= u16(arg()) << 8;
return d16;
}
9 changes: 4 additions & 5 deletions src/devices/cpu/z80/kc82.h
Expand Up @@ -41,11 +41,10 @@ class kc82_device : public z80_device
virtual bool memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space) override;

// z80_device overrides
virtual u8 rm(u16 addr) override;
virtual void wm(u16 addr, u8 value) override;
virtual u8 rop() override;
virtual u8 arg() override;
virtual u16 arg16() override;
virtual u8 data_read(u16 addr) override;
virtual void data_write(u16 addr, u8 value) override;
virtual u8 opcode_read() override;
virtual u8 arg_read() override;

// MMU access
u8 mmu_r(offs_t offset);
Expand Down
5,152 changes: 2,544 additions & 2,608 deletions src/devices/cpu/z80/z80.cpp

Large diffs are not rendered by default.

0 comments on commit a94254a

Please sign in to comment.