diff --git a/.gitattributes b/.gitattributes index 3c639481c9e..070781f0c35 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6911,6 +6911,8 @@ src/mess/machine/abc_xebec.c svneol=native#text/plain src/mess/machine/abc_xebec.h svneol=native#text/plain src/mess/machine/abcbus.c svneol=native#text/plain src/mess/machine/abcbus.h svneol=native#text/plain +src/mess/machine/abckb.c svneol=native#text/plain +src/mess/machine/abckb.h svneol=native#text/plain src/mess/machine/ac1.c svneol=native#text/plain src/mess/machine/acb4070.c svneol=native#text/plain src/mess/machine/acb4070.h svneol=native#text/plain diff --git a/src/mess/drivers/abc1600.c b/src/mess/drivers/abc1600.c index 7d545ce6eeb..98dda8a9cdd 100644 --- a/src/mess/drivers/abc1600.c +++ b/src/mess/drivers/abc1600.c @@ -1531,8 +1531,8 @@ static Z80DART_INTERFACE( dart_intf ) DEVCB_NULL, DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(ABC99_TAG, abc99_device, txd_r), - DEVCB_DEVICE_LINE_MEMBER(ABC99_TAG, abc99_device, rxd_w), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, rxd_r), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, @@ -1730,17 +1730,6 @@ void abc1600_state::fdc_drq_w(bool state) } -//------------------------------------------------- -// ABC99_INTERFACE( abc99_intf ) -//------------------------------------------------- - -static ABC99_INTERFACE( abc99_intf ) -{ - DEVCB_DEVICE_LINE_MEMBER(Z8470AB1_TAG, z80dart_device, rxtxcb_w), - DEVCB_DEVICE_LINE_MEMBER(Z8470AB1_TAG, z80dart_device, dcdb_w) -}; - - //------------------------------------------------- // ABC1600BUS_INTERFACE( abcbus_intf ) //------------------------------------------------- @@ -1955,7 +1944,7 @@ static MACHINE_CONFIG_START( abc1600, abc1600_state ) MCFG_FLOPPY_DRIVE_ADD(SAB1797_02P_TAG":2", abc1600_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232a_intf, default_rs232_devices, NULL) MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232b_intf, default_rs232_devices, NULL) - MCFG_ABC99_ADD(abc99_intf) + MCFG_ABC_KEYBOARD_PORT_ADD("abc99", DEVWRITELINE(Z8470AB1_TAG, z80dart_device, rxtxcb_w), DEVWRITELINE(Z8470AB1_TAG, z80dart_device, dcdb_w)) MCFG_ABC1600BUS_SLOT_ADD("bus0i", bus0i_intf, abc1600bus_cards, NULL) MCFG_ABC1600BUS_SLOT_ADD("bus0x", bus0x_intf, abc1600bus_cards, NULL) diff --git a/src/mess/drivers/abc80.c b/src/mess/drivers/abc80.c index c85dec44125..429337f65e5 100644 --- a/src/mess/drivers/abc80.c +++ b/src/mess/drivers/abc80.c @@ -433,11 +433,6 @@ WRITE_LINE_MEMBER( abc80_state::keydown_w ) m_pio->port_a_write(m_key_strobe << 7); } -static ABC80_KEYBOARD_INTERFACE( kb_intf ) -{ - DEVCB_DRIVER_LINE_MEMBER(abc80_state, keydown_w) -}; - WRITE8_MEMBER( abc80_state::kbd_w ) { m_key_data = data; @@ -587,7 +582,7 @@ static MACHINE_CONFIG_START( abc80, abc80_state ) // devices MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_11_9808MHz/2/2, pio_intf) MCFG_CASSETTE_ADD("cassette", abc80_cassette_interface) - MCFG_ABC80_KEYBOARD_ADD(kb_intf) + MCFG_ABC80_KEYBOARD_ADD(WRITELINE(abc80_state, keydown_w)) MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_intf, abcbus_cards, "slow") MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("slow", abc830_slow) MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL) diff --git a/src/mess/drivers/abc80x.c b/src/mess/drivers/abc80x.c index f1b760e52fc..a963a74b8a5 100644 --- a/src/mess/drivers/abc80x.c +++ b/src/mess/drivers/abc80x.c @@ -773,8 +773,8 @@ static Z80DART_INTERFACE( abc800_dart_intf ) DEVCB_NULL, DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(ABC800_KEYBOARD_TAG, abc800_keyboard_device, txd_r), - DEVCB_DEVICE_LINE_MEMBER(ABC800_KEYBOARD_TAG, abc800_keyboard_device, rxd_w), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, rxd_r), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, @@ -811,8 +811,8 @@ static Z80DART_INTERFACE( abc802_dart_intf ) DEVCB_NULL, DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(ABC77_TAG, abc77_device, txd_r), - DEVCB_DEVICE_LINE_MEMBER(ABC77_TAG, abc77_device, rxd_w), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, rxd_r), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w), DEVCB_DRIVER_LINE_MEMBER(abc802_state, lrs_w), DEVCB_DRIVER_LINE_MEMBER(abc802_state, mux80_40_w), DEVCB_NULL, @@ -844,8 +844,8 @@ static Z80DART_INTERFACE( abc806_dart_intf ) DEVCB_NULL, DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(ABC77_TAG, abc77_device, txd_r), - DEVCB_DEVICE_LINE_MEMBER(ABC77_TAG, abc77_device, rxd_w), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, rxd_r), + DEVCB_DEVICE_LINE_MEMBER(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w), DEVCB_DRIVER_LINE_MEMBER(abc806_state, keydtr_w), DEVCB_NULL, DEVCB_NULL, @@ -855,28 +855,6 @@ static Z80DART_INTERFACE( abc806_dart_intf ) }; -//------------------------------------------------- -// ABC800_KEYBOARD_INTERFACE( abc800_kb_intf ) -//------------------------------------------------- - -static ABC800_KEYBOARD_INTERFACE( abc800_kb_intf ) -{ - DEVCB_DEVICE_LINE_MEMBER(Z80DART_TAG, z80dart_device, rxtxcb_w), - DEVCB_DEVICE_LINE_MEMBER(Z80DART_TAG, z80dart_device, dcdb_w) -}; - - -//------------------------------------------------- -// ABC77_INTERFACE( kb_intf ) -//------------------------------------------------- - -static ABC77_INTERFACE( kb_intf ) -{ - DEVCB_DEVICE_LINE_MEMBER(Z80DART_TAG, z80dart_device, rxtxcb_w), - DEVCB_DEVICE_LINE_MEMBER(Z80DART_TAG, z80dart_device, dcdb_w) -}; - - //------------------------------------------------- // z80_daisy_config abc800_daisy_chain //------------------------------------------------- @@ -1211,7 +1189,7 @@ static MACHINE_CONFIG_START( abc800c, abc800c_state ) MCFG_CASSETTE_ADD("cassette", cass_intf) MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232a_intf, default_rs232_devices, NULL) MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232b_intf, default_rs232_devices, NULL) - MCFG_ABC800_KEYBOARD_ADD(abc800_kb_intf) + MCFG_ABC_KEYBOARD_PORT_ADD("abc800", DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w), DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) // ABC bus MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_intf, abcbus_cards, "fast") @@ -1254,7 +1232,7 @@ static MACHINE_CONFIG_START( abc800m, abc800m_state ) MCFG_CASSETTE_ADD("cassette", cass_intf) MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232a_intf, default_rs232_devices, NULL) MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232b_intf, default_rs232_devices, NULL) - MCFG_ABC800_KEYBOARD_ADD(abc800_kb_intf) + MCFG_ABC_KEYBOARD_PORT_ADD("abc800", DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w), DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) // ABC bus MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_intf, abcbus_cards, "fast") @@ -1297,7 +1275,7 @@ static MACHINE_CONFIG_START( abc802, abc802_state ) MCFG_CASSETTE_ADD("cassette", cass_intf) MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232a_intf, default_rs232_devices, NULL) MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232b_intf, default_rs232_devices, NULL) - MCFG_ABC55_ADD(kb_intf) + MCFG_ABC_KEYBOARD_PORT_ADD("abc55", DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w), DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) // ABC bus MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_intf, abcbus_cards, "fast") @@ -1330,7 +1308,7 @@ static MACHINE_CONFIG_START( abc806, abc806_state ) MCFG_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc806_dart_intf) MCFG_RS232_PORT_ADD(RS232_A_TAG, rs232a_intf, default_rs232_devices, NULL) MCFG_RS232_PORT_ADD(RS232_B_TAG, rs232b_intf, default_rs232_devices, NULL) - MCFG_ABC77_ADD(kb_intf) + MCFG_ABC_KEYBOARD_PORT_ADD("abc77", DEVWRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w), DEVWRITELINE(Z80DART_TAG, z80dart_device, dcdb_w)) // ABC bus MCFG_ABCBUS_SLOT_ADD(ABCBUS_TAG, abcbus_intf, abcbus_cards, "fast") @@ -1338,8 +1316,8 @@ static MACHINE_CONFIG_START( abc806, abc806_state ) // internal ram MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("160K") // 32KB + 128KB - MCFG_RAM_EXTRA_OPTIONS("544K") // 32KB + 512KB + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("512K") // software list MCFG_SOFTWARE_LIST_ADD("flop_list", "abc806") diff --git a/src/mess/includes/abc1600.h b/src/mess/includes/abc1600.h index 15560bdbf37..77aa70b4fa4 100644 --- a/src/mess/includes/abc1600.h +++ b/src/mess/includes/abc1600.h @@ -5,13 +5,13 @@ #include "emu.h" #include "cpu/m68000/m68000.h" -#include "machine/ram.h" #include "machine/8530scc.h" -#include "machine/abc99.h" +#include "machine/abckb.h" #include "machine/abc1600_bus.h" #include "machine/e0516.h" #include "machine/lux4105.h" #include "machine/nmc9306.h" +#include "machine/ram.h" #include "machine/serial.h" #include "machine/wd_fdc.h" #include "machine/z80dart.h" @@ -42,8 +42,8 @@ #define BUS0X_TAG "bus0x" #define BUS1_TAG "bus1" #define BUS2_TAG "bus2" -#define RS232_A_TAG "rs232a" -#define RS232_B_TAG "rs232b" +#define RS232_A_TAG "rs232a" +#define RS232_B_TAG "rs232b" diff --git a/src/mess/includes/abc80x.h b/src/mess/includes/abc80x.h index 3bb80e3b741..3838ca113c7 100644 --- a/src/mess/includes/abc80x.h +++ b/src/mess/includes/abc80x.h @@ -11,7 +11,7 @@ #include "cpu/z80/z80daisy.h" #include "cpu/mcs48/mcs48.h" #include "imagedev/cassette.h" -#include "machine/abc77.h" +#include "machine/abckb.h" #include "machine/abc800kb.h" #include "machine/abc830.h" #include "machine/abcbus.h" @@ -219,13 +219,11 @@ public: abc802_state(const machine_config &mconfig, device_type type, const char *tag) : abc800_state(mconfig, type, tag), m_crtc(*this, MC6845_TAG), - m_abc77(*this, ABC77_TAG), m_char_rom(*this, MC6845_TAG), m_config(*this, "CONFIG") { } required_device m_crtc; - optional_device m_abc77; required_memory_region m_char_rom; required_ioport m_config; @@ -263,7 +261,6 @@ public: : abc800_state(mconfig, type, tag), m_crtc(*this, MC6845_TAG), m_rtc(*this, E0516_TAG), - m_abc77(*this, ABC77_TAG), m_rad_prom(*this, "rad"), m_hru2_prom(*this, "hru"), m_char_rom(*this, MC6845_TAG) @@ -271,7 +268,6 @@ public: required_device m_crtc; required_device m_rtc; - optional_device m_abc77; required_memory_region m_rad_prom; required_memory_region m_hru2_prom; required_memory_region m_char_rom; diff --git a/src/mess/machine/abc77.c b/src/mess/machine/abc77.c index 529f1f81a97..8def6743f7e 100644 --- a/src/mess/machine/abc77.c +++ b/src/mess/machine/abc77.c @@ -63,28 +63,6 @@ const device_type ABC77 = &device_creator; const device_type ABC55 = &device_creator; -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void abc77_device::device_config_complete() -{ - // inherit a copy of the static data - const abc77_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { - memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb)); - memset(&m_out_keydown_cb, 0, sizeof(m_out_keydown_cb)); - } -} - - //------------------------------------------------- // ROM( abc77 ) //------------------------------------------------- @@ -415,7 +393,7 @@ inline void abc77_device::serial_clock() { m_clock = !m_clock; - m_out_clock_func(!m_clock); + m_slot->trxc_w(!m_clock); } @@ -427,7 +405,7 @@ inline void abc77_device::key_down(int state) { if (m_keydown != state) { - m_out_keydown_func(state); + m_slot->keydown_w(state); m_keydown = state; } } @@ -444,6 +422,7 @@ inline void abc77_device::key_down(int state) abc77_device::abc77_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ABC77, "Luxor ABC 77", tag, owner, clock, "abc77", __FILE__), + abc_keyboard_interface(mconfig, *this), m_maincpu(*this, I8035_TAG), m_discrete(*this, DISCRETE_TAG), m_x0(*this, "X0"), @@ -468,6 +447,7 @@ abc77_device::abc77_device(const machine_config &mconfig, const char *tag, devic abc77_device::abc77_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + abc_keyboard_interface(mconfig, *this), m_maincpu(*this, I8035_TAG), m_discrete(*this, DISCRETE_TAG), m_x0(*this, "X0"), @@ -505,10 +485,6 @@ void abc77_device::device_start() m_serial_timer->adjust(attotime::from_hz(19200), 0, attotime::from_hz(19200)); // ALE/32 m_reset_timer = timer_alloc(TIMER_RESET); - - // resolve callbacks - m_out_clock_func.resolve(m_out_clock_cb, *this); - m_out_keydown_func.resolve(m_out_keydown_cb, *this); } @@ -548,6 +524,26 @@ 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 - +//------------------------------------------------- + +void abc77_device::txd_w(int state) +{ + m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); +} + + //------------------------------------------------- // p1_r - //------------------------------------------------- @@ -667,38 +663,3 @@ WRITE8_MEMBER( abc77_device::j3_w ) { m_j3 = data; } - - -//------------------------------------------------- -// rxd_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc77_device::rxd_w ) -{ - m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); -} - - -//------------------------------------------------- -// txd_r - -//------------------------------------------------- - -READ_LINE_MEMBER( abc77_device::txd_r ) -{ - return m_txd; -} - - -//------------------------------------------------- -// reset_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc77_device::reset_w ) -{ - if (m_reset && !state) - { - device_reset(); - } - - m_reset = state; -} diff --git a/src/mess/machine/abc77.h b/src/mess/machine/abc77.h index 83856a19c10..48d417792d6 100644 --- a/src/mess/machine/abc77.h +++ b/src/mess/machine/abc77.h @@ -12,58 +12,22 @@ #ifndef __ABC77__ #define __ABC77__ - #include "emu.h" #include "cpu/mcs48/mcs48.h" +#include "machine/abckb.h" #include "sound/discrete.h" #include "sound/speaker.h" -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define ABC77_TAG "abc77" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_ABC55_ADD(_config) \ - MCFG_DEVICE_ADD(ABC77_TAG, ABC55, 0) \ - MCFG_DEVICE_CONFIG(_config) - - -#define MCFG_ABC77_ADD(_config) \ - MCFG_DEVICE_ADD(ABC77_TAG, ABC77, 0) \ - MCFG_DEVICE_CONFIG(_config) - - -#define ABC77_INTERFACE(_name) \ - const abc77_interface (_name) = - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -// ======================> abc77_interface - -struct abc77_interface -{ - devcb_write_line m_out_clock_cb; - devcb_write_line m_out_keydown_cb; -}; - - // ======================> abc77_device class abc77_device : public device_t, - public abc77_interface + public abc_keyboard_interface { public: // construction/destruction @@ -75,6 +39,10 @@ public: virtual machine_config_constructor device_mconfig_additions() const; 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 ); DECLARE_READ8_MEMBER( p1_r ); @@ -83,19 +51,17 @@ public: DECLARE_WRITE8_MEMBER( prog_w ); DECLARE_WRITE8_MEMBER( j3_w ); - DECLARE_WRITE_LINE_MEMBER( rxd_w ); - DECLARE_READ_LINE_MEMBER( txd_r ); - DECLARE_WRITE_LINE_MEMBER( reset_w ); - protected: // device-level overrides virtual void device_start(); virtual void device_reset(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void device_config_complete(); - static const device_timer_id TIMER_SERIAL = 0; - static const device_timer_id TIMER_RESET = 1; + enum + { + TIMER_SERIAL, + TIMER_RESET + }; inline void serial_output(int state); inline void serial_clock(); diff --git a/src/mess/machine/abc800kb.c b/src/mess/machine/abc800kb.c index 9b4145e5c9f..d3bce22234b 100644 --- a/src/mess/machine/abc800kb.c +++ b/src/mess/machine/abc800kb.c @@ -88,28 +88,6 @@ XR22-050-3B Pinout const device_type ABC800_KEYBOARD = &device_creator; -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void abc800_keyboard_device::device_config_complete() -{ - // inherit a copy of the static data - const abc800_keyboard_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { - memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb)); - memset(&m_out_keydown_cb, 0, sizeof(m_out_keydown_cb)); - } -} - - //------------------------------------------------- // ROM( abc800_keyboard ) //------------------------------------------------- @@ -325,7 +303,7 @@ inline void abc800_keyboard_device::serial_clock() { m_clk = !m_clk; - m_out_clock_func(!m_clk); + m_slot->trxc_w(!m_clk); } @@ -339,7 +317,7 @@ inline void abc800_keyboard_device::key_down(int state) { m_keydown = state; - m_out_keydown_func(state); + m_slot->keydown_w(state); } } @@ -355,6 +333,7 @@ inline void abc800_keyboard_device::key_down(int state) abc800_keyboard_device::abc800_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ABC800_KEYBOARD, "ABC-800 Keyboard", tag, owner, clock, "abc800kb", __FILE__), + abc_keyboard_interface(mconfig, *this), m_maincpu(*this, I8048_TAG), m_x0(*this, "X0"), m_x1(*this, "X1"), @@ -387,10 +366,6 @@ void abc800_keyboard_device::device_start() m_serial_timer = timer_alloc(); m_serial_timer->adjust(attotime::from_hz(XTAL_5_9904MHz/(3*5)/20), 0, attotime::from_hz(XTAL_5_9904MHz/(3*5)/20)); // ??? - // resolve callbacks - m_out_clock_func.resolve(m_out_clock_cb, *this); - m_out_keydown_func.resolve(m_out_keydown_cb, *this); - // state saving save_item(NAME(m_row)); save_item(NAME(m_clk)); @@ -420,22 +395,22 @@ void abc800_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, //------------------------------------------------- -// rxd_w - keyboard receive data write +// rxd_r - //------------------------------------------------- -WRITE_LINE_MEMBER( abc800_keyboard_device::rxd_w ) +int abc800_keyboard_device::rxd_r() { - m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); + return m_txd; } //------------------------------------------------- -// txd_r - keyboard transmit data read +// txd_w - //------------------------------------------------- -READ_LINE_MEMBER( abc800_keyboard_device::txd_r ) +void abc800_keyboard_device::txd_w(int state) { - return m_txd; + m_maincpu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); } diff --git a/src/mess/machine/abc800kb.h b/src/mess/machine/abc800kb.h index 2caa2e55003..01824cb9a63 100644 --- a/src/mess/machine/abc800kb.h +++ b/src/mess/machine/abc800kb.h @@ -15,49 +15,19 @@ #include "emu.h" #include "cpu/mcs48/mcs48.h" +#include "machine/abckb.h" #include "sound/discrete.h" -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define ABC800_KEYBOARD_TAG "abc800kb" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_ABC800_KEYBOARD_ADD(_config) \ - MCFG_DEVICE_ADD(ABC800_KEYBOARD_TAG, ABC800_KEYBOARD, 0) \ - MCFG_DEVICE_CONFIG(_config) - - -#define ABC800_KEYBOARD_INTERFACE(_name) \ - const abc800_keyboard_interface (_name) = - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -// ======================> abc800_keyboard_interface - -struct abc800_keyboard_interface -{ - devcb_write_line m_out_clock_cb; - devcb_write_line m_out_keydown_cb; -}; - - // ======================> abc800_keyboard_device class abc800_keyboard_device : public device_t, - public abc800_keyboard_interface + public abc_keyboard_interface { public: // construction/destruction @@ -68,8 +38,9 @@ public: virtual machine_config_constructor device_mconfig_additions() const; virtual ioport_constructor device_input_ports() const; - DECLARE_WRITE_LINE_MEMBER( rxd_w ); - DECLARE_READ_LINE_MEMBER( txd_r ); + // abc_keyboard_interface overrides + virtual int rxd_r(); + virtual void txd_w(int state); // not really public DECLARE_READ8_MEMBER( kb_p1_r ); @@ -79,7 +50,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); diff --git a/src/mess/machine/abc80kb.c b/src/mess/machine/abc80kb.c index 0e403d14281..323f5d24c37 100644 --- a/src/mess/machine/abc80kb.c +++ b/src/mess/machine/abc80kb.c @@ -91,27 +91,6 @@ Notes: const device_type ABC80_KEYBOARD = &device_creator; -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void abc80_keyboard_device::device_config_complete() -{ - // inherit a copy of the static data - const abc80_keyboard_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { - memset(&m_out_keydown_cb, 0, sizeof(m_out_keydown_cb)); - } -} - - //------------------------------------------------- // ROM( abc80_keyboard ) //------------------------------------------------- @@ -191,6 +170,7 @@ ioport_constructor abc80_keyboard_device::device_input_ports() const abc80_keyboard_device::abc80_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ABC80_KEYBOARD, "ABC-80 Keyboard", tag, owner, clock, "abc80kb", __FILE__), + m_write_keydown(*this), m_maincpu(*this, I8048_TAG) { } @@ -203,7 +183,7 @@ abc80_keyboard_device::abc80_keyboard_device(const machine_config &mconfig, cons void abc80_keyboard_device::device_start() { // resolve callbacks - m_out_keydown_func.resolve(m_out_keydown_cb, *this); + m_write_keydown.resolve_safe(); } diff --git a/src/mess/machine/abc80kb.h b/src/mess/machine/abc80kb.h index 6178efdca4a..e14f2a45cf3 100644 --- a/src/mess/machine/abc80kb.h +++ b/src/mess/machine/abc80kb.h @@ -12,7 +12,6 @@ #ifndef __ABC80_KEYBOARD__ #define __ABC80_KEYBOARD__ - #include "emu.h" #include "cpu/mcs48/mcs48.h" @@ -30,13 +29,9 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_ABC80_KEYBOARD_ADD(_config) \ +#define MCFG_ABC80_KEYBOARD_ADD(_keydown) \ MCFG_DEVICE_ADD(ABC80_KEYBOARD_TAG, ABC80_KEYBOARD, 0) \ - MCFG_DEVICE_CONFIG(_config) - - -#define ABC80_KEYBOARD_INTERFACE(_name) \ - const abc80_keyboard_interface (_name) = + downcast(device)->set_callback(DEVCB2_##_keydown); @@ -44,23 +39,16 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> abc80_keyboard_interface - -struct abc80_keyboard_interface -{ - devcb_write_line m_out_keydown_cb; -}; - - // ======================> abc80_keyboard_device -class abc80_keyboard_device : public device_t, - public abc80_keyboard_interface +class abc80_keyboard_device : public device_t { public: // construction/destruction abc80_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + template void set_callback(_keydown keydown) { m_write_keydown.set_callback(keydown); } + // optional information overrides virtual const rom_entry *device_rom_region() const; virtual machine_config_constructor device_mconfig_additions() const; @@ -70,12 +58,11 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); private: - devcb_resolved_write_line m_out_keydown_func; + devcb2_write_line m_write_keydown; required_device m_maincpu; }; diff --git a/src/mess/machine/abc99.c b/src/mess/machine/abc99.c index e92904213b9..04957e89c7f 100644 --- a/src/mess/machine/abc99.c +++ b/src/mess/machine/abc99.c @@ -74,28 +74,6 @@ Notes: const device_type ABC99 = &device_creator; -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void abc99_device::device_config_complete() -{ - // inherit a copy of the static data - const abc99_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { - memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb)); - memset(&m_out_keydown_cb, 0, sizeof(m_out_keydown_cb)); - } -} - - //------------------------------------------------- // ROM( abc99 ) //------------------------------------------------- @@ -456,8 +434,8 @@ inline void abc99_device::serial_input() inline void abc99_device::serial_clock() { - m_out_clock_func(1); - m_out_clock_func(0); + m_slot->trxc_w(1); + m_slot->trxc_w(0); } @@ -469,7 +447,7 @@ inline void abc99_device::key_down(int state) { if (m_keydown != state) { - m_out_keydown_func(state); + m_slot->keydown_w(state); m_keydown = state; } } @@ -495,6 +473,7 @@ inline void abc99_device::scan_mouse() abc99_device::abc99_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ABC99, "Luxor ABC 99", tag, owner, clock, "abc99", __FILE__), + abc_keyboard_interface(mconfig, *this), m_maincpu(*this, I8035_Z2_TAG), m_mousecpu(*this, I8035_Z5_TAG), m_speaker(*this, "speaker"), @@ -525,10 +504,6 @@ void abc99_device::device_start() m_mouse_timer = timer_alloc(TIMER_MOUSE); - // resolve callbacks - m_out_clock_func.resolve(m_out_clock_cb, *this); - m_out_keydown_func.resolve(m_out_keydown_cb, *this); - // state saving save_item(NAME(m_si)); save_item(NAME(m_si_en)); @@ -573,6 +548,30 @@ 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 - +//------------------------------------------------- + +void abc99_device::txd_w(int state) +{ + if (m_si != state) + { + m_si = state; + serial_input(); + } +} + + //------------------------------------------------- // z2_bus_w - //------------------------------------------------- @@ -771,27 +770,3 @@ READ8_MEMBER( abc99_device::z5_t1_r ) { return m_t1_z5; } - - -//------------------------------------------------- -// rxd_w - -//------------------------------------------------- - -WRITE_LINE_MEMBER( abc99_device::rxd_w ) -{ - if (m_si != state) - { - m_si = state; - serial_input(); - } -} - - -//------------------------------------------------- -// txd_r - -//------------------------------------------------- - -READ_LINE_MEMBER( abc99_device::txd_r ) -{ - return m_so_z2 && m_so_z5; -} diff --git a/src/mess/machine/abc99.h b/src/mess/machine/abc99.h index 1a25d118db1..75ae283c292 100644 --- a/src/mess/machine/abc99.h +++ b/src/mess/machine/abc99.h @@ -14,48 +14,19 @@ #include "emu.h" #include "cpu/mcs48/mcs48.h" +#include "machine/abckb.h" #include "sound/speaker.h" -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define ABC99_TAG "abc99" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_ABC99_ADD(_config) \ - MCFG_DEVICE_ADD(ABC99_TAG, ABC99, 0) \ - MCFG_DEVICE_CONFIG(_config) - - -#define ABC99_INTERFACE(_name) \ - const abc99_interface (_name) = - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -// ======================> abc99_interface - -struct abc99_interface -{ - devcb_write_line m_out_clock_cb; - devcb_write_line m_out_keydown_cb; -}; - // ======================> abc99_device class abc99_device : public device_t, - public abc99_interface + public abc_keyboard_interface { public: // construction/destruction @@ -66,6 +37,10 @@ public: virtual machine_config_constructor device_mconfig_additions() const; 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 ); DECLARE_WRITE8_MEMBER( z2_led_w ); @@ -77,15 +52,11 @@ public: DECLARE_WRITE8_MEMBER( z5_p2_w ); DECLARE_READ8_MEMBER( z5_t1_r ); - DECLARE_WRITE_LINE_MEMBER( rxd_w ); - DECLARE_READ_LINE_MEMBER( txd_r ); - protected: // device-level overrides virtual void device_start(); virtual void device_reset(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - virtual void device_config_complete(); private: enum diff --git a/src/mess/machine/abckb.c b/src/mess/machine/abckb.c new file mode 100644 index 00000000000..f5145bd2c5e --- /dev/null +++ b/src/mess/machine/abckb.c @@ -0,0 +1,140 @@ +/********************************************************************** + + Luxor ABC 800/802/806/1600 keyboard port emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "abckb.h" + +// supported devices +#include "machine/abc800kb.h" +#include "machine/abc77.h" +#include "machine/abc99.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +// device type definition +const device_type ABC_KEYBOARD_PORT = &device_creator; + + + +//************************************************************************** +// CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// abc_keyboard_interface - constructor +//------------------------------------------------- + +abc_keyboard_interface::abc_keyboard_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig,device) +{ + m_slot = dynamic_cast(device.owner()); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// abc_keyboard_port_device - constructor +//------------------------------------------------- + +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), + device_slot_interface(mconfig, *this), + m_write_trxc(*this), + m_write_keydown(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void abc_keyboard_port_device::device_start() +{ + m_card = dynamic_cast(get_card_device()); + + // resolve callbacks + m_write_trxc.resolve_safe(); + m_write_keydown.resolve_safe(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void abc_keyboard_port_device::device_reset() +{ + if (m_card != NULL) + get_card_device()->reset(); +} + + +//------------------------------------------------- +// rxd_r - +//------------------------------------------------- + +READ_LINE_MEMBER( abc_keyboard_port_device::rxd_r ) +{ + int state = 1; + + if (m_card != NULL) + state = m_card->rxd_r(); + + return state; +} + + +//------------------------------------------------- +// txd_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc_keyboard_port_device::txd_w ) +{ + if (m_card != NULL) + m_card->txd_w(state); +} + + +//------------------------------------------------- +// trxc_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc_keyboard_port_device::trxc_w ) +{ + m_write_trxc(state); +} + + +//------------------------------------------------- +// keydown_w - +//------------------------------------------------- + +WRITE_LINE_MEMBER( abc_keyboard_port_device::keydown_w ) +{ + m_write_keydown(state); +} + + + +//************************************************************************** +// SLOT INTERFACE +//************************************************************************** + +SLOT_INTERFACE_START( abc_keyboard_devices ) + SLOT_INTERFACE("abc800", ABC800_KEYBOARD) + SLOT_INTERFACE("abc55", ABC55) + SLOT_INTERFACE("abc77", ABC77) + SLOT_INTERFACE("abc99", ABC99) +SLOT_INTERFACE_END diff --git a/src/mess/machine/abckb.h b/src/mess/machine/abckb.h new file mode 100644 index 00000000000..a231d461aa5 --- /dev/null +++ b/src/mess/machine/abckb.h @@ -0,0 +1,99 @@ +/********************************************************************** + + Luxor ABC 800/802/806/1600 keyboard port emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef __ABC_KEYBOARD_PORT__ +#define __ABC_KEYBOARD_PORT__ + +#include "emu.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define ABC_KEYBOARD_PORT_TAG "kb" + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#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(device)->set_callbacks(DEVCB2_##_trxc, DEVCB2_##_keydown); + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class abc_keyboard_interface; + +class abc_keyboard_port_device : public device_t, + public device_slot_interface +{ +public: + // construction/destruction + abc_keyboard_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + template void set_callbacks(_trxc trxc, _keydown keydown) { + m_write_trxc.set_callback(trxc); + m_write_keydown.set_callback(keydown); + } + + // computer interface + DECLARE_READ_LINE_MEMBER( rxd_r ); + DECLARE_WRITE_LINE_MEMBER( txd_w ); + + // peripheral interface + DECLARE_WRITE_LINE_MEMBER( trxc_w ); + DECLARE_WRITE_LINE_MEMBER( keydown_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + devcb2_write_line m_write_trxc; + devcb2_write_line m_write_keydown; + + abc_keyboard_interface *m_card; +}; + + +class abc_keyboard_interface : public device_slot_card_interface +{ +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: + abc_keyboard_port_device *m_slot; +}; + + +// device type definition +extern const device_type ABC_KEYBOARD_PORT; + + +// supported devices +SLOT_INTERFACE_EXTERN( abc_keyboard_devices ); + + + +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 48848392db2..146e3f7e167 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1293,6 +1293,7 @@ $(MESSOBJ)/luxor.a: \ $(MESS_MACHINE)/abc_slutprov.o \ $(MESS_MACHINE)/abc_turbo.o \ $(MESS_MACHINE)/abc_xebec.o \ + $(MESS_MACHINE)/abckb.o \ $(MESS_MACHINE)/abc77.o \ $(MESS_MACHINE)/abc99.o \ $(MESS_MACHINE)/lux10828.o \