(MESS) apricotkb: devcb2. (nw)

This commit is contained in:
Curt Coder 2014-03-19 11:08:10 +00:00
parent f27a84da26
commit a6e0fb4251
4 changed files with 31 additions and 75 deletions

View File

@ -213,16 +213,6 @@ INPUT_PORTS_END
// DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// APRICOT_KEYBOARD_INTERFACE( kb_intf )
//-------------------------------------------------
static APRICOT_KEYBOARD_INTERFACE( kb_intf )
{
DEVCB_NULL
};
//-------------------------------------------------
// Z80SIO_INTERFACE( sio_intf )
//-------------------------------------------------
@ -327,7 +317,7 @@ static MACHINE_CONFIG_START( act_f1, f1_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", act_f1)
/* Devices */
MCFG_APRICOT_KEYBOARD_ADD(kb_intf)
MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0)
MCFG_Z80SIO2_ADD(Z80SIO2_TAG, 2500000, sio_intf)
MCFG_Z80CTC_ADD(Z80CTC_TAG, 2500000, ctc_intf)

View File

@ -404,16 +404,6 @@ INPUT_PORTS_END
// DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// APRICOT_KEYBOARD_INTERFACE( kb_intf )
//-------------------------------------------------
static APRICOT_KEYBOARD_INTERFACE( kb_intf )
{
DEVCB_NULL
};
//-------------------------------------------------
// pic8259_interface pic_intf
//-------------------------------------------------
@ -598,7 +588,7 @@ static MACHINE_CONFIG_START( fp, fp_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
/* Devices */
MCFG_APRICOT_KEYBOARD_ADD(kb_intf)
MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0)
MCFG_I8237_ADD(I8237_TAG, 250000, dmac_intf)
MCFG_PIC8259_ADD(I8259A_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL)

View File

@ -26,27 +26,6 @@
const device_type APRICOT_KEYBOARD = &device_creator<apricot_keyboard_device>;
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void apricot_keyboard_device::device_config_complete()
{
// inherit a copy of the static data
const apricot_keyboard_interface *intf = reinterpret_cast<const apricot_keyboard_interface *>(static_config());
if (intf != NULL)
*static_cast<apricot_keyboard_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
memset(&m_out_txd_cb, 0, sizeof(m_out_txd_cb));
}
}
//-------------------------------------------------
// ROM( apricot_keyboard )
//-------------------------------------------------
@ -70,7 +49,8 @@ const rom_entry *apricot_keyboard_device::device_rom_region() const
//-------------------------------------------------
// ADDRESS_MAP( kb_io )
//-------------------------------------------------
/*
#ifdef UPD7507_EMULATED
static ADDRESS_MAP_START( apricot_keyboard_io, AS_IO, 8, apricot_keyboard_device )
AM_RANGE(0x00, 0x00) AM_READ(kb_lo_r)
AM_RANGE(0x01, 0x01) AM_READ(kb_hi_r)
@ -80,7 +60,7 @@ static ADDRESS_MAP_START( apricot_keyboard_io, AS_IO, 8, apricot_keyboard_device
AM_RANGE(0x06, 0x06) AM_READWRITE(kb_p6_r, kb_yc_w)
AM_RANGE(0x07, 0x07) AM_WRITE(kb_y8_w)
ADDRESS_MAP_END
*/
#endif
//-------------------------------------------------
@ -88,10 +68,10 @@ ADDRESS_MAP_END
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( apricot_keyboard )
/*
#ifdef UPD7507_EMULATED
MCFG_CPU_ADD(UPD7507C_TAG, UPD7507, XTAL_32_768kHz)
MCFG_CPU_IO_MAP(apricot_keyboard_io)
*/
#endif
MACHINE_CONFIG_END
@ -266,22 +246,23 @@ ioport_constructor apricot_keyboard_device::device_input_ports() const
// apricot_keyboard_device - constructor
//-------------------------------------------------
apricot_keyboard_device::apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, APRICOT_KEYBOARD, "Apricot Keyboard", tag, owner, clock, "aprikb", __FILE__),
m_y0(*this, "Y0"),
m_y1(*this, "Y1"),
m_y2(*this, "Y2"),
m_y3(*this, "Y3"),
m_y4(*this, "Y4"),
m_y5(*this, "Y5"),
m_y6(*this, "Y6"),
m_y7(*this, "Y7"),
m_y8(*this, "Y8"),
m_y9(*this, "Y9"),
m_ya(*this, "YA"),
m_yb(*this, "YB"),
m_yc(*this, "YC"),
m_modifiers(*this, "MODIFIERS")
apricot_keyboard_device::apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, APRICOT_KEYBOARD, "Apricot Keyboard", tag, owner, clock, "aprikb", __FILE__),
m_write_txd(*this),
m_y0(*this, "Y0"),
m_y1(*this, "Y1"),
m_y2(*this, "Y2"),
m_y3(*this, "Y3"),
m_y4(*this, "Y4"),
m_y5(*this, "Y5"),
m_y6(*this, "Y6"),
m_y7(*this, "Y7"),
m_y8(*this, "Y8"),
m_y9(*this, "Y9"),
m_ya(*this, "YA"),
m_yb(*this, "YB"),
m_yc(*this, "YC"),
m_modifiers(*this, "MODIFIERS")
{
}
@ -293,7 +274,7 @@ apricot_keyboard_device::apricot_keyboard_device(const machine_config &mconfig,
void apricot_keyboard_device::device_start()
{
// resolve callbacks
m_out_txd_func.resolve(m_out_txd_cb, *this);
m_write_txd.resolve_safe();
}

View File

@ -12,7 +12,6 @@
#ifndef __APRICOT_KEYBOARD__
#define __APRICOT_KEYBOARD__
#include "emu.h"
@ -29,13 +28,8 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_APRICOT_KEYBOARD_ADD(_config) \
MCFG_DEVICE_ADD(APRICOT_KEYBOARD_TAG, APRICOT_KEYBOARD, 0) \
MCFG_DEVICE_CONFIG(_config)
#define APRICOT_KEYBOARD_INTERFACE(_name) \
const apricot_keyboard_interface (_name) =
#define MCFG_APRICOT_KEYBOARD_TXD_CALLBACK(_write) \
devcb = &apricot_keyboard_device::set_tcd_wr_callback(*device, DEVCB2_##_write);
@ -54,12 +48,14 @@ struct apricot_keyboard_interface
// ======================> apricot_keyboard_device
class apricot_keyboard_device : public device_t,
public apricot_keyboard_interface
public apricot_keyboard_interface
{
public:
// construction/destruction
apricot_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
template<class _Object> static devcb2_base &set_txd_wr_callback(device_t &device, _Object object) { return downcast<apricot_keyboard_device &>(device).m_write_txd.set_callback(object); }
// optional information overrides
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
@ -80,10 +76,9 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void device_config_complete();
private:
devcb_resolved_write_line m_out_txd_func;
devcb2_write_line m_write_txd;
required_ioport m_y0;
required_ioport m_y1;