diff options
Diffstat (limited to 'src/devices/bus/vtech/ioexp/ioexp.cpp')
-rw-r--r-- | src/devices/bus/vtech/ioexp/ioexp.cpp | 73 |
1 files changed, 70 insertions, 3 deletions
diff --git a/src/devices/bus/vtech/ioexp/ioexp.cpp b/src/devices/bus/vtech/ioexp/ioexp.cpp index 27a517fabb1..475f287201e 100644 --- a/src/devices/bus/vtech/ioexp/ioexp.cpp +++ b/src/devices/bus/vtech/ioexp/ioexp.cpp @@ -1,5 +1,5 @@ -// license:GPL-2.0+ -// copyright-holders:Dirk Best +// license: GPL-2.0+ +// copyright-holders: Dirk Best /*************************************************************************** VTech Laser/VZ I/O Expansion Slot @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(VTECH_IOEXP_SLOT, vtech_ioexp_slot_device, "vtech_ioexp_slot" vtech_ioexp_slot_device::vtech_ioexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VTECH_IOEXP_SLOT, tag, owner, clock), device_single_card_slot_interface<device_vtech_ioexp_interface>(mconfig, *this), - m_io(*this, finder_base::DUMMY_TAG, -1) + m_iospace(*this, finder_base::DUMMY_TAG, -1) { } @@ -48,6 +48,24 @@ vtech_ioexp_slot_device::~vtech_ioexp_slot_device() void vtech_ioexp_slot_device::device_start() { + // get inserted module + m_module = get_card_device(); + + // install io access taps + m_iospace->install_readwrite_tap + ( + 0x00, 0xff, "io_tap", + [this](offs_t offset, uint8_t &data, uint8_t mem_mask) + { + if (m_module) + data &= m_module->iorq_r(offset); + }, + [this](offs_t offset, uint8_t &data, uint8_t mem_mask) + { + if (m_module) + m_module->iorq_w(offset, data); + } + ); } @@ -72,3 +90,52 @@ device_vtech_ioexp_interface::device_vtech_ioexp_interface(const machine_config device_vtech_ioexp_interface::~device_vtech_ioexp_interface() { } + + +//************************************************************************** +// BASE DEVICE +//************************************************************************** + +//------------------------------------------------- +// vtech_ioexp_device - constructor +//------------------------------------------------- + +vtech_ioexp_device::vtech_ioexp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + device_vtech_ioexp_interface(mconfig, *this), + m_io(*this, "iospace") +{ +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void vtech_ioexp_device::device_add_mconfig(machine_config &config) +{ + ADDRESS_MAP_BANK(config, m_io); + m_io->set_addrmap(AS_PROGRAM, &vtech_ioexp_device::io_map); + m_io->set_data_width(8); + m_io->set_addr_width(16); +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vtech_ioexp_device::device_start() +{ + // silence unmapped warnings, or we'll get them for everything the + // expansion device doesn't handle + m_io->set_log_unmap(false); +} + +uint8_t vtech_ioexp_device::iorq_r(offs_t offset) +{ + return m_io->read8(offset); +} + +void vtech_ioexp_device::iorq_w(offs_t offset, uint8_t data) +{ + m_io->write8(offset, data); +} |