mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
Converted crt9021_device to devcb2 (nw)
This commit is contained in:
parent
ab67a58579
commit
f30a79508c
@ -85,34 +85,14 @@ enum
|
||||
|
||||
crt9021_device::crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, CRT9021, "SMC CRT9021", tag, owner, clock, "crt9021", __FILE__),
|
||||
device_video_interface(mconfig, *this)
|
||||
device_video_interface(mconfig, *this),
|
||||
m_in_data_cb(*this),
|
||||
m_in_attr_cb(*this),
|
||||
m_in_atten_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void crt9021_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const crt9021_interface *intf = reinterpret_cast<const crt9021_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<crt9021_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&in_data_cb, 0, sizeof(in_data_cb));
|
||||
memset(&in_attr_cb, 0, sizeof(in_attr_cb));
|
||||
memset(&in_atten_cb, 0, sizeof(in_atten_cb));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -122,9 +102,9 @@ void crt9021_device::device_start()
|
||||
// allocate timers
|
||||
|
||||
// resolve callbacks
|
||||
m_in_data_func.resolve(in_data_cb, *this);
|
||||
m_in_attr_func.resolve(in_attr_cb, *this);
|
||||
m_in_atten_func.resolve(in_atten_cb, *this);
|
||||
m_in_data_cb.resolve_safe(0);
|
||||
m_in_attr_cb.resolve_safe(0);
|
||||
m_in_atten_cb.resolve_safe(0);
|
||||
|
||||
// register for state saving
|
||||
save_item(NAME(m_slg));
|
||||
|
@ -46,42 +46,31 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_CRT9021_ADD(_tag, _clock, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, CRT9021, _clock) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
|
||||
#define CRT9021_INTERFACE(name) \
|
||||
const crt9021_interface (name) =
|
||||
#define MCFG_CRT9021_IN_DATA_CB(_devcb) \
|
||||
devcb = &crt9021_device::set_in_data_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_CRT9021_IN_ATTR_CB(_devcb) \
|
||||
devcb = &crt9021_device::set_in_attr_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_CRT9021_IN_ATTEN_CB(_devcb) \
|
||||
devcb = &crt9021_device::set_in_atten_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
|
||||
// ======================> crt9021_interface
|
||||
|
||||
struct crt9021_interface
|
||||
{
|
||||
devcb_read8 in_data_cb;
|
||||
devcb_read8 in_attr_cb;
|
||||
|
||||
devcb_read_line in_atten_cb;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ======================> crt9021_device
|
||||
|
||||
class crt9021_device : public device_t,
|
||||
public device_video_interface,
|
||||
public crt9021_interface
|
||||
public device_video_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
template<class _Object> static devcb2_base &set_in_data_callback(device_t &device, _Object object) { return downcast<crt9021_device &>(device).m_in_data_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_in_attr_callback(device_t &device, _Object object) { return downcast<crt9021_device &>(device).m_in_attr_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_in_atten_callback(device_t &device, _Object object) { return downcast<crt9021_device &>(device).m_in_atten_cb.set_callback(object); }
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( slg_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( sld_w );
|
||||
@ -93,15 +82,15 @@ public:
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_clock_changed();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
private:
|
||||
devcb_resolved_read8 m_in_data_func;
|
||||
devcb_resolved_read8 m_in_attr_func;
|
||||
devcb_resolved_read_line m_in_atten_func;
|
||||
devcb2_read8 m_in_data_cb;
|
||||
devcb2_read8 m_in_attr_cb;
|
||||
|
||||
devcb2_read_line m_in_atten_cb;
|
||||
|
||||
int m_slg;
|
||||
int m_sld;
|
||||
|
@ -368,13 +368,6 @@ static CRT9007_INTERFACE( vpac_intf )
|
||||
DEVCB_DEVICE_LINE_MEMBER(CRT9021B_TAG, crt9021_device, sld_w) // SLD
|
||||
};
|
||||
|
||||
static CRT9021_INTERFACE( vac_intf )
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER(CRT9212_0_TAG, crt9212_device, read), // data
|
||||
DEVCB_DEVICE_MEMBER(CRT9212_1_TAG, crt9212_device, read), // attributes
|
||||
DEVCB_LINE_VCC // ATTEN
|
||||
};
|
||||
|
||||
// Intel 8251A Interface
|
||||
|
||||
WRITE_LINE_MEMBER( tandy2k_state::rxrdy_w )
|
||||
@ -653,7 +646,10 @@ static MACHINE_CONFIG_START( tandy2k, tandy2k_state )
|
||||
MCFG_CRT9212_IN_REN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, vlt_r)) // REN
|
||||
MCFG_CRT9212_IN_WEN_CB(DEVREADLINE(CRT9007_TAG, crt9007_device, wben_r)) // WEN
|
||||
MCFG_CRT9212_IN_WEN2_CB(VCC) // WEN2
|
||||
MCFG_CRT9021_ADD(CRT9021B_TAG, XTAL_16MHz*28/16/8, vac_intf)
|
||||
MCFG_DEVICE_ADD(CRT9021B_TAG, CRT9021, XTAL_16MHz*28/16/8)
|
||||
MCFG_CRT9021_IN_DATA_CB(DEVREAD8(CRT9212_0_TAG, crt9212_device, read)) // data
|
||||
MCFG_CRT9021_IN_ATTR_CB(DEVREAD8(CRT9212_1_TAG, crt9212_device, read)) // attributes
|
||||
MCFG_CRT9021_IN_ATTEN_CB(VCC)
|
||||
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
|
||||
|
||||
// sound hardware
|
||||
|
Loading…
Reference in New Issue
Block a user