summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/z80sio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/z80sio.cpp')
-rw-r--r--src/devices/machine/z80sio.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/devices/machine/z80sio.cpp b/src/devices/machine/z80sio.cpp
index c52a29983b5..c190fb700a6 100644
--- a/src/devices/machine/z80sio.cpp
+++ b/src/devices/machine/z80sio.cpp
@@ -355,6 +355,7 @@ z80sio_device::z80sio_device(const machine_config &mconfig, device_type type, co
device_z80daisy_interface(mconfig, *this),
m_chanA(*this, CHANA_TAG),
m_chanB(*this, CHANB_TAG),
+ m_hostcpu(*this, finder_base::DUMMY_TAG),
m_out_txd_cb{ { *this }, { *this } },
m_out_dtr_cb{ { *this }, { *this } },
m_out_rts_cb{ { *this }, { *this } },
@@ -362,8 +363,7 @@ z80sio_device::z80sio_device(const machine_config &mconfig, device_type type, co
m_out_sync_cb{ { *this }, { *this } },
m_out_int_cb(*this),
m_out_rxdrq_cb{ { *this }, { *this } },
- m_out_txdrq_cb{ { *this }, { *this } },
- m_cputag(nullptr)
+ m_out_txdrq_cb{ { *this }, { *this } }
{
for (auto & elem : m_int_state)
elem = 0;
@@ -390,6 +390,15 @@ upd7201_new_device::upd7201_new_device(const machine_config &mconfig, const char
}
//-------------------------------------------------
+// device_validity_check - device-specific validation
+//-------------------------------------------------
+void z80sio_device::device_validity_check(validity_checker &valid) const
+{
+ if ((m_hostcpu.finder_tag() != finder_base::DUMMY_TAG) && !m_hostcpu)
+ osd_printf_error("Host CPU configured but not found.\n");
+}
+
+//-------------------------------------------------
// device_resolve_objects - device-specific setup
//-------------------------------------------------
void z80sio_device::device_resolve_objects()
@@ -487,12 +496,11 @@ int z80sio_device::z80daisy_irq_ack()
// Did we not find a vector? Get the notion of a default vector from the CPU implementation
logerror(" - failed to find an interrupt to ack!\n");
- if (m_cputag)
+ if (m_hostcpu)
{
// default irq vector is -1 for 68000 but 0 for z80 for example...
- // FIXME: use an optional_device or something
- int const ret = owner()->subdevice<cpu_device>(m_cputag)->default_irq_vector(INPUT_LINE_IRQ0);
- LOGINT(" - failed to find an interrupt to ack [%s], returning default IRQ vector: %02x\n", m_cputag, ret);
+ int const ret = m_hostcpu->default_irq_vector(INPUT_LINE_IRQ0);
+ LOGINT(" - failed to find an interrupt to ack [%s], returning default IRQ vector: %02x\n", m_hostcpu->tag(), ret);
return ret;
}
@@ -556,12 +564,11 @@ int i8274_new_device::z80daisy_irq_ack()
logerror(" - failed to find an interrupt to ack!\n");
}
- if (m_cputag)
+ if (m_hostcpu)
{
// default irq vector is -1 for 68000 but 0 for z80 for example...
- // FIXME: use an optional_device or something
- int const ret = owner()->subdevice<cpu_device>(m_cputag)->default_irq_vector(INPUT_LINE_IRQ0);
- LOGINT(" - failed to find an interrupt to ack [%s], returning default IRQ vector: %02x\n", m_cputag, ret);
+ int const ret = m_hostcpu->default_irq_vector(INPUT_LINE_IRQ0);
+ LOGINT(" - failed to find an interrupt to ack [%s], returning default IRQ vector: %02x\n", m_hostcpu->tag(), ret);
return ret;
}