diff options
Diffstat (limited to 'src/devices/cpu/mb88xx/mb88xx.cpp')
-rw-r--r-- | src/devices/cpu/mb88xx/mb88xx.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp index 24a2943e518..864ac02d184 100644 --- a/src/devices/cpu/mb88xx/mb88xx.cpp +++ b/src/devices/cpu/mb88xx/mb88xx.cpp @@ -20,7 +20,6 @@ #include "debugger.h" -DEFINE_DEVICE_TYPE(MB88, mb88_cpu_device, "mb88xx", "MB88xx"); DEFINE_DEVICE_TYPE(MB88201, mb88201_cpu_device, "mb88201", "MB88201") DEFINE_DEVICE_TYPE(MB88202, mb88202_cpu_device, "mb88202", "MB88202") DEFINE_DEVICE_TYPE(MB8841, mb8841_cpu_device, "mb8841", "MB8841") @@ -52,9 +51,6 @@ DEFINE_DEVICE_TYPE(MB8844, mb8844_cpu_device, "mb8844", "MB8844") #define RDMEM(a) (m_data->read_byte(a)) #define WRMEM(a,v) (m_data->write_byte((a), (v))) -#define READPORT(a) (m_io->read_byte(a)) -#define WRITEPORT(a,v) (m_io->write_byte((a), (v))) - #define TEST_ST() (m_st & 1) #define TEST_ZF() (m_zf & 1) #define TEST_CF() (m_cf & 1) @@ -109,22 +105,18 @@ static ADDRESS_MAP_START(data_7bit, AS_DATA, 8, mb88_cpu_device) ADDRESS_MAP_END -mb88_cpu_device::mb88_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : cpu_device(mconfig, MB88, tag, owner, clock) - , m_program_config("program", ENDIANNESS_BIG, 8, 11, 0) - , m_data_config("data", ENDIANNESS_BIG, 8, 7, 0) - , m_io_config("io", ENDIANNESS_BIG, 8, 3, 0) - , m_PLA(nullptr) -{ -} - - mb88_cpu_device::mb88_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_width, int data_width) : cpu_device(mconfig, type, tag, owner, clock) , m_program_config("program", ENDIANNESS_BIG, 8, program_width, 0, (program_width == 9) ? ADDRESS_MAP_NAME(program_9bit) : (program_width == 10) ? ADDRESS_MAP_NAME(program_10bit) : ADDRESS_MAP_NAME(program_11bit)) , m_data_config("data", ENDIANNESS_BIG, 8, data_width, 0, (data_width == 4) ? ADDRESS_MAP_NAME(data_4bit) : (data_width == 5) ? ADDRESS_MAP_NAME(data_5bit) : (data_width == 6) ? ADDRESS_MAP_NAME(data_6bit) : ADDRESS_MAP_NAME(data_7bit)) - , m_io_config("io", ENDIANNESS_BIG, 8, 3, 0) , m_PLA(nullptr) + , m_read_k(*this) + , m_write_o(*this) + , m_write_p(*this) + , m_read_r{{*this}, {*this}, {*this}, {*this}} + , m_write_r{{*this}, {*this}, {*this}, {*this}} + , m_read_si(*this) + , m_write_so(*this) { } @@ -179,7 +171,16 @@ void mb88_cpu_device::device_start() m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); m_data = &space(AS_DATA); - m_io = &space(AS_IO); + + m_read_k.resolve_safe(0); + m_write_o.resolve_safe(); + m_write_p.resolve_safe(); + for (auto &cb : m_read_r) + cb.resolve_safe(0); + for (auto &cb : m_write_r) + cb.resolve_safe(); + m_read_si.resolve_safe(0); + m_write_so.resolve_safe(); m_serial = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mb88_cpu_device::serial_timer), this)); @@ -332,7 +333,7 @@ TIMER_CALLBACK_MEMBER( mb88_cpu_device::serial_timer ) the program can write to S and recover the value even if serial is enabled */ if (!m_sf) { - m_SB = (m_SB >> 1) | (READPORT(MB88_PORTSI) ? 8 : 0); + m_SB = (m_SB >> 1) | (m_read_si() ? 8 : 0); if (m_SBcount >= 4) { @@ -479,18 +480,18 @@ void mb88_cpu_device::execute_run() break; case 0x01: /* outO ZCS:...*/ - WRITEPORT( MB88_PORTO, pla( m_A,TEST_CF()) ); + m_write_o(pla(m_A, TEST_CF())); m_st = 1; break; case 0x02: /* outP ZCS:... */ - WRITEPORT( MB88_PORTP, m_A ); + m_write_p(m_A); m_st = 1; break; case 0x03: /* outR ZCS:... */ arg = m_Y; - WRITEPORT( MB88_PORTR0+(arg&3), m_A ); + m_write_r[arg & 3](m_A); m_st = 1; break; @@ -592,14 +593,14 @@ void mb88_cpu_device::execute_run() break; case 0x12: /* inK ZCS:x.. */ - m_A = READPORT( MB88_PORTK ) & 0x0f; + m_A = m_read_k() & 0x0f; UPDATE_ZF(m_A); m_st = 1; break; case 0x13: /* inR ZCS:x.. */ arg = m_Y; - m_A = READPORT( MB88_PORTR0+(arg&3) ) & 0x0f; + m_A = m_read_r[arg & 3]() & 0x0f; UPDATE_ZF(m_A); m_st = 1; break; @@ -690,8 +691,8 @@ void mb88_cpu_device::execute_run() break; case 0x20: /* setR ZCS:... */ - arg = READPORT( MB88_PORTR0+(m_Y/4) ); - WRITEPORT( MB88_PORTR0+(m_Y/4), arg | ( 1 << (m_Y%4) ) ); + arg = m_read_r[m_Y/4](); + m_write_r[m_Y/4](arg | (1 << (m_Y%4))); m_st = 1; break; @@ -701,8 +702,8 @@ void mb88_cpu_device::execute_run() break; case 0x22: /* rstR ZCS:... */ - arg = READPORT( MB88_PORTR0+(m_Y/4) ); - WRITEPORT( MB88_PORTR0+(m_Y/4), arg & ~( 1 << (m_Y%4) ) ); + arg = m_read_r[m_Y/4](); + m_write_r[m_Y/4](arg & ~(1 << (m_Y%4))); m_st = 1; break; @@ -712,7 +713,7 @@ void mb88_cpu_device::execute_run() break; case 0x24: /* tstr ZCS:..x */ - arg = READPORT( MB88_PORTR0+(m_Y/4) ); + arg = m_read_r[m_Y/4](); m_st = ( arg & ( 1 << (m_Y%4) ) ) ? 0 : 1; break; @@ -834,21 +835,21 @@ void mb88_cpu_device::execute_run() break; case 0x40: case 0x41: case 0x42: case 0x43: /* setD ZCS:... */ - arg = READPORT(MB88_PORTR0); + arg = m_read_r[0](); arg |= (1 << (opcode&3)); - WRITEPORT(MB88_PORTR0,arg); + m_write_r[0](arg); m_st = 1; break; case 0x44: case 0x45: case 0x46: case 0x47: /* rstD ZCS:... */ - arg = READPORT(MB88_PORTR0); + arg = m_read_r[0](); arg &= ~(1 << (opcode&3)); - WRITEPORT(MB88_PORTR0,arg); + m_write_r[0](arg); m_st = 1; break; case 0x48: case 0x49: case 0x4a: case 0x4b: /* tstD ZCS:..x */ - arg = READPORT(MB88_PORTR2); + arg = m_read_r[2](); m_st = (arg & (1 << (opcode&3))) ? 0 : 1; break; |