mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
taitoio.cpp : Updates (#4988)
Simplify handlers, Fix debugger issue, Reduce unnecessary lines, Use shorter / correct type values
This commit is contained in:
parent
b2d1b490a4
commit
bc431c5d63
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ Newer version of the I/O chip ?
|
||||
#include "emu.h"
|
||||
#include "machine/taitoio.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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<watchdog_timer_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<watchdog_timer_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<watchdog_timer_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<watchdog_timer_device> m_watchdog;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user