summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2013-12-22 22:05:13 +0000
committer smf- <smf-@users.noreply.github.com>2013-12-22 22:05:13 +0000
commit25b08cec6bd4f5ed88ed6eeef7e188fb0b17b9a3 (patch)
treed6b9d79cb951b2e626d475c839cff43e23c808dc /src/mess/machine
parentf3a8aceab46339c55609fa80cef99c3ad4aa153f (diff)
replaced read rx callback in Z80DART (and clones) with a write handler, which allows multiple chips to be connected together without using glue methods. [smf]
Diffstat (limited to 'src/mess/machine')
-rw-r--r--src/mess/machine/abc77.c12
-rw-r--r--src/mess/machine/abc77.h1
-rw-r--r--src/mess/machine/abc800kb.c12
-rw-r--r--src/mess/machine/abc800kb.h1
-rw-r--r--src/mess/machine/abc99.c31
-rw-r--r--src/mess/machine/abc99.h3
-rw-r--r--src/mess/machine/abckb.c25
-rw-r--r--src/mess/machine/abckb.h35
-rw-r--r--src/mess/machine/mc80.c6
-rw-r--r--src/mess/machine/tf20.c2
10 files changed, 58 insertions, 70 deletions
diff --git a/src/mess/machine/abc77.c b/src/mess/machine/abc77.c
index 4789501a188..8d1ad08d1d9 100644
--- a/src/mess/machine/abc77.c
+++ b/src/mess/machine/abc77.c
@@ -383,6 +383,8 @@ inline void abc77_device::serial_output(int state)
if (m_txd != state)
{
m_txd = state;
+
+ m_slot->write_rx(m_txd);
}
}
@@ -527,16 +529,6 @@ void abc77_device::device_timer(emu_timer &timer, device_timer_id id, int param,
//-------------------------------------------------
-// rxd_r -
-//-------------------------------------------------
-
-int abc77_device::rxd_r()
-{
- return m_txd;
-}
-
-
-//-------------------------------------------------
// txd_w -
//-------------------------------------------------
diff --git a/src/mess/machine/abc77.h b/src/mess/machine/abc77.h
index 78d2dc158e3..f34285ce06b 100644
--- a/src/mess/machine/abc77.h
+++ b/src/mess/machine/abc77.h
@@ -42,7 +42,6 @@ public:
virtual ioport_constructor device_input_ports() const;
// abc_keyboard_interface overrides
- virtual int rxd_r();
virtual void txd_w(int state);
DECLARE_INPUT_CHANGED_MEMBER( keyboard_reset );
diff --git a/src/mess/machine/abc800kb.c b/src/mess/machine/abc800kb.c
index 897e16e01e8..55a18604f86 100644
--- a/src/mess/machine/abc800kb.c
+++ b/src/mess/machine/abc800kb.c
@@ -293,6 +293,8 @@ inline void abc800_keyboard_device::serial_output(int state)
if (m_txd != state)
{
m_txd = state;
+
+ m_slot->write_rx(m_txd);
}
}
@@ -397,16 +399,6 @@ void abc800_keyboard_device::device_timer(emu_timer &timer, device_timer_id id,
//-------------------------------------------------
-// rxd_r -
-//-------------------------------------------------
-
-int abc800_keyboard_device::rxd_r()
-{
- return m_txd;
-}
-
-
-//-------------------------------------------------
// txd_w -
//-------------------------------------------------
diff --git a/src/mess/machine/abc800kb.h b/src/mess/machine/abc800kb.h
index d00bfe2f3af..f669a76763a 100644
--- a/src/mess/machine/abc800kb.h
+++ b/src/mess/machine/abc800kb.h
@@ -41,7 +41,6 @@ public:
virtual ioport_constructor device_input_ports() const;
// abc_keyboard_interface overrides
- virtual int rxd_r();
virtual void txd_w(int state);
// not really public
diff --git a/src/mess/machine/abc99.c b/src/mess/machine/abc99.c
index fc5899e5e1f..a4272a52213 100644
--- a/src/mess/machine/abc99.c
+++ b/src/mess/machine/abc99.c
@@ -431,6 +431,21 @@ inline void abc99_device::serial_input()
//-------------------------------------------------
+// serial_output -
+//-------------------------------------------------
+
+inline void abc99_device::serial_output(int state)
+{
+ if (m_txd != state)
+ {
+ m_txd = state;
+
+ m_slot->write_rx(m_txd);
+ }
+}
+
+
+//-------------------------------------------------
// serial_clock -
//-------------------------------------------------
@@ -489,7 +504,8 @@ abc99_device::abc99_device(const machine_config &mconfig, const char *tag, devic
m_t1_z2(0),
m_t1_z5(0),
m_led_en(0),
- m_reset(1)
+ m_reset(1),
+ m_txd(1)
{
}
@@ -516,6 +532,7 @@ void abc99_device::device_start()
save_item(NAME(m_t1_z5));
save_item(NAME(m_led_en));
save_item(NAME(m_reset));
+ save_item(NAME(m_txd));
}
@@ -551,16 +568,6 @@ void abc99_device::device_timer(emu_timer &timer, device_timer_id id, int param,
//-------------------------------------------------
-// rxd_r -
-//-------------------------------------------------
-
-int abc99_device::rxd_r()
-{
- return m_so_z2 && m_so_z5;
-}
-
-
-//-------------------------------------------------
// txd_w -
//-------------------------------------------------
@@ -616,6 +623,7 @@ WRITE8_MEMBER( abc99_device::z2_p1_w )
// serial output
m_so_z2 = BIT(data, 0);
+ serial_output(m_so_z2 && m_so_z5);
// key down
key_down(!BIT(data, 1));
@@ -758,6 +766,7 @@ WRITE8_MEMBER( abc99_device::z5_p2_w )
// serial output
m_so_z5 = BIT(data, 6);
+ serial_output(m_so_z2 && m_so_z5);
// keyboard CPU T1
m_t1_z2 = BIT(data, 7);
diff --git a/src/mess/machine/abc99.h b/src/mess/machine/abc99.h
index f754679f996..f93953ef83b 100644
--- a/src/mess/machine/abc99.h
+++ b/src/mess/machine/abc99.h
@@ -40,7 +40,6 @@ public:
virtual ioport_constructor device_input_ports() const;
// abc_keyboard_interface overrides
- virtual int rxd_r();
virtual void txd_w(int state);
DECLARE_INPUT_CHANGED_MEMBER( keyboard_reset );
@@ -83,6 +82,7 @@ private:
};
inline void serial_input();
+ inline void serial_output(int state);
inline void serial_clock();
inline void key_down(int state);
inline void scan_mouse();
@@ -108,6 +108,7 @@ private:
int m_t1_z5;
int m_led_en;
int m_reset;
+ int m_txd;
};
diff --git a/src/mess/machine/abckb.c b/src/mess/machine/abckb.c
index 48a208e31bd..60319fd7ecd 100644
--- a/src/mess/machine/abckb.c
+++ b/src/mess/machine/abckb.c
@@ -52,8 +52,9 @@ abc_keyboard_interface::abc_keyboard_interface(const machine_config &mconfig, de
abc_keyboard_port_device::abc_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, ABC_KEYBOARD_PORT, "Luxor ABC keyboard port", tag, owner, clock, "abc_keyboard_port", __FILE__),
device_slot_interface(mconfig, *this),
- m_write_trxc(*this),
- m_write_keydown(*this)
+ m_out_rx_handler(*this),
+ m_out_trxc_handler(*this),
+ m_out_keydown_handler(*this)
{
}
@@ -67,8 +68,9 @@ void abc_keyboard_port_device::device_start()
m_card = dynamic_cast<abc_keyboard_interface *>(get_card_device());
// resolve callbacks
- m_write_trxc.resolve_safe();
- m_write_keydown.resolve_safe();
+ m_out_rx_handler.resolve_safe();
+ m_out_trxc_handler.resolve_safe();
+ m_out_keydown_handler.resolve_safe();
}
@@ -84,17 +86,12 @@ void abc_keyboard_port_device::device_reset()
//-------------------------------------------------
-// rxd_r -
+// write_rx -
//-------------------------------------------------
-READ_LINE_MEMBER( abc_keyboard_port_device::rxd_r )
+WRITE_LINE_MEMBER( abc_keyboard_port_device::write_rx )
{
- int state = 1;
-
- if (m_card != NULL)
- state = m_card->rxd_r();
-
- return state;
+ m_out_rx_handler(state);
}
@@ -115,7 +112,7 @@ WRITE_LINE_MEMBER( abc_keyboard_port_device::txd_w )
WRITE_LINE_MEMBER( abc_keyboard_port_device::trxc_w )
{
- m_write_trxc(state);
+ m_out_trxc_handler(state);
}
@@ -125,7 +122,7 @@ WRITE_LINE_MEMBER( abc_keyboard_port_device::trxc_w )
WRITE_LINE_MEMBER( abc_keyboard_port_device::keydown_w )
{
- m_write_keydown(state);
+ m_out_keydown_handler(state);
}
diff --git a/src/mess/machine/abckb.h b/src/mess/machine/abckb.h
index 6995520b544..f9c050b11ed 100644
--- a/src/mess/machine/abckb.h
+++ b/src/mess/machine/abckb.h
@@ -19,21 +19,21 @@
//**************************************************************************
-// MACROS / CONSTANTS
+// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define ABC_KEYBOARD_PORT_TAG "kb"
-
+#define MCFG_ABC_KEYBOARD_PORT_ADD(_tag, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, ABC_KEYBOARD_PORT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(abc_keyboard_devices, _def_slot, false)
+#define MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(_devcb) \
+ devcb = &abc_keyboard_port_device::set_out_rx_handler(*device, DEVCB2_##_devcb);
-//**************************************************************************
-// INTERFACE CONFIGURATION MACROS
-//**************************************************************************
+#define MCFG_ABC_KEYBOARD_OUT_TRXC_HANDLER(_devcb) \
+ devcb = &abc_keyboard_port_device::set_out_trxc_handler(*device, DEVCB2_##_devcb);
-#define MCFG_ABC_KEYBOARD_PORT_ADD(_def_slot, _trxc, _keydown) \
- MCFG_DEVICE_ADD(ABC_KEYBOARD_PORT_TAG, ABC_KEYBOARD_PORT, 0) \
- MCFG_DEVICE_SLOT_INTERFACE(abc_keyboard_devices, _def_slot, false) \
- downcast<abc_keyboard_port_device *>(device)->set_callbacks(DEVCB2_##_trxc, DEVCB2_##_keydown);
+#define MCFG_ABC_KEYBOARD_OUT_KEYDOWN_HANDLER(_devcb) \
+ devcb = &abc_keyboard_port_device::set_out_keydown_handler(*device, DEVCB2_##_devcb);
@@ -50,16 +50,15 @@ public:
// construction/destruction
abc_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
- template<class _trxc, class _keydown> void set_callbacks(_trxc trxc, _keydown keydown) {
- m_write_trxc.set_callback(trxc);
- m_write_keydown.set_callback(keydown);
- }
+ template<class _Object> static devcb2_base &set_out_rx_handler(device_t &device, _Object object) { return downcast<abc_keyboard_port_device &>(device).m_out_rx_handler.set_callback(object); }
+ template<class _Object> static devcb2_base &set_out_trxc_handler(device_t &device, _Object object) { return downcast<abc_keyboard_port_device &>(device).m_out_trxc_handler.set_callback(object); }
+ template<class _Object> static devcb2_base &set_out_keydown_handler(device_t &device, _Object object) { return downcast<abc_keyboard_port_device &>(device).m_out_keydown_handler.set_callback(object); }
// computer interface
- DECLARE_READ_LINE_MEMBER( rxd_r );
DECLARE_WRITE_LINE_MEMBER( txd_w );
// peripheral interface
+ DECLARE_WRITE_LINE_MEMBER( write_rx );
DECLARE_WRITE_LINE_MEMBER( trxc_w );
DECLARE_WRITE_LINE_MEMBER( keydown_w );
@@ -68,8 +67,9 @@ protected:
virtual void device_start();
virtual void device_reset();
- devcb2_write_line m_write_trxc;
- devcb2_write_line m_write_keydown;
+ devcb2_write_line m_out_rx_handler;
+ devcb2_write_line m_out_trxc_handler;
+ devcb2_write_line m_out_keydown_handler;
abc_keyboard_interface *m_card;
};
@@ -81,7 +81,6 @@ public:
// construction/destruction
abc_keyboard_interface(const machine_config &mconfig, device_t &device);
- virtual int rxd_r() { return 1; };
virtual void txd_w(int state) { };
protected:
diff --git a/src/mess/machine/mc80.c b/src/mess/machine/mc80.c
index 67552aef017..9ac678da883 100644
--- a/src/mess/machine/mc80.c
+++ b/src/mess/machine/mc80.c
@@ -201,14 +201,16 @@ Z80SIO_INTERFACE( mc8030_asp_z80sio_intf )
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
- DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
- DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
DEVCB_NULL
};
diff --git a/src/mess/machine/tf20.c b/src/mess/machine/tf20.c
index 1c7d7d3698e..1e0867f0b7d 100644
--- a/src/mess/machine/tf20.c
+++ b/src/mess/machine/tf20.c
@@ -93,14 +93,12 @@ static UPD7201_INTERFACE( tf20_upd7201_intf )
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
- DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
- DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,