summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/taitoio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/taitoio.cpp')
-rw-r--r--src/mame/machine/taitoio.cpp177
1 files changed, 153 insertions, 24 deletions
diff --git a/src/mame/machine/taitoio.cpp b/src/mame/machine/taitoio.cpp
index 8ead32ba709..9e8187fdaf7 100644
--- a/src/mame/machine/taitoio.cpp
+++ b/src/mame/machine/taitoio.cpp
@@ -2,6 +2,15 @@
// copyright-holders:Nicola Salmoria
/***************************************************************************
+TC0040IOC
+---------
+Taito's first custom I/O interface differs a bit from its successors,
+being a 64-pin DIP with an address port and a data port. Besides digital
+inputs, coin-related outputs and an integrated watchdog, this chip also
+handles steering wheel and trackball input conversion in various games (not
+emulated here yet).
+
+
TC0220IOC
---------
A simple I/O interface with integrated watchdog in a 80-pin flat package.
@@ -50,6 +59,150 @@ Newer version of the I/O chip ?
/***************************************************************************/
/* */
+/* TC0040IOC */
+/* */
+/***************************************************************************/
+
+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),
+ m_read_1_cb(*this),
+ m_read_2_cb(*this),
+ m_read_3_cb(*this),
+ m_write_4_cb(*this),
+ m_read_7_cb(*this)
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void tc0040ioc_device::device_start()
+{
+ m_read_0_cb.resolve_safe(0);
+ m_read_1_cb.resolve_safe(0);
+ m_read_2_cb.resolve_safe(0);
+ m_read_3_cb.resolve_safe(0);
+ m_write_4_cb.resolve_safe();
+ m_read_7_cb.resolve_safe(0);
+
+ save_item(NAME(m_regs));
+ save_item(NAME(m_port));
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void tc0040ioc_device::device_reset()
+{
+ m_port = 0;
+
+ for (auto & elem : m_regs)
+ elem = 0;
+}
+
+//-------------------------------------------------
+// device_add_mconfig - add device configuration
+//-------------------------------------------------
+
+MACHINE_CONFIG_MEMBER( tc0040ioc_device::device_add_mconfig )
+ MCFG_WATCHDOG_ADD("watchdog")
+MACHINE_CONFIG_END
+
+/*****************************************************************************
+ DEVICE HANDLERS
+*****************************************************************************/
+
+READ8_MEMBER( tc0040ioc_device::read )
+{
+ if (offset & 1)
+ return watchdog_r(space, 0);
+ else
+ return portreg_r(space, 0);
+}
+
+WRITE8_MEMBER( tc0040ioc_device::write )
+{
+ if (offset & 1)
+ port_w(space, 0, data);
+ else
+ portreg_w(space, 0, data);
+}
+
+READ8_MEMBER( tc0040ioc_device::watchdog_r )
+{
+ m_watchdog->watchdog_reset();
+ return 0;
+}
+
+// only used now for "input bypass" hacks
+READ8_MEMBER( tc0040ioc_device::port_r )
+{
+ return m_port;
+}
+
+WRITE8_MEMBER( tc0040ioc_device::port_w )
+{
+ m_port = data;
+}
+
+READ8_MEMBER( tc0040ioc_device::portreg_r )
+{
+ switch (m_port)
+ {
+ case 0x00:
+ return m_read_0_cb(0);
+
+ case 0x01:
+ return m_read_1_cb(0);
+
+ case 0x02:
+ return m_read_2_cb(0);
+
+ case 0x03:
+ return m_read_3_cb(0);
+
+ case 0x04: /* coin counters and lockout */
+ return m_regs[4];
+
+ case 0x07:
+ return m_read_7_cb(0);
+
+ default:
+//logerror("PC %06x: warning - read TC0040IOC address %02x\n",space.device().safe_pc(),m_port);
+ return 0xff;
+ }
+}
+
+WRITE8_MEMBER( tc0040ioc_device::portreg_w )
+{
+ m_regs[m_port] = data;
+ switch (m_port)
+ {
+ case 0x04: /* coin counters and lockout, hi nibble irrelevant */
+ m_write_4_cb(data & 0x0f);
+
+//if (data & 0xf0)
+//logerror("PC %06x: warning - write %02x to TC0040IOC address %02x\n",space.device().safe_pc(),data,m_port);
+
+ break;
+
+ default:
+//logerror("PC %06x: warning - write %02x to TC0040IOC address %02x\n",space.device().safe_pc(),data,m_port);
+ break;
+ }
+}
+
+
+/***************************************************************************/
+/* */
/* TC0220IOC */
/* */
/***************************************************************************/
@@ -59,7 +212,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_port(0),
m_watchdog(*this, "watchdog"),
m_read_0_cb(*this),
m_read_1_cb(*this),
@@ -86,7 +238,6 @@ void tc0220ioc_device::device_start()
m_read_7_cb.resolve_safe(0);
save_item(NAME(m_regs));
- save_item(NAME(m_port));
}
//-------------------------------------------------
@@ -95,8 +246,6 @@ void tc0220ioc_device::device_start()
void tc0220ioc_device::device_reset()
{
- m_port = 0;
-
for (auto & elem : m_regs)
elem = 0;
}
@@ -168,26 +317,6 @@ WRITE8_MEMBER( tc0220ioc_device::write )
}
}
-READ8_MEMBER( tc0220ioc_device::port_r )
-{
- return m_port;
-}
-
-WRITE8_MEMBER( tc0220ioc_device::port_w )
-{
- m_port = data;
-}
-
-READ8_MEMBER( tc0220ioc_device::portreg_r )
-{
- return read(space, m_port);
-}
-
-WRITE8_MEMBER( tc0220ioc_device::portreg_w )
-{
- write(space, m_port, data);
-}
-
/***************************************************************************/
/* */
/* TC0510NIO */