mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Converted dl1416_device to devcb2 (nw)
This commit is contained in:
parent
fad0b00cba
commit
bdbd5b0798
@ -100,7 +100,8 @@ dl1416_device::dl1416_device(const machine_config &mconfig, device_type type, co
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
|
||||
m_write_enable(FALSE),
|
||||
m_chip_enable(FALSE),
|
||||
m_cursor_enable(FALSE)
|
||||
m_cursor_enable(FALSE),
|
||||
m_update(*this)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@ -109,26 +110,6 @@ dl1416_device::dl1416_device(const machine_config &mconfig, device_type type, co
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void dl1416_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const dl1416_interface *intf = reinterpret_cast<const dl1416_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<dl1416_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_update, 0, sizeof(m_update));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -141,7 +122,7 @@ void dl1416_device::device_start()
|
||||
save_item(NAME(m_write_enable));
|
||||
save_item(NAME(m_digit_ram));
|
||||
|
||||
m_update_func.resolve(m_update, *this);
|
||||
m_update.resolve();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -157,8 +138,6 @@ void dl1416_device::device_reset()
|
||||
m_write_enable = FALSE;
|
||||
m_cursor_enable = FALSE;
|
||||
|
||||
m_update_func.resolve(m_update, *this);
|
||||
|
||||
/* randomize digit and cursor memory */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@ -178,8 +157,8 @@ void dl1416_device::device_reset()
|
||||
pattern = SEG_BLANK;
|
||||
|
||||
/* Call update function */
|
||||
if (!m_update_func.isnull())
|
||||
m_update_func(i, pattern);
|
||||
if (!m_update.isnull())
|
||||
m_update((offs_t)i, pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,8 +238,8 @@ WRITE8_MEMBER( dl1416_device::data_w )
|
||||
pattern = SEG_BLANK;
|
||||
|
||||
/* Call update function */
|
||||
if (!m_update_func.isnull())
|
||||
m_update_func(offset, pattern);
|
||||
if (!m_update.isnull())
|
||||
m_update(offset, pattern, mem_mask);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -287,8 +266,8 @@ WRITE8_MEMBER( dl1416_device::data_w )
|
||||
pattern = SEG_BLANK;
|
||||
|
||||
/* Call update function */
|
||||
if (!m_update_func.isnull())
|
||||
m_update_func(i, pattern);
|
||||
if (!m_update.isnull())
|
||||
m_update(i, pattern, mem_mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,8 +290,8 @@ WRITE8_MEMBER( dl1416_device::data_w )
|
||||
pattern = SEG_BLANK;
|
||||
|
||||
/* Call update function */
|
||||
if (!m_update_func.isnull())
|
||||
m_update_func(offset, pattern);
|
||||
if (!m_update.isnull())
|
||||
m_update(offset, pattern, mem_mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,27 +16,12 @@
|
||||
#define DL1416_H_
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
struct dl1416_interface
|
||||
{
|
||||
devcb_write16 m_update;
|
||||
};
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION MACROS
|
||||
***************************************************************************/
|
||||
|
||||
#define MCFG_DL1416B_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, DL1416B, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
|
||||
#define MCFG_DL1416T_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, DL1416T, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
#define MCFG_DL1416_UPDATE_HANDLER(_devcb) \
|
||||
devcb = &dl1416_device::set_update_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -44,13 +29,14 @@ struct dl1416_interface
|
||||
***************************************************************************/
|
||||
|
||||
/* device get info callback */
|
||||
class dl1416_device : public device_t,
|
||||
public dl1416_interface
|
||||
class dl1416_device : public device_t
|
||||
{
|
||||
public:
|
||||
dl1416_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);
|
||||
~dl1416_device() {}
|
||||
|
||||
template<class _Object> static devcb2_base &set_update_handler(device_t &device, _Object object) { return downcast<dl1416_device &>(device).m_update.set_callback(object); }
|
||||
|
||||
/* inputs */
|
||||
DECLARE_WRITE_LINE_MEMBER( wr_w ); /* write enable */
|
||||
DECLARE_WRITE_LINE_MEMBER( ce_w ); /* chip enable */
|
||||
@ -59,7 +45,6 @@ public:
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
@ -68,7 +53,7 @@ private:
|
||||
int m_write_enable;
|
||||
int m_chip_enable;
|
||||
int m_cursor_enable;
|
||||
devcb_resolved_write16 m_update_func;
|
||||
devcb2_write16 m_update;
|
||||
|
||||
UINT16 m_digit_ram[4]; // holds the digit code for each position
|
||||
UINT8 m_cursor_state[4]; // holds the cursor state for each position, 0=off, 1=on
|
||||
|
@ -175,30 +175,6 @@ static const cassette_interface aim65_2_cassette_interface =
|
||||
NULL
|
||||
};
|
||||
|
||||
const dl1416_interface aim65_ds1_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds1)
|
||||
};
|
||||
|
||||
const dl1416_interface aim65_ds2_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds2)
|
||||
};
|
||||
|
||||
const dl1416_interface aim65_ds3_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds3)
|
||||
};
|
||||
|
||||
const dl1416_interface aim65_ds4_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds4)
|
||||
};
|
||||
|
||||
const dl1416_interface aim65_ds5_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds5)
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
MACHINE DRIVERS
|
||||
@ -290,11 +266,16 @@ static MACHINE_CONFIG_START( aim65, aim65_state )
|
||||
MCFG_DEFAULT_LAYOUT(layout_aim65)
|
||||
|
||||
/* alpha-numeric display */
|
||||
MCFG_DL1416T_ADD("ds1", aim65_ds1_intf)
|
||||
MCFG_DL1416T_ADD("ds2", aim65_ds2_intf)
|
||||
MCFG_DL1416T_ADD("ds3", aim65_ds3_intf)
|
||||
MCFG_DL1416T_ADD("ds4", aim65_ds4_intf)
|
||||
MCFG_DL1416T_ADD("ds5", aim65_ds5_intf)
|
||||
MCFG_DEVICE_ADD("ds1", DL1416T, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds1))
|
||||
MCFG_DEVICE_ADD("ds2", DL1416T, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds2))
|
||||
MCFG_DEVICE_ADD("ds3", DL1416T, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds3))
|
||||
MCFG_DEVICE_ADD("ds4", DL1416T, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds4))
|
||||
MCFG_DEVICE_ADD("ds5", DL1416T, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(aim65_state, aim65_update_ds5))
|
||||
|
||||
/* Sound - wave sound only */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
@ -95,16 +95,6 @@ WRITE16_MEMBER(sitcom_state::sitcom_update_ds1)
|
||||
output_set_digit_value(4 + offset, data);
|
||||
}
|
||||
|
||||
const dl1416_interface sitcom_ds0_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(sitcom_state, sitcom_update_ds0)
|
||||
};
|
||||
|
||||
const dl1416_interface sitcom_ds1_intf =
|
||||
{
|
||||
DEVCB_DRIVER_MEMBER16(sitcom_state, sitcom_update_ds1)
|
||||
};
|
||||
|
||||
// SID line used as serial input from a pc
|
||||
READ_LINE_MEMBER( sitcom_state::sid_line )
|
||||
{
|
||||
@ -124,10 +114,13 @@ static MACHINE_CONFIG_START( sitcom, sitcom_state )
|
||||
MCFG_I8085A_SID(READLINE(sitcom_state, sid_line))
|
||||
MCFG_I8085A_SOD(WRITELINE(sitcom_state, sod_led))
|
||||
|
||||
/* video hardware */
|
||||
MCFG_DL1416B_ADD("ds0", sitcom_ds0_intf)
|
||||
MCFG_DL1416B_ADD("ds1", sitcom_ds1_intf)
|
||||
MCFG_DEFAULT_LAYOUT(layout_sitcom)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_DEVICE_ADD("ds0", DL1416B, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds0))
|
||||
MCFG_DEVICE_ADD("ds1", DL1416B, 0)
|
||||
MCFG_DL1416_UPDATE_HANDLER(WRITE16(sitcom_state, sitcom_update_ds1))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
/* ROM definition */
|
||||
|
Loading…
Reference in New Issue
Block a user