summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/z80sti.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/machine/z80sti.c')
-rw-r--r--src/emu/machine/z80sti.c105
1 files changed, 31 insertions, 74 deletions
diff --git a/src/emu/machine/z80sti.c b/src/emu/machine/z80sti.c
index 2dfc89e7c9a..79ddaf09329 100644
--- a/src/emu/machine/z80sti.c
+++ b/src/emu/machine/z80sti.c
@@ -24,6 +24,9 @@
+// device type definition
+const device_type Z80STI = &device_creator<z80sti_device>;
+
//**************************************************************************
// DEBUGGING
//**************************************************************************
@@ -35,14 +38,6 @@
//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
-
-const device_type Z80STI = z80sti_device_config::static_alloc_device_config;
-
-
-
-//**************************************************************************
// CONSTANTS
//**************************************************************************
@@ -144,38 +139,17 @@ static const int PRESCALER[] = { 0, 4, 10, 16, 50, 64, 100, 200 };
//**************************************************************************
-// DEVICE CONFIGURATION
+// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
-// z80sti_device_config - constructor
-//-------------------------------------------------
-
-z80sti_device_config::z80sti_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "Mostek MK3801", tag, owner, clock),
- device_config_z80daisy_interface(mconfig, *this)
-{
-}
-
-
-//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
-//-------------------------------------------------
-
-device_config *z80sti_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
-{
- return global_alloc(z80sti_device_config(mconfig, tag, owner, clock));
-}
-
-
-//-------------------------------------------------
-// alloc_device - allocate a new device object
+// z80sti_device - constructor
//-------------------------------------------------
-device_t *z80sti_device_config::alloc_device(running_machine &machine) const
+z80sti_device::z80sti_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, Z80STI, "Mostek MK3801", tag, owner, clock),
+ device_z80daisy_interface(mconfig, *this)
{
- return auto_alloc(machine, z80sti_device(machine, *this));
}
@@ -185,7 +159,7 @@ device_t *z80sti_device_config::alloc_device(running_machine &machine) const
// complete
//-------------------------------------------------
-void z80sti_device_config::device_config_complete()
+void z80sti_device::device_config_complete()
{
// inherit a copy of the static data
const z80sti_interface *intf = reinterpret_cast<const z80sti_interface *>(static_config());
@@ -196,36 +170,19 @@ void z80sti_device_config::device_config_complete()
else
{
m_rx_clock = m_tx_clock = 0;
- memset(&m_out_int_func, 0, sizeof(m_out_int_func));
- memset(&m_in_gpio_func, 0, sizeof(m_in_gpio_func));
- memset(&m_out_gpio_func, 0, sizeof(m_out_gpio_func));
- memset(&m_in_si_func, 0, sizeof(m_in_si_func));
- memset(&m_out_so_func, 0, sizeof(m_out_so_func));
- memset(&m_out_tao_func, 0, sizeof(m_out_tao_func));
- memset(&m_out_tbo_func, 0, sizeof(m_out_tbo_func));
- memset(&m_out_tco_func, 0, sizeof(m_out_tco_func));
- memset(&m_out_tdo_func, 0, sizeof(m_out_tdo_func));
+ memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
+ memset(&m_in_gpio_cb, 0, sizeof(m_in_gpio_cb));
+ memset(&m_out_gpio_cb, 0, sizeof(m_out_gpio_cb));
+ memset(&m_in_si_cb, 0, sizeof(m_in_si_cb));
+ memset(&m_out_so_cb, 0, sizeof(m_out_so_cb));
+ memset(&m_out_tao_cb, 0, sizeof(m_out_tao_cb));
+ memset(&m_out_tbo_cb, 0, sizeof(m_out_tbo_cb));
+ memset(&m_out_tco_cb, 0, sizeof(m_out_tco_cb));
+ memset(&m_out_tdo_cb, 0, sizeof(m_out_tdo_cb));
}
}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// z80sti_device - constructor
-//-------------------------------------------------
-
-z80sti_device::z80sti_device(running_machine &_machine, const z80sti_device_config &config)
- : device_t(_machine, config),
- device_z80daisy_interface(_machine, config, *this),
- m_config(config)
-{
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -233,15 +190,15 @@ z80sti_device::z80sti_device(running_machine &_machine, const z80sti_device_conf
void z80sti_device::device_start()
{
// resolve callbacks
- devcb_resolve_read8(&m_in_gpio_func, &m_config.m_in_gpio_func, this);
- devcb_resolve_write8(&m_out_gpio_func, &m_config.m_out_gpio_func, this);
- devcb_resolve_read_line(&m_in_si_func, &m_config.m_in_si_func, this);
- devcb_resolve_write_line(&m_out_so_func, &m_config.m_out_so_func, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_A], &m_config.m_out_tao_func, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_B], &m_config.m_out_tbo_func, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_C], &m_config.m_out_tco_func, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_D], &m_config.m_out_tdo_func, this);
- devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
+ devcb_resolve_read8(&m_in_gpio_func, &m_in_gpio_cb, this);
+ devcb_resolve_write8(&m_out_gpio_func, &m_out_gpio_cb, this);
+ devcb_resolve_read_line(&m_in_si_func, &m_in_si_cb, this);
+ devcb_resolve_write_line(&m_out_so_func, &m_out_so_cb, this);
+ devcb_resolve_write_line(&m_out_timer_func[TIMER_A], &m_out_tao_cb, this);
+ devcb_resolve_write_line(&m_out_timer_func[TIMER_B], &m_out_tbo_cb, this);
+ devcb_resolve_write_line(&m_out_timer_func[TIMER_C], &m_out_tco_cb, this);
+ devcb_resolve_write_line(&m_out_timer_func[TIMER_D], &m_out_tdo_cb, this);
+ devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
// create the counter timers
m_timer[TIMER_A] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
@@ -250,17 +207,17 @@ void z80sti_device::device_start()
m_timer[TIMER_D] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
// create serial receive clock timer
- if (m_config.m_rx_clock > 0)
+ if (m_rx_clock > 0)
{
m_rx_timer = machine().scheduler().timer_alloc(FUNC(static_rx_tick), (void *)this);
- m_rx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_rx_clock));
+ m_rx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_rx_clock));
}
// create serial transmit clock timer
- if (m_config.m_tx_clock > 0)
+ if (m_tx_clock > 0)
{
m_tx_timer = machine().scheduler().timer_alloc(FUNC(static_tx_tick), (void *)this);
- m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_config.m_tx_clock));
+ m_tx_timer->adjust(attotime::zero, 0, attotime::from_hz(m_tx_clock));
}
// register for state saving