From bc431c5d635a6fe91c64efabfa9fc24a36290692 Mon Sep 17 00:00:00 2001 From: cam900 Date: Thu, 9 May 2019 06:09:13 +0900 Subject: taitoio.cpp : Updates (#4988) Simplify handlers, Fix debugger issue, Reduce unnecessary lines, Use shorter / correct type values --- src/mame/drivers/slapshot.cpp | 2 +- src/mame/drivers/taito_b.cpp | 4 +- src/mame/drivers/taito_h.cpp | 4 +- src/mame/drivers/taito_z.cpp | 8 ++-- src/mame/drivers/topspeed.cpp | 4 +- src/mame/machine/taitoio.cpp | 94 +++++++++++++++++++++---------------------- src/mame/machine/taitoio.h | 52 ++++++++++++------------ 7 files changed, 84 insertions(+), 84 deletions(-) diff --git a/src/mame/drivers/slapshot.cpp b/src/mame/drivers/slapshot.cpp index ee03a789de8..00a64b21e6a 100644 --- a/src/mame/drivers/slapshot.cpp +++ b/src/mame/drivers/slapshot.cpp @@ -182,7 +182,7 @@ READ16_MEMBER(slapshot_state::service_input_r) (ioport("SERVICE")->read() & 0x10)) << 8; /* IN3 + service switch */ default: - return m_tc0640fio->read(space, offset) << 8; + return m_tc0640fio->read(offset) << 8; } } diff --git a/src/mame/drivers/taito_b.cpp b/src/mame/drivers/taito_b.cpp index db5fc1d16cd..0579c45760f 100644 --- a/src/mame/drivers/taito_b.cpp +++ b/src/mame/drivers/taito_b.cpp @@ -294,11 +294,11 @@ WRITE16_MEMBER(taitob_state::player_34_coin_ctrl_w) WRITE16_MEMBER(taitob_state::spacedxo_tc0220ioc_w) { if (ACCESSING_BITS_0_7) - m_tc0220ioc->write(space, offset, data & 0xff); + m_tc0220ioc->write(offset, data & 0xff); else { /* spacedxo also writes here - bug? */ - m_tc0220ioc->write(space, offset, (data >> 8) & 0xff); + m_tc0220ioc->write(offset, (data >> 8) & 0xff); } } diff --git a/src/mame/drivers/taito_h.cpp b/src/mame/drivers/taito_h.cpp index a168730a5d8..4aad8ac9a1c 100644 --- a/src/mame/drivers/taito_h.cpp +++ b/src/mame/drivers/taito_h.cpp @@ -165,7 +165,7 @@ READ8_MEMBER(taitoh_state::syvalion_input_bypass_r) { /* Bypass TC0040IOC controller for analog input */ - u8 port = m_tc0040ioc->port_r(space, 0); /* read port number */ + u8 port = m_tc0040ioc->port_r(); /* read port number */ switch (port) { @@ -206,7 +206,7 @@ READ8_MEMBER(taitoh_state::syvalion_input_bypass_r) return 0x00; default: - return m_tc0040ioc->portreg_r(space, offset); + return m_tc0040ioc->portreg_r(); } } diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index 541c317ab8e..90e7980937e 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -1404,7 +1404,7 @@ READ8_MEMBER(taitoz_state::contcirc_input_bypass_r) { /* Bypass TC0040IOC controller for analog input */ - uint8_t port = m_tc0040ioc->port_r(space, 0); /* read port number */ + uint8_t port = m_tc0040ioc->port_r(); /* read port number */ uint16_t steer = 0xff80 + m_steer.read_safe(0x80); switch (port) @@ -1416,7 +1416,7 @@ READ8_MEMBER(taitoz_state::contcirc_input_bypass_r) return steer >> 8; default: - return m_tc0040ioc->portreg_r(space, offset); + return m_tc0040ioc->portreg_r(); } } @@ -1425,7 +1425,7 @@ READ8_MEMBER(taitoz_state::chasehq_input_bypass_r) { /* Bypass TC0040IOC controller for extra inputs */ - uint8_t port = m_tc0040ioc->port_r(space, 0); /* read port number */ + uint8_t port = m_tc0040ioc->port_r(); /* read port number */ uint16_t steer = 0xff80 + m_steer.read_safe(0x80); switch (port) @@ -1449,7 +1449,7 @@ READ8_MEMBER(taitoz_state::chasehq_input_bypass_r) return steer >> 8; default: - return m_tc0040ioc->portreg_r(space, offset); + return m_tc0040ioc->portreg_r(); } } diff --git a/src/mame/drivers/topspeed.cpp b/src/mame/drivers/topspeed.cpp index b9df8e091d9..9288b234e1e 100644 --- a/src/mame/drivers/topspeed.cpp +++ b/src/mame/drivers/topspeed.cpp @@ -191,7 +191,7 @@ WRITE16_MEMBER(topspeed_state::cpua_ctrl_w) READ8_MEMBER(topspeed_state::input_bypass_r) { // Read port number - uint8_t port = m_tc0040ioc->port_r(space, 0); + uint8_t port = m_tc0040ioc->port_r(); uint16_t steer = 0xff80 + m_steer.read_safe(0); switch (port) @@ -203,7 +203,7 @@ READ8_MEMBER(topspeed_state::input_bypass_r) return steer >> 8; default: - return m_tc0040ioc->portreg_r(space, offset); + return m_tc0040ioc->portreg_r(); } } diff --git a/src/mame/machine/taitoio.cpp b/src/mame/machine/taitoio.cpp index 24d6d7fea15..756442468a5 100644 --- a/src/mame/machine/taitoio.cpp +++ b/src/mame/machine/taitoio.cpp @@ -56,6 +56,7 @@ Newer version of the I/O chip ? #include "emu.h" #include "machine/taitoio.h" +#include /***************************************************************************/ /* */ @@ -67,7 +68,6 @@ DEFINE_DEVICE_TYPE(TC0040IOC, tc0040ioc_device, "tc0040ioc", "Taito TC0040IOC") tc0040ioc_device::tc0040ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TC0040IOC, tag, owner, clock), - m_regs{ 0, 0, 0, 0, 0, 0, 0, 0 }, m_port(0), m_watchdog(*this, "watchdog"), m_read_0_cb(*this), @@ -77,6 +77,7 @@ tc0040ioc_device::tc0040ioc_device(const machine_config &mconfig, const char *ta m_write_4_cb(*this), m_read_7_cb(*this) { + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -104,8 +105,7 @@ void tc0040ioc_device::device_reset() { m_port = 0; - for (auto & elem : m_regs) - elem = 0; + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -121,40 +121,41 @@ void tc0040ioc_device::device_add_mconfig(machine_config &config) DEVICE HANDLERS *****************************************************************************/ -READ8_MEMBER( tc0040ioc_device::read ) +u8 tc0040ioc_device::read(offs_t offset) { if (offset & 1) - return watchdog_r(space, 0); + return watchdog_r(); else - return portreg_r(space, 0); + return portreg_r(); } -WRITE8_MEMBER( tc0040ioc_device::write ) +void tc0040ioc_device::write(offs_t offset, u8 data) { if (offset & 1) - port_w(space, 0, data); + port_w(data); else - portreg_w(space, 0, data); + portreg_w(data); } -READ8_MEMBER( tc0040ioc_device::watchdog_r ) +u8 tc0040ioc_device::watchdog_r() { - m_watchdog->watchdog_reset(); + if (!machine().side_effects_disabled()) + m_watchdog->watchdog_reset(); return 0; } // only used now for "input bypass" hacks -READ8_MEMBER( tc0040ioc_device::port_r ) +u8 tc0040ioc_device::port_r() { return m_port; } -WRITE8_MEMBER( tc0040ioc_device::port_w ) +void tc0040ioc_device::port_w(u8 data) { m_port = data; } -READ8_MEMBER( tc0040ioc_device::portreg_r ) +u8 tc0040ioc_device::portreg_r() { switch (m_port) { @@ -182,7 +183,7 @@ READ8_MEMBER( tc0040ioc_device::portreg_r ) } } -WRITE8_MEMBER( tc0040ioc_device::portreg_w ) +void tc0040ioc_device::portreg_w(u8 data) { if (m_port < ARRAY_LENGTH(m_regs)) m_regs[m_port] = data; @@ -213,7 +214,6 @@ DEFINE_DEVICE_TYPE(TC0220IOC, tc0220ioc_device, "tc0220ioc", "Taito TC0220IOC") tc0220ioc_device::tc0220ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TC0220IOC, tag, owner, clock), - m_regs{ 0, 0, 0, 0, 0, 0, 0, 0 }, m_watchdog(*this, "watchdog"), m_read_0_cb(*this), m_read_1_cb(*this), @@ -223,6 +223,7 @@ tc0220ioc_device::tc0220ioc_device(const machine_config &mconfig, const char *ta m_write_4_cb(*this), m_read_7_cb(*this) { + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -248,8 +249,7 @@ void tc0220ioc_device::device_start() void tc0220ioc_device::device_reset() { - for (auto & elem : m_regs) - elem = 0; + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -266,7 +266,7 @@ void tc0220ioc_device::device_add_mconfig(machine_config &config) DEVICE HANDLERS *****************************************************************************/ -READ8_MEMBER( tc0220ioc_device::read ) +u8 tc0220ioc_device::read(offs_t offset) { switch (offset) { @@ -294,7 +294,7 @@ READ8_MEMBER( tc0220ioc_device::read ) } } -WRITE8_MEMBER( tc0220ioc_device::write ) +void tc0220ioc_device::write(offs_t offset, u8 data) { m_regs[offset] = data; switch (offset) @@ -341,6 +341,7 @@ tc0510nio_device::tc0510nio_device(const machine_config &mconfig, const char *ta m_write_4_cb(*this), m_read_7_cb(*this) { + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -366,8 +367,7 @@ void tc0510nio_device::device_start() void tc0510nio_device::device_reset() { - for (auto & elem : m_regs) - elem = 0; + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -383,7 +383,7 @@ void tc0510nio_device::device_add_mconfig(machine_config &config) DEVICE HANDLERS *****************************************************************************/ -READ8_MEMBER( tc0510nio_device::read ) +u8 tc0510nio_device::read(offs_t offset) { switch (offset) { @@ -411,7 +411,7 @@ READ8_MEMBER( tc0510nio_device::read ) } } -WRITE8_MEMBER( tc0510nio_device::write ) +void tc0510nio_device::write(offs_t offset, u8 data) { m_regs[offset] = data; @@ -435,31 +435,31 @@ WRITE8_MEMBER( tc0510nio_device::write ) } } -READ16_MEMBER( tc0510nio_device::halfword_r ) +u16 tc0510nio_device::halfword_r(offs_t offset) { - return read(space, offset); + return read(offset); } -WRITE16_MEMBER( tc0510nio_device::halfword_w ) +void tc0510nio_device::halfword_w(offs_t offset, u16 data, u16 mem_mask) { if (ACCESSING_BITS_0_7) - write(space, offset, data & 0xff); + write(offset, data & 0xff); else { /* driftout writes the coin counters here - bug? */ //logerror("CPU #0 %s: warning - write to MSB of TC0510NIO address %02x\n",m_maincpu->pc(),offset); - write(space, offset, (data >> 8) & 0xff); + write(offset, (data >> 8) & 0xff); } } -READ16_MEMBER( tc0510nio_device::halfword_wordswap_r ) +u16 tc0510nio_device::halfword_wordswap_r(offs_t offset) { - return halfword_r(space, offset ^ 1, mem_mask); + return halfword_r(offset ^ 1); } -WRITE16_MEMBER( tc0510nio_device::halfword_wordswap_w ) +void tc0510nio_device::halfword_wordswap_w(offs_t offset, u16 data, u16 mem_mask) { - halfword_w(space, offset ^ 1,data, mem_mask); + halfword_w(offset ^ 1,data, mem_mask); } @@ -482,6 +482,7 @@ tc0640fio_device::tc0640fio_device(const machine_config &mconfig, const char *ta m_write_4_cb(*this), m_read_7_cb(*this) { + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -506,8 +507,7 @@ void tc0640fio_device::device_start() void tc0640fio_device::device_reset() { - for (auto & elem : m_regs) - elem = 0; + std::fill(std::begin(m_regs), std::end(m_regs), 0); } //------------------------------------------------- @@ -524,7 +524,7 @@ void tc0640fio_device::device_add_mconfig(machine_config &config) DEVICE HANDLERS *****************************************************************************/ -READ8_MEMBER( tc0640fio_device::read ) +u8 tc0640fio_device::read(offs_t offset) { switch (offset) { @@ -552,7 +552,7 @@ READ8_MEMBER( tc0640fio_device::read ) } } -WRITE8_MEMBER( tc0640fio_device::write ) +void tc0640fio_device::write(offs_t offset, u8 data) { m_regs[offset] = data; switch (offset) @@ -571,34 +571,34 @@ WRITE8_MEMBER( tc0640fio_device::write ) } } -READ16_MEMBER( tc0640fio_device::halfword_r ) +u16 tc0640fio_device::halfword_r(offs_t offset) { - return read(space, offset); + return read(offset); } -WRITE16_MEMBER( tc0640fio_device::halfword_w ) +void tc0640fio_device::halfword_w(offs_t offset, u16 data, u16 mem_mask) { if (ACCESSING_BITS_0_7) - write(space, offset, data & 0xff); + write(offset, data & 0xff); else { - write(space, offset, (data >> 8) & 0xff); + write(offset, (data >> 8) & 0xff); //logerror("CPU #0 %s: warning - write to MSB of TC0640FIO address %02x\n",m_maincpu->pc(),offset); } } -READ16_MEMBER( tc0640fio_device::halfword_byteswap_r ) +u16 tc0640fio_device::halfword_byteswap_r(offs_t offset) { - return halfword_r(space, offset, mem_mask) << 8; + return halfword_r(offset) << 8; } -WRITE16_MEMBER( tc0640fio_device::halfword_byteswap_w ) +void tc0640fio_device::halfword_byteswap_w(offs_t offset, u16 data, u16 mem_mask) { if (ACCESSING_BITS_8_15) - write(space, offset, (data >> 8) & 0xff); + write(offset, (data >> 8) & 0xff); else { - write(space, offset, data & 0xff); + write(offset, data & 0xff); //logerror("CPU #0 %s: warning - write to LSB of TC0640FIO address %02x\n",m_maincpu->pc(),offset); } } diff --git a/src/mame/machine/taitoio.h b/src/mame/machine/taitoio.h index 06bd5868d2d..1d864c18b78 100644 --- a/src/mame/machine/taitoio.h +++ b/src/mame/machine/taitoio.h @@ -28,13 +28,13 @@ public: auto write_4_callback() { return m_write_4_cb.bind(); } auto read_7_callback() { return m_read_7_cb.bind(); } - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( watchdog_r ); - DECLARE_READ8_MEMBER( port_r ); - DECLARE_WRITE8_MEMBER( port_w ); - DECLARE_READ8_MEMBER( portreg_r ); - DECLARE_WRITE8_MEMBER( portreg_w ); + u8 read(offs_t offset); + void write(offs_t offset, u8 data); + u8 watchdog_r(); + u8 port_r(); + void port_w(u8 data); + u8 portreg_r(); + void portreg_w(u8 data); protected: // device-level overrides @@ -44,8 +44,8 @@ protected: private: // internal state - uint8_t m_regs[8]; - uint8_t m_port; + u8 m_regs[8]; + u8 m_port; required_device m_watchdog; @@ -72,8 +72,8 @@ public: auto write_4_callback() { return m_write_4_cb.bind(); } auto read_7_callback() { return m_read_7_cb.bind(); } - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); + u8 read(offs_t offset); + void write(offs_t offset, u8 data); protected: // device-level overrides @@ -83,7 +83,7 @@ protected: private: // internal state - uint8_t m_regs[8]; + u8 m_regs[8]; required_device m_watchdog; @@ -111,12 +111,12 @@ public: auto write_4_callback() { return m_write_4_cb.bind(); } auto read_7_callback() { return m_read_7_cb.bind(); } - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ16_MEMBER( halfword_r ); - DECLARE_WRITE16_MEMBER( halfword_w ); - DECLARE_READ16_MEMBER( halfword_wordswap_r ); - DECLARE_WRITE16_MEMBER( halfword_wordswap_w ); + u8 read(offs_t offset); + void write(offs_t offset, u8 data); + u16 halfword_r(offs_t offset); + void halfword_w(offs_t offset, u16 data, u16 mem_mask = ~0); + u16 halfword_wordswap_r(offs_t offset); + void halfword_wordswap_w(offs_t offset, u16 data, u16 mem_mask = ~0); protected: // device-level overrides @@ -126,7 +126,7 @@ protected: private: // internal state - uint8_t m_regs[8]; + u8 m_regs[8]; required_device m_watchdog; @@ -153,12 +153,12 @@ public: auto write_4_callback() { return m_write_4_cb.bind(); } auto read_7_callback() { return m_read_7_cb.bind(); } - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ16_MEMBER( halfword_r ); - DECLARE_WRITE16_MEMBER( halfword_w ); - DECLARE_READ16_MEMBER( halfword_byteswap_r ); - DECLARE_WRITE16_MEMBER( halfword_byteswap_w ); + u8 read(offs_t offset); + void write(offs_t offset, u8 data); + u16 halfword_r(offs_t offset); + void halfword_w(offs_t offset, u16 data, u16 mem_mask = ~0); + u16 halfword_byteswap_r(offs_t offset); + void halfword_byteswap_w(offs_t offset, u16 data, u16 mem_mask = ~0); protected: // device-level overrides @@ -168,7 +168,7 @@ protected: private: // internal state - uint8_t m_regs[8]; + u8 m_regs[8]; required_device m_watchdog; -- cgit v1.2.3