From dfd8cf4a5e5c86547f5a156a94a0b2eee83f16e1 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 7 Jun 2017 15:03:41 -0400 Subject: Add port 3 write callback for TC0220IOC and TC0510NIO (nw) --- src/mame/drivers/othunder.cpp | 47 +++++++++++-------------------------------- src/mame/drivers/taito_z.cpp | 32 ++++++----------------------- src/mame/includes/othunder.h | 3 +-- src/mame/includes/taito_z.h | 3 +-- src/mame/machine/taitoio.cpp | 12 +++++++++++ src/mame/machine/taitoio.h | 10 +++++++++ 6 files changed, 42 insertions(+), 65 deletions(-) diff --git a/src/mame/drivers/othunder.cpp b/src/mame/drivers/othunder.cpp index 40c47f16e00..c577422a7e1 100644 --- a/src/mame/drivers/othunder.cpp +++ b/src/mame/drivers/othunder.cpp @@ -352,13 +352,8 @@ The eeprom unlock command is different, and the write/clock/reset bits are different. ******************************************************************/ -WRITE16_MEMBER(othunder_state::tc0220ioc_w) +WRITE8_MEMBER(othunder_state::eeprom_w) { - if (ACCESSING_BITS_0_7) - { - switch (offset) - { - case 0x03: /* 0000000x SOL-1 (gun solenoid) 000000x0 SOL-2 (gun solenoid) @@ -369,22 +364,16 @@ WRITE16_MEMBER(othunder_state::tc0220ioc_w) 0x000000 eeprom in data x0000000 eeprom out data */ - /* Recoil Piston Motor Status */ - output().set_value("Player1_Recoil_Piston", data & 0x1 ); - output().set_value("Player2_Recoil_Piston", (data & 0x2) >>1 ); - - if (data & 4) - popmessage("OBPRI SET!"); + /* Recoil Piston Motor Status */ + output().set_value("Player1_Recoil_Piston", data & 0x1 ); + output().set_value("Player2_Recoil_Piston", (data & 0x2) >>1 ); - m_eeprom->di_write((data & 0x40) >> 6); - m_eeprom->clk_write((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); - m_eeprom->cs_write((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); - break; + if (data & 4) + popmessage("OBPRI SET!"); - default: - m_tc0220ioc->write(space, offset, data & 0xff); - } - } + m_eeprom->di_write((data & 0x40) >> 6); + m_eeprom->clk_write((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->cs_write((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); } @@ -392,18 +381,6 @@ WRITE16_MEMBER(othunder_state::tc0220ioc_w) GAME INPUTS **********************************************************/ -READ16_MEMBER(othunder_state::tc0220ioc_r) -{ - switch (offset) - { - case 0x03: - return (m_eeprom->do_read() & 1) << 7; - - default: - return m_tc0220ioc->read(space, offset); - } -} - #define P1X_PORT_TAG "P1X" #define P1Y_PORT_TAG "P1Y" #define P2X_PORT_TAG "P2X" @@ -488,8 +465,7 @@ WRITE8_MEMBER(othunder_state::tc0310fam_w) static ADDRESS_MAP_START( othunder_map, AS_PROGRAM, 16, othunder_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x08ffff) AM_RAM - AM_RANGE(0x090000, 0x09000f) AM_READWRITE(tc0220ioc_r, tc0220ioc_w) -// AM_RANGE(0x090006, 0x090007) AM_WRITE(eeprom_w) + AM_RANGE(0x090000, 0x09000f) AM_DEVREADWRITE8("tc0220ioc", tc0220ioc_device, read, write, 0x00ff) // AM_RANGE(0x09000c, 0x09000d) AM_WRITENOP /* ?? (keeps writing 0x77) */ AM_RANGE(0x100000, 0x100007) AM_DEVREADWRITE("tc0110pcr", tc0110pcr_device, word_r, step1_rbswap_word_w) /* palette */ AM_RANGE(0x200000, 0x20ffff) AM_DEVREADWRITE("tc0100scn", tc0100scn_device, word_r, word_w) /* tilemaps */ @@ -696,7 +672,8 @@ static MACHINE_CONFIG_START( othunder ) MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) + MCFG_TC0220IOC_READ_3_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) + MCFG_TC0220IOC_WRITE_3_CB(WRITE8(othunder_state, eeprom_w)) MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) /* video hardware */ diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index 1df86c901c5..aa6eae9fa00 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -1079,25 +1079,16 @@ READ16_MEMBER(taitoz_state::eep_latch_r) } #endif -WRITE16_MEMBER(taitoz_state::spacegun_output_bypass_w) +WRITE8_MEMBER(taitoz_state::spacegun_eeprom_w) { - switch (offset) - { - case 0x03: - /* 0000xxxx (unused) 000x0000 eeprom reset (active low) 00x00000 eeprom clock 0x000000 eeprom data x0000000 (unused) */ - COMBINE_DATA(&m_eep_latch); - ioport("EEPROMOUT")->write(data, 0xff); - break; - - default: - m_tc0510nio->write(space, offset, data); - } + COMBINE_DATA(&m_eep_latch); + ioport("EEPROMOUT")->write(data, 0xff); } @@ -1243,18 +1234,6 @@ READ16_MEMBER(taitoz_state::sci_steer_input_r) } -READ16_MEMBER(taitoz_state::spacegun_input_bypass_r) -{ - switch (offset) - { - case 0x03: - return m_eeprom->do_read() << 7; - - default: - return m_tc0510nio->read(space, offset); - } -} - READ16_MEMBER(taitoz_state::spacegun_lightgun_r) { switch (offset) @@ -1662,7 +1641,7 @@ static ADDRESS_MAP_START( spacegun_cpub_map, AS_PROGRAM, 16, taitoz_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x20c000, 0x20ffff) AM_RAM AM_RANGE(0x210000, 0x21ffff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x800000, 0x80000f) AM_READWRITE(spacegun_input_bypass_r, spacegun_output_bypass_w) + AM_RANGE(0x800000, 0x80000f) AM_DEVREADWRITE("tc0510nio", tc0510nio_device, halfword_r, halfword_w) AM_RANGE(0xc00000, 0xc00007) AM_DEVREADWRITE8("ymsnd", ym2610_device, read, write, 0x00ff) AM_RANGE(0xc0000c, 0xc0000d) AM_NOP // interrupt controller? AM_RANGE(0xc0000e, 0xc0000f) AM_NOP @@ -3528,7 +3507,8 @@ static MACHINE_CONFIG_START( spacegun ) MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) + MCFG_TC0510NIO_READ_3_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) + MCFG_TC0510NIO_WRITE_3_CB(WRITE8(taitoz_state, spacegun_eeprom_w)) MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) /* video hardware */ diff --git a/src/mame/includes/othunder.h b/src/mame/includes/othunder.h index 16254afdb11..2244313948a 100644 --- a/src/mame/includes/othunder.h +++ b/src/mame/includes/othunder.h @@ -42,8 +42,7 @@ public: m_palette(*this, "palette") { } DECLARE_WRITE16_MEMBER(irq_ack_w); - DECLARE_WRITE16_MEMBER(tc0220ioc_w); - DECLARE_READ16_MEMBER(tc0220ioc_r); + DECLARE_WRITE8_MEMBER(eeprom_w); DECLARE_READ16_MEMBER(lightgun_r); DECLARE_WRITE16_MEMBER(lightgun_w); DECLARE_WRITE8_MEMBER(sound_bankswitch_w); diff --git a/src/mame/includes/taito_z.h b/src/mame/includes/taito_z.h index 0433a0fadd1..560910ed4d1 100644 --- a/src/mame/includes/taito_z.h +++ b/src/mame/includes/taito_z.h @@ -74,14 +74,13 @@ public: DECLARE_WRITE16_MEMBER(bshark_cpua_ctrl_w); DECLARE_WRITE16_MEMBER(chasehq_cpua_ctrl_w); DECLARE_WRITE16_MEMBER(dblaxle_cpua_ctrl_w); - DECLARE_WRITE16_MEMBER(spacegun_output_bypass_w); + DECLARE_WRITE8_MEMBER(spacegun_eeprom_w); DECLARE_READ8_MEMBER(contcirc_input_bypass_r); DECLARE_READ8_MEMBER(chasehq_input_bypass_r); DECLARE_READ16_MEMBER(bshark_stick_r); DECLARE_READ16_MEMBER(nightstr_stick_r); DECLARE_WRITE16_MEMBER(bshark_stick_w); DECLARE_READ16_MEMBER(sci_steer_input_r); - DECLARE_READ16_MEMBER(spacegun_input_bypass_r); DECLARE_READ16_MEMBER(spacegun_lightgun_r); DECLARE_WRITE16_MEMBER(spacegun_lightgun_w); DECLARE_WRITE16_MEMBER(spacegun_gun_output_w); diff --git a/src/mame/machine/taitoio.cpp b/src/mame/machine/taitoio.cpp index ae754907687..86d4d4d3a12 100644 --- a/src/mame/machine/taitoio.cpp +++ b/src/mame/machine/taitoio.cpp @@ -65,6 +65,7 @@ tc0220ioc_device::tc0220ioc_device(const machine_config &mconfig, const char *ta m_read_1_cb(*this), m_read_2_cb(*this), m_read_3_cb(*this), + m_write_3_cb(*this), m_read_7_cb(*this) { } @@ -79,6 +80,7 @@ void tc0220ioc_device::device_start() m_read_1_cb.resolve_safe(0); m_read_2_cb.resolve_safe(0); m_read_3_cb.resolve_safe(0); + m_write_3_cb.resolve_safe(); m_read_7_cb.resolve_safe(0); save_item(NAME(m_regs)); @@ -146,6 +148,10 @@ WRITE8_MEMBER( tc0220ioc_device::write ) m_watchdog->watchdog_reset(); break; + case 0x03: + m_write_3_cb(data); + break; + case 0x04: /* coin counters and lockout, hi nibble irrelevant */ machine().bookkeeping().coin_lockout_w(0, ~data & 0x01); @@ -200,6 +206,7 @@ tc0510nio_device::tc0510nio_device(const machine_config &mconfig, const char *ta m_read_1_cb(*this), m_read_2_cb(*this), m_read_3_cb(*this), + m_write_3_cb(*this), m_read_7_cb(*this) { } @@ -214,6 +221,7 @@ void tc0510nio_device::device_start() m_read_1_cb.resolve_safe(0); m_read_2_cb.resolve_safe(0); m_read_3_cb.resolve_safe(0); + m_write_3_cb.resolve_safe(); m_read_7_cb.resolve_safe(0); save_item(NAME(m_regs)); @@ -279,6 +287,10 @@ WRITE8_MEMBER( tc0510nio_device::write ) m_watchdog->watchdog_reset(); break; + case 0x03: + m_write_3_cb(data); + break; + case 0x04: /* coin counters and lockout */ machine().bookkeeping().coin_lockout_w(0, ~data & 0x01); machine().bookkeeping().coin_lockout_w(1, ~data & 0x02); diff --git a/src/mame/machine/taitoio.h b/src/mame/machine/taitoio.h index dfd9e63e600..7ddfc2aefdc 100644 --- a/src/mame/machine/taitoio.h +++ b/src/mame/machine/taitoio.h @@ -25,6 +25,7 @@ public: template static devcb_base &set_read_1_callback(device_t &device, Object &&cb) { return downcast(device).m_read_1_cb.set_callback(std::forward(cb)); } template static devcb_base &set_read_2_callback(device_t &device, Object &&cb) { return downcast(device).m_read_2_cb.set_callback(std::forward(cb)); } template static devcb_base &set_read_3_callback(device_t &device, Object &&cb) { return downcast(device).m_read_3_cb.set_callback(std::forward(cb)); } + template static devcb_base &set_write_3_callback(device_t &device, Object &&cb) { return downcast(device).m_write_3_cb.set_callback(std::forward(cb)); } template static devcb_base &set_read_7_callback(device_t &device, Object &&cb) { return downcast(device).m_read_7_cb.set_callback(std::forward(cb)); } DECLARE_READ8_MEMBER( read ); @@ -51,6 +52,7 @@ private: devcb_read8 m_read_1_cb; devcb_read8 m_read_2_cb; devcb_read8 m_read_3_cb; + devcb_write8 m_write_3_cb; devcb_read8 m_read_7_cb; }; @@ -65,6 +67,7 @@ public: template static devcb_base &set_read_1_callback(device_t &device, Object &&cb) { return downcast(device).m_read_1_cb.set_callback(std::forward(cb)); } template static devcb_base &set_read_2_callback(device_t &device, Object &&cb) { return downcast(device).m_read_2_cb.set_callback(std::forward(cb)); } template static devcb_base &set_read_3_callback(device_t &device, Object &&cb) { return downcast(device).m_read_3_cb.set_callback(std::forward(cb)); } + template static devcb_base &set_write_3_callback(device_t &device, Object &&cb) { return downcast(device).m_write_3_cb.set_callback(std::forward(cb)); } template static devcb_base &set_read_7_callback(device_t &device, Object &&cb) { return downcast(device).m_read_7_cb.set_callback(std::forward(cb)); } DECLARE_READ8_MEMBER( read ); @@ -90,6 +93,7 @@ private: devcb_read8 m_read_1_cb; devcb_read8 m_read_2_cb; devcb_read8 m_read_3_cb; + devcb_write8 m_write_3_cb; devcb_read8 m_read_7_cb; }; @@ -152,6 +156,9 @@ DECLARE_DEVICE_TYPE(TC0640FIO, tc0640fio_device) #define MCFG_TC0220IOC_READ_3_CB(_devcb) \ devcb = &tc0220ioc_device::set_read_3_callback(*device, DEVCB_##_devcb); +#define MCFG_TC0220IOC_WRITE_3_CB(_devcb) \ + devcb = &tc0220ioc_device::set_write_3_callback(*device, DEVCB_##_devcb); + #define MCFG_TC0220IOC_READ_7_CB(_devcb) \ devcb = &tc0220ioc_device::set_read_7_callback(*device, DEVCB_##_devcb); @@ -168,6 +175,9 @@ DECLARE_DEVICE_TYPE(TC0640FIO, tc0640fio_device) #define MCFG_TC0510NIO_READ_3_CB(_devcb) \ devcb = &tc0510nio_device::set_read_3_callback(*device, DEVCB_##_devcb); +#define MCFG_TC0510NIO_WRITE_3_CB(_devcb) \ + devcb = &tc0510nio_device::set_write_3_callback(*device, DEVCB_##_devcb); + #define MCFG_TC0510NIO_READ_7_CB(_devcb) \ devcb = &tc0510nio_device::set_read_7_callback(*device, DEVCB_##_devcb); -- cgit v1.2.3