From 226e732dea37e66eefa3d99bbda0d80416cd0104 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 27 Jun 2017 14:40:10 -0400 Subject: Convert MB88XX ports to DEVCB and remove generic device type (nw) --- src/devices/cpu/mb88xx/mb88xx.cpp | 65 +++++++++++++++-------------- src/devices/cpu/mb88xx/mb88xx.h | 88 ++++++++++++++++++++++++++++----------- src/mame/audio/namco52.cpp | 23 ++++------ src/mame/audio/namco52.h | 2 +- src/mame/audio/namco54.cpp | 14 ++----- src/mame/drivers/arabian.cpp | 85 ++++++++++++++++++++++++------------- src/mame/drivers/strnskil.cpp | 10 ++--- src/mame/includes/arabian.h | 10 ++++- src/mame/machine/namco50.cpp | 13 ++---- src/mame/machine/namco51.cpp | 13 ++---- src/mame/machine/namco53.cpp | 35 +++++++++++----- src/mame/machine/namco53.h | 5 ++- src/mame/machine/namco62.cpp | 13 ++---- 13 files changed, 218 insertions(+), 158 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; diff --git a/src/devices/cpu/mb88xx/mb88xx.h b/src/devices/cpu/mb88xx/mb88xx.h index b44a93709cc..1a6682b1a14 100644 --- a/src/devices/cpu/mb88xx/mb88xx.h +++ b/src/devices/cpu/mb88xx/mb88xx.h @@ -16,20 +16,56 @@ /*************************************************************************** - PORT ENUMERATION + PORT CONFIGURATION ***************************************************************************/ -enum -{ - MB88_PORTK = 0, /* input only, 4 bits */ - MB88_PORTO, /* output only, PLA function output */ - MB88_PORTP, /* 4 bits */ - MB88_PORTR0, /* R0-R3, 4 bits */ - MB88_PORTR1, /* R4-R7, 4 bits */ - MB88_PORTR2, /* R8-R11, 4 bits */ - MB88_PORTR3, /* R12-R15, 4 bits */ - MB88_PORTSI /* SI, 1 bit */ -}; +// K (K3-K0): input-only port +#define MCFG_MB88XX_READ_K_CB(_devcb) \ + devcb = &mb88_cpu_device::set_read_k_callback(*device, DEVCB_##_devcb); + +// O (O7-O4 = OH, O3-O0 = OL): output through PLA +#define MCFG_MB88XX_WRITE_O_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_o_callback(*device, DEVCB_##_devcb); + +// P (P3-P0): output-only port +#define MCFG_MB88XX_WRITE_P_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_p_callback(*device, DEVCB_##_devcb); + +// R0 (R3-R0): input/output port +#define MCFG_MB88XX_READ_R0_CB(_devcb) \ + devcb = &mb88_cpu_device::set_read_r_callback(*device, 0, DEVCB_##_devcb); +#define MCFG_MB88XX_WRITE_R0_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_r_callback(*device, 0, DEVCB_##_devcb); + +// R1 (R7-R4): input/output port +#define MCFG_MB88XX_READ_R1_CB(_devcb) \ + devcb = &mb88_cpu_device::set_read_r_callback(*device, 1, DEVCB_##_devcb); +#define MCFG_MB88XX_WRITE_R1_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_r_callback(*device, 1, DEVCB_##_devcb); + +// R2 (R11-R8): input/output port +#define MCFG_MB88XX_READ_R2_CB(_devcb) \ + devcb = &mb88_cpu_device::set_read_r_callback(*device, 2, DEVCB_##_devcb); +#define MCFG_MB88XX_WRITE_R2_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_r_callback(*device, 2, DEVCB_##_devcb); + +// R3 (R15-R12): input/output port +#define MCFG_MB88XX_READ_R3_CB(_devcb) \ + devcb = &mb88_cpu_device::set_read_r_callback(*device, 3, DEVCB_##_devcb); +#define MCFG_MB88XX_WRITE_R3_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_r_callback(*device, 3, DEVCB_##_devcb); + +// SI: serial input +#define MCFG_MB88XX_READ_SI_CB(_devcb) \ + devcb = &mb88_cpu_device::set_read_si_callback(*device, DEVCB_##_devcb); + +// SO: serial output +#define MCFG_MB88XX_WRITE_SO_CB(_devcb) \ + devcb = &mb88_cpu_device::set_write_so_callback(*device, DEVCB_##_devcb); + +// Configure 32 byte PLA; if nullptr (default) assume direct output +#define MCFG_MB88XX_OUTPUT_PLA(_pla) \ + mb88_cpu_device::set_pla(*device, _pla); /*************************************************************************** REGISTER ENUMERATION @@ -56,17 +92,17 @@ enum CPU_DISASSEMBLE( mb88 ); -// Configure 32 byte PLA, if nullptr (default) assume direct output */ -#define MCFG_MB88_PLA(_pla) mb88_cpu_device::set_pla(*device, _pla); - - class mb88_cpu_device : public cpu_device { public: - // construction/destruction - mb88_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // static configuration helpers + template static devcb_base &set_read_k_callback(device_t &device, Object &&cb) { return downcast(device).m_read_k.set_callback(std::forward(cb)); } + template static devcb_base &set_write_o_callback(device_t &device, Object &&cb) { return downcast(device).m_write_o.set_callback(std::forward(cb)); } + template static devcb_base &set_write_p_callback(device_t &device, Object &&cb) { return downcast(device).m_write_p.set_callback(std::forward(cb)); } + template static devcb_base &set_read_r_callback(device_t &device, int n, Object &&cb) { assert(n >= 0 && n < 4); return downcast(device).m_read_r[n].set_callback(std::forward(cb)); } + template static devcb_base &set_write_r_callback(device_t &device, int n, Object &&cb) { assert(n >= 0 && n < 4); return downcast(device).m_write_r[n].set_callback(std::forward(cb)); } + template static devcb_base &set_read_si_callback(device_t &device, Object &&cb) { return downcast(device).m_read_si.set_callback(std::forward(cb)); } + template static devcb_base &set_write_so_callback(device_t &device, Object &&cb) { return downcast(device).m_write_so.set_callback(std::forward(cb)); } static void set_pla(device_t &device, uint8_t *pla) { downcast(device).m_PLA = pla; } DECLARE_WRITE_LINE_MEMBER( clock_w ); @@ -88,7 +124,7 @@ protected: virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const override { return (cycles * 6); } // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : (spacenum == AS_DATA) ? &m_data_config : (spacenum == AS_IO) ? &m_io_config : nullptr; } + virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override { return (spacenum == AS_PROGRAM) ? &m_program_config : (spacenum == AS_DATA) ? &m_data_config : nullptr; } // device_state_interface overrides virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; @@ -103,7 +139,6 @@ protected: private: address_space_config m_program_config; address_space_config m_data_config; - address_space_config m_io_config; uint8_t m_PC; /* Program Counter: 6 bits */ uint8_t m_PA; /* Page Address: 4 bits */ @@ -133,8 +168,15 @@ private: uint16_t m_SBcount; /* number of bits received */ emu_timer *m_serial; - /* PLA configuration */ + /* PLA configuration and port callbacks */ uint8_t * m_PLA; + devcb_read8 m_read_k; + devcb_write8 m_write_o; + devcb_write8 m_write_p; + devcb_read8 m_read_r[4]; + devcb_write8 m_write_r[4]; + devcb_read_line m_read_si; + devcb_write_line m_write_so; /* IRQ handling */ uint8_t m_pending_interrupt; @@ -142,7 +184,6 @@ private: address_space *m_program; direct_read_data *m_direct; address_space *m_data; - address_space *m_io; int m_icount; // For the debugger @@ -206,7 +247,6 @@ public: }; -DECLARE_DEVICE_TYPE(MB88, mb88_cpu_device) DECLARE_DEVICE_TYPE(MB88201, mb88201_cpu_device) DECLARE_DEVICE_TYPE(MB88202, mb88202_cpu_device) DECLARE_DEVICE_TYPE(MB8841, mb8841_cpu_device) diff --git a/src/mame/audio/namco52.cpp b/src/mame/audio/namco52.cpp index 60b6707efa0..34a05c9544d 100644 --- a/src/mame/audio/namco52.cpp +++ b/src/mame/audio/namco52.cpp @@ -60,7 +60,7 @@ READ8_MEMBER( namco_52xx_device::K_r ) return m_latched_cmd & 0x0f; } -READ8_MEMBER( namco_52xx_device::SI_r ) +READ_LINE_MEMBER( namco_52xx_device::SI_r ) { return m_si(0) ? 1 : 0; } @@ -133,18 +133,6 @@ TIMER_CALLBACK_MEMBER( namco_52xx_device::external_clock_pulse ) DEVICE INTERFACE ***************************************************************************/ -static ADDRESS_MAP_START( namco_52xx_map_io, AS_IO, 8, namco_52xx_device ) - AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(K_r) - AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(O_w) - AM_RANGE(MB88_PORTP, MB88_PORTP) AM_WRITE(P_w) - AM_RANGE(MB88_PORTSI, MB88_PORTSI) AM_READ(SI_r) - AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READ(R0_r) - AM_RANGE(MB88_PORTR1, MB88_PORTR1) AM_READ(R1_r) - AM_RANGE(MB88_PORTR2, MB88_PORTR2) AM_WRITE(R2_w) - AM_RANGE(MB88_PORTR3, MB88_PORTR3) AM_WRITE(R3_w) -ADDRESS_MAP_END - - ROM_START( namco_52xx ) ROM_REGION( 0x400, "mcu", 0 ) ROM_LOAD( "52xx.bin", 0x0000, 0x0400, CRC(3257d11e) SHA1(4883b2fdbc99eb7b9906357fcc53915842c2c186) ) @@ -190,7 +178,14 @@ void namco_52xx_device::device_start() MACHINE_CONFIG_MEMBER( namco_52xx_device::device_add_mconfig ) MCFG_CPU_ADD("mcu", MB8843, DERIVED_CLOCK(1,1)) /* parent clock, internally divided by 6 */ - MCFG_CPU_IO_MAP(namco_52xx_map_io) + MCFG_MB88XX_READ_K_CB(READ8(namco_52xx_device, K_r)) + MCFG_MB88XX_WRITE_O_CB(WRITE8(namco_52xx_device, O_w)) + MCFG_MB88XX_WRITE_P_CB(WRITE8(namco_52xx_device, P_w)) + MCFG_MB88XX_READ_SI_CB(READLINE(namco_52xx_device, SI_r)) + MCFG_MB88XX_READ_R0_CB(READ8(namco_52xx_device, R0_r)) + MCFG_MB88XX_READ_R1_CB(READ8(namco_52xx_device, R1_r)) + MCFG_MB88XX_WRITE_R2_CB(WRITE8(namco_52xx_device, R2_w)) + MCFG_MB88XX_WRITE_R3_CB(WRITE8(namco_52xx_device, R3_w)) MACHINE_CONFIG_END //------------------------------------------------- diff --git a/src/mame/audio/namco52.h b/src/mame/audio/namco52.h index d29bfa9e70f..0c53522d0b3 100644 --- a/src/mame/audio/namco52.h +++ b/src/mame/audio/namco52.h @@ -39,7 +39,7 @@ public: DECLARE_WRITE8_MEMBER(write); DECLARE_READ8_MEMBER( K_r ); - DECLARE_READ8_MEMBER( SI_r ); + DECLARE_READ_LINE_MEMBER( SI_r ); DECLARE_READ8_MEMBER( R0_r ); DECLARE_READ8_MEMBER( R1_r ); DECLARE_WRITE8_MEMBER( P_w ); diff --git a/src/mame/audio/namco54.cpp b/src/mame/audio/namco54.cpp index d406d24db3e..70109ad187d 100644 --- a/src/mame/audio/namco54.cpp +++ b/src/mame/audio/namco54.cpp @@ -108,15 +108,6 @@ WRITE8_MEMBER( namco_54xx_device::write ) DEVICE INTERFACE ***************************************************************************/ -static ADDRESS_MAP_START( namco_54xx_map_io, AS_IO, 8, namco_54xx_device ) - AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(K_r) - AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(O_w) - AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READ(R0_r) - AM_RANGE(MB88_PORTR1, MB88_PORTR1) AM_WRITE(R1_w) - AM_RANGE(MB88_PORTR2, MB88_PORTR2) AM_NOP -ADDRESS_MAP_END - - ROM_START( namco_54xx ) ROM_REGION( 0x400, "mcu", 0 ) ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) @@ -146,7 +137,10 @@ void namco_54xx_device::device_start() MACHINE_CONFIG_MEMBER( namco_54xx_device::device_add_mconfig ) MCFG_CPU_ADD("mcu", MB8844, DERIVED_CLOCK(1,1)) /* parent clock, internally divided by 6 */ - MCFG_CPU_IO_MAP(namco_54xx_map_io) + MCFG_MB88XX_READ_K_CB(READ8(namco_54xx_device, K_r)) + MCFG_MB88XX_WRITE_O_CB(WRITE8(namco_54xx_device, O_w)) + MCFG_MB88XX_READ_R0_CB(READ8(namco_54xx_device, R0_r)) + MCFG_MB88XX_WRITE_R1_CB(WRITE8(namco_54xx_device, R1_w)) MACHINE_CONFIG_END //------------------------------------------------- diff --git a/src/mame/drivers/arabian.cpp b/src/mame/drivers/arabian.cpp index bff3c351427..0a19fb1413f 100644 --- a/src/mame/drivers/arabian.cpp +++ b/src/mame/drivers/arabian.cpp @@ -102,30 +102,62 @@ WRITE8_MEMBER(arabian_state::ay8910_portb_w) * *************************************/ -READ8_MEMBER(arabian_state::mcu_port_r_r) +READ8_MEMBER(arabian_state::mcu_port_r0_r) { - uint8_t val = m_mcu_port_r[offset]; + uint8_t val = m_mcu_port_r[0]; /* RAM mode is enabled */ - if (offset == 0) - val |= 4; + val |= 4; return val; } -WRITE8_MEMBER(arabian_state::mcu_port_r_w) +READ8_MEMBER(arabian_state::mcu_port_r1_r) { - if (offset == 0) - { - uint32_t ram_addr = ((m_mcu_port_p & 7) << 8) | m_mcu_port_o; + uint8_t val = m_mcu_port_r[1]; - if (~data & 2) - m_custom_cpu_ram[ram_addr] = 0xf0 | m_mcu_port_r[3]; + return val; +} - m_flip_screen = data & 8; - } +READ8_MEMBER(arabian_state::mcu_port_r2_r) +{ + uint8_t val = m_mcu_port_r[2]; + + return val; +} + +READ8_MEMBER(arabian_state::mcu_port_r3_r) +{ + uint8_t val = m_mcu_port_r[3]; + + return val; +} + +WRITE8_MEMBER(arabian_state::mcu_port_r0_w) +{ + uint32_t ram_addr = ((m_mcu_port_p & 7) << 8) | m_mcu_port_o; + + if (~data & 2) + m_custom_cpu_ram[ram_addr] = 0xf0 | m_mcu_port_r[3]; + + m_flip_screen = data & 8; - m_mcu_port_r[offset] = data & 0x0f; + m_mcu_port_r[0] = data & 0x0f; +} + +WRITE8_MEMBER(arabian_state::mcu_port_r1_w) +{ + m_mcu_port_r[1] = data & 0x0f; +} + +WRITE8_MEMBER(arabian_state::mcu_port_r2_w) +{ + m_mcu_port_r[2] = data & 0x0f; +} + +WRITE8_MEMBER(arabian_state::mcu_port_r3_w) +{ + m_mcu_port_r[3] = data & 0x0f; } READ8_MEMBER(arabian_state::mcu_portk_r) @@ -203,21 +235,6 @@ ADDRESS_MAP_END -/************************************* - * - * MCU port handlers - * - *************************************/ - -static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, arabian_state ) - AM_RANGE(MB88_PORTK, MB88_PORTK ) AM_READ(mcu_portk_r) - AM_RANGE(MB88_PORTO, MB88_PORTO ) AM_WRITE(mcu_port_o_w) - AM_RANGE(MB88_PORTP, MB88_PORTP ) AM_WRITE(mcu_port_p_w) - AM_RANGE(MB88_PORTR0, MB88_PORTR3) AM_READWRITE(mcu_port_r_r, mcu_port_r_w) -ADDRESS_MAP_END - - - /************************************* * * Port definitions @@ -345,7 +362,17 @@ static MACHINE_CONFIG_START( arabian ) MCFG_CPU_VBLANK_INT_DRIVER("screen", arabian_state, irq0_line_hold) MCFG_CPU_ADD("mcu", MB8841, MAIN_OSC/3/2) - MCFG_CPU_IO_MAP(mcu_io_map) + MCFG_MB88XX_READ_K_CB(READ8(arabian_state, mcu_portk_r)) + MCFG_MB88XX_WRITE_O_CB(WRITE8(arabian_state, mcu_port_o_w)) + MCFG_MB88XX_WRITE_P_CB(WRITE8(arabian_state, mcu_port_p_w)) + MCFG_MB88XX_READ_R0_CB(READ8(arabian_state, mcu_port_r0_r)) + MCFG_MB88XX_WRITE_R0_CB(WRITE8(arabian_state, mcu_port_r0_w)) + MCFG_MB88XX_READ_R1_CB(READ8(arabian_state, mcu_port_r1_r)) + MCFG_MB88XX_WRITE_R1_CB(WRITE8(arabian_state, mcu_port_r1_w)) + MCFG_MB88XX_READ_R2_CB(READ8(arabian_state, mcu_port_r2_r)) + MCFG_MB88XX_WRITE_R2_CB(WRITE8(arabian_state, mcu_port_r2_w)) + MCFG_MB88XX_READ_R3_CB(READ8(arabian_state, mcu_port_r3_r)) + MCFG_MB88XX_WRITE_R3_CB(WRITE8(arabian_state, mcu_port_r3_w)) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) diff --git a/src/mame/drivers/strnskil.cpp b/src/mame/drivers/strnskil.cpp index 363115c3c31..1b3f4b99ab7 100644 --- a/src/mame/drivers/strnskil.cpp +++ b/src/mame/drivers/strnskil.cpp @@ -119,12 +119,6 @@ static ADDRESS_MAP_START( strnskil_map2, AS_PROGRAM, 8, strnskil_state ) AM_RANGE(0xd802, 0xd802) AM_DEVWRITE("sn2", sn76496_device, write) ADDRESS_MAP_END - -static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, strnskil_state ) -// AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(mcu_portk_r) -// AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READWRITE(mcu_portr0_r, mcu_portr0_w) -ADDRESS_MAP_END - /****************************************************************************/ static INPUT_PORTS_START( strnskil ) @@ -383,7 +377,9 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( banbam, strnskil ) MCFG_CPU_ADD("mcu", MB8841, 8000000/2) - MCFG_CPU_IO_MAP(mcu_io_map) +// MCFG_MB88XX_READ_K_CB(READ8(strnskil_state, mcu_portk_r)) +// MCFG_MB88XX_READ_R0_CB(READ8(strnskil_state, mcu_portr0_r)) +// MCFG_MB88XX_WRITE_R0_CB(WRITE8(strnskil_state, mcu_portr0_w)) MACHINE_CONFIG_END /****************************************************************************/ diff --git a/src/mame/includes/arabian.h b/src/mame/includes/arabian.h index 4ff951bd724..bc56248d360 100644 --- a/src/mame/includes/arabian.h +++ b/src/mame/includes/arabian.h @@ -34,8 +34,14 @@ public: uint8_t m_mcu_port_o; uint8_t m_mcu_port_p; uint8_t m_mcu_port_r[4]; - DECLARE_READ8_MEMBER(mcu_port_r_r); - DECLARE_WRITE8_MEMBER(mcu_port_r_w); + DECLARE_READ8_MEMBER(mcu_port_r0_r); + DECLARE_READ8_MEMBER(mcu_port_r1_r); + DECLARE_READ8_MEMBER(mcu_port_r2_r); + DECLARE_READ8_MEMBER(mcu_port_r3_r); + DECLARE_WRITE8_MEMBER(mcu_port_r0_w); + DECLARE_WRITE8_MEMBER(mcu_port_r1_w); + DECLARE_WRITE8_MEMBER(mcu_port_r2_w); + DECLARE_WRITE8_MEMBER(mcu_port_r3_w); DECLARE_READ8_MEMBER(mcu_portk_r); DECLARE_WRITE8_MEMBER(mcu_port_o_w); DECLARE_WRITE8_MEMBER(mcu_port_p_w); diff --git a/src/mame/machine/namco50.cpp b/src/mame/machine/namco50.cpp index f36601b1d85..7aa4b49a0cc 100644 --- a/src/mame/machine/namco50.cpp +++ b/src/mame/machine/namco50.cpp @@ -217,14 +217,6 @@ READ8_MEMBER( namco_50xx_device::read ) DEVICE INTERFACE ***************************************************************************/ -static ADDRESS_MAP_START( namco_50xx_map_io, AS_IO, 8, namco_50xx_device ) - AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(K_r) - AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(O_w) - AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READ(R0_r) - AM_RANGE(MB88_PORTR2, MB88_PORTR2) AM_READ(R2_r) -ADDRESS_MAP_END - - ROM_START( namco_50xx ) ROM_REGION( 0x800, "mcu", 0 ) ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) @@ -260,7 +252,10 @@ void namco_50xx_device::device_start() MACHINE_CONFIG_MEMBER( namco_50xx_device::device_add_mconfig ) MCFG_CPU_ADD("mcu", MB8842, DERIVED_CLOCK(1,1)) /* parent clock, internally divided by 6 */ - MCFG_CPU_IO_MAP(namco_50xx_map_io) + MCFG_MB88XX_READ_K_CB(READ8(namco_50xx_device, K_r)) + MCFG_MB88XX_WRITE_O_CB(WRITE8(namco_50xx_device, O_w)) + MCFG_MB88XX_READ_R0_CB(READ8(namco_50xx_device, R0_r)) + MCFG_MB88XX_READ_R2_CB(READ8(namco_50xx_device, R2_r)) MACHINE_CONFIG_END //------------------------------------------------- diff --git a/src/mame/machine/namco51.cpp b/src/mame/machine/namco51.cpp index 2fe1b736d79..76c34a5a76b 100644 --- a/src/mame/machine/namco51.cpp +++ b/src/mame/machine/namco51.cpp @@ -321,14 +321,6 @@ READ8_MEMBER( namco_51xx_device::read ) DEVICE INTERFACE ***************************************************************************/ -static ADDRESS_MAP_START( namco_51xx_map_io, AS_IO, 8, namco_51xx_device ) -// AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(namco_51xx_K_r) -// AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(namco_51xx_O_w) -// AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READ(namco_51xx_R0_r) -// AM_RANGE(MB88_PORTR2, MB88_PORTR2) AM_READ(namco_51xx_R2_r) -ADDRESS_MAP_END - - ROM_START( namco_51xx ) ROM_REGION( 0x400, "mcu", 0 ) ROM_LOAD( "51xx.bin", 0x0000, 0x0400, CRC(c2f57ef8) SHA1(50de79e0d6a76bda95ffb02fcce369a79e6abfec) ) @@ -398,7 +390,10 @@ void namco_51xx_device::device_reset() MACHINE_CONFIG_MEMBER( namco_51xx_device::device_add_mconfig ) MCFG_CPU_ADD("mcu", MB8843, DERIVED_CLOCK(1,1)) /* parent clock, internally divided by 6 */ - MCFG_CPU_IO_MAP(namco_51xx_map_io) +// MCFG_MB88XX_READ_K_CB(READ8(namco_51xx_device, namco_51xx_K_r)) +// MCFG_MB88XX_WRITE_O_CB(WRITE8(namco_51xx_device, namco_51xx_O_w)) +// MCFG_MB88XX_READ_R0_CB(READ8(namco_51xx_device, namco_51xx_R0_r)) +// MCFG_MB88XX_READ_R2_CB(READ8(namco_51xx_device, namco_51xx_R2_r)) MCFG_DEVICE_DISABLE() MACHINE_CONFIG_END diff --git a/src/mame/machine/namco53.cpp b/src/mame/machine/namco53.cpp index 79ea617b26d..d730d408483 100644 --- a/src/mame/machine/namco53.cpp +++ b/src/mame/machine/namco53.cpp @@ -67,9 +67,24 @@ READ8_MEMBER( namco_53xx_device::K_r ) return m_k(0); } -READ8_MEMBER( namco_53xx_device::Rx_r ) +READ8_MEMBER( namco_53xx_device::R0_r ) { - return (offset < ARRAY_LENGTH(m_in)) ? m_in[offset](0) : 0xff; + return m_in[0](0); +} + +READ8_MEMBER( namco_53xx_device::R1_r ) +{ + return m_in[1](0); +} + +READ8_MEMBER( namco_53xx_device::R2_r ) +{ + return m_in[2](0); +} + +READ8_MEMBER( namco_53xx_device::R3_r ) +{ + return m_in[3](0); } WRITE8_MEMBER( namco_53xx_device::O_w ) @@ -118,14 +133,6 @@ READ8_MEMBER( namco_53xx_device::read ) DEVICE INTERFACE ***************************************************************************/ -static ADDRESS_MAP_START( namco_53xx_map_io, AS_IO, 8,namco_53xx_device ) - AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(K_r) - AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(O_w) - AM_RANGE(MB88_PORTP, MB88_PORTP) AM_WRITE(P_w) - AM_RANGE(MB88_PORTR0, MB88_PORTR3) AM_READ(Rx_r) -ADDRESS_MAP_END - - ROM_START( namco_53xx ) ROM_REGION( 0x400, "mcu", 0 ) ROM_LOAD( "53xx.bin", 0x0000, 0x0400, CRC(b326fecb) SHA1(758d8583d658e4f1df93184009d86c3eb8713899) ) @@ -163,7 +170,13 @@ void namco_53xx_device::device_start() MACHINE_CONFIG_MEMBER( namco_53xx_device::device_add_mconfig ) MCFG_CPU_ADD("mcu", MB8843, DERIVED_CLOCK(1,1)) /* parent clock, internally divided by 6 */ - MCFG_CPU_IO_MAP(namco_53xx_map_io) + MCFG_MB88XX_READ_K_CB(READ8(namco_53xx_device, K_r)) + MCFG_MB88XX_WRITE_O_CB(WRITE8(namco_53xx_device, O_w)) + MCFG_MB88XX_WRITE_P_CB(WRITE8(namco_53xx_device, P_w)) + MCFG_MB88XX_READ_R0_CB(READ8(namco_53xx_device, R0_r)) + MCFG_MB88XX_READ_R1_CB(READ8(namco_53xx_device, R1_r)) + MCFG_MB88XX_READ_R2_CB(READ8(namco_53xx_device, R2_r)) + MCFG_MB88XX_READ_R3_CB(READ8(namco_53xx_device, R3_r)) MACHINE_CONFIG_END //------------------------------------------------- diff --git a/src/mame/machine/namco53.h b/src/mame/machine/namco53.h index 86f0360002a..f6c3c66aef2 100644 --- a/src/mame/machine/namco53.h +++ b/src/mame/machine/namco53.h @@ -40,7 +40,10 @@ public: template static devcb_base &set_p_port_callback(device_t &device, Object &&cb) { return downcast(device).m_p.set_callback(std::forward(cb)); } DECLARE_READ8_MEMBER( K_r ); - DECLARE_READ8_MEMBER( Rx_r ); + DECLARE_READ8_MEMBER( R0_r ); + DECLARE_READ8_MEMBER( R1_r ); + DECLARE_READ8_MEMBER( R2_r ); + DECLARE_READ8_MEMBER( R3_r ); DECLARE_WRITE8_MEMBER( O_w ); DECLARE_WRITE8_MEMBER( P_w ); diff --git a/src/mame/machine/namco62.cpp b/src/mame/machine/namco62.cpp index 2131a8d2e07..d44d7c5c6b0 100644 --- a/src/mame/machine/namco62.cpp +++ b/src/mame/machine/namco62.cpp @@ -22,14 +22,6 @@ DEVICE INTERFACE ***************************************************************************/ -static ADDRESS_MAP_START( namco_62xx_map_io, AS_IO, 8, namco_62xx_device ) -// AM_RANGE(MB88_PORTK, MB88_PORTK) AM_READ(namco_62xx_K_r) -// AM_RANGE(MB88_PORTO, MB88_PORTO) AM_WRITE(namco_62xx_O_w) -// AM_RANGE(MB88_PORTR0, MB88_PORTR0) AM_READ(namco_62xx_R0_r) -// AM_RANGE(MB88_PORTR2, MB88_PORTR2) AM_READ(namco_62xx_R2_r) -ADDRESS_MAP_END - - ROM_START( namco_62xx ) ROM_REGION( 0x800, "mcu", 0 ) ROM_LOAD( "62xx.bin", 0x0000, 0x0800, CRC(308dc115) SHA1(fe0a60fc339ac2eeed4879a64c1aab130f9d4cfe) ) @@ -67,7 +59,10 @@ void namco_62xx_device::device_start() MACHINE_CONFIG_MEMBER( namco_62xx_device::device_add_mconfig ) MCFG_CPU_ADD("mcu", MB8843, DERIVED_CLOCK(1,1)) /* parent clock, internally divided by 6 (TODO: Correct?) */ - MCFG_CPU_IO_MAP(namco_62xx_map_io) +// MCFG_MB88XX_READ_K_CB(READ8(namco_62xx_device, namco_62xx_K_r)) +// MCFG_MB88XX_WRITE_O_CB(WRITE8(namco_62xx_device, namco_62xx_O_w)) +// MCFG_MB88XX_READ_R0_CB(READ8(namco_62xx_device, namco_62xx_R0_r)) +// MCFG_MB88XX_READ_R2_CB(READ8(namco_62xx_device, namco_62xx_R2_r)) MCFG_DEVICE_DISABLE() MACHINE_CONFIG_END -- cgit v1.2.3