diff options
Diffstat (limited to 'src/devices/bus/macpds/macpds.cpp')
-rw-r--r-- | src/devices/bus/macpds/macpds.cpp | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/src/devices/bus/macpds/macpds.cpp b/src/devices/bus/macpds/macpds.cpp index 8773f453093..4fa3eae6d6e 100644 --- a/src/devices/bus/macpds/macpds.cpp +++ b/src/devices/bus/macpds/macpds.cpp @@ -33,8 +33,7 @@ macpds_slot_device::macpds_slot_device(const machine_config &mconfig, const char macpds_slot_device::macpds_slot_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_slot_interface(mconfig, *this), - m_macpds_tag(nullptr), - m_macpds_slottag(nullptr) + m_macpds(*this, finder_base::DUMMY_TAG) { } @@ -46,7 +45,7 @@ void macpds_slot_device::device_start() { device_macpds_card_interface *dev = dynamic_cast<device_macpds_card_interface *>(get_card_device()); - if (dev) dev->set_macpds_tag(m_macpds_tag, m_macpds_slottag); + if (dev) dev->set_macpds_and_slot(m_macpds, this); } //************************************************************************** @@ -70,17 +69,21 @@ macpds_device::macpds_device(const machine_config &mconfig, const char *tag, dev macpds_device::macpds_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), - m_maincpu(nullptr), - m_cputag(nullptr) + m_maincpu(*this, finder_base::DUMMY_TAG) { } + +macpds_device::~macpds_device() +{ +} + + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void macpds_device::device_start() { - m_maincpu = machine().device<cpu_device>(m_cputag); } //------------------------------------------------- @@ -91,30 +94,30 @@ void macpds_device::device_reset() { } -void macpds_device::add_macpds_card(device_macpds_card_interface *card) +void macpds_device::add_macpds_card(device_macpds_card_interface &card) { - m_device_list.append(*card); + m_device_list.emplace_back(card); } -void macpds_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask) +template<typename R, typename W> void macpds_device::install_device(offs_t start, offs_t end, R rhandler, W whandler, uint32_t mask) { - m_maincpu = machine().device<cpu_device>(m_cputag); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); } -void macpds_device::install_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask) -{ - m_maincpu = machine().device<cpu_device>(m_cputag); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); -} +template void macpds_device::install_device<read8_delegate, write8_delegate >(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read8s_delegate, write8s_delegate >(offs_t start, offs_t end, read8s_delegate rhandler, write8s_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read8sm_delegate, write8sm_delegate >(offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read8smo_delegate, write8smo_delegate >(offs_t start, offs_t end, read8smo_delegate rhandler, write8smo_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read16_delegate, write16_delegate >(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read16s_delegate, write16s_delegate >(offs_t start, offs_t end, read16s_delegate rhandler, write16s_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read16sm_delegate, write16sm_delegate >(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler, uint32_t mask); +template void macpds_device::install_device<read16smo_delegate, write16smo_delegate>(offs_t start, offs_t end, read16smo_delegate rhandler, write16smo_delegate whandler, uint32_t mask); -void macpds_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void macpds_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); - m_maincpu = machine().device<cpu_device>(m_cputag); address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_readwrite_bank(start, end, 0, tag ); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + space.install_ram(start, end, data); } void macpds_device::set_irq_line(int line, int state) @@ -135,10 +138,10 @@ void macpds_device::set_irq_line(int line, int state) // device_macpds_card_interface - constructor //------------------------------------------------- -device_macpds_card_interface::device_macpds_card_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig, device), - m_macpds(nullptr), - m_macpds_tag(nullptr), m_macpds_slottag(nullptr), m_next(nullptr) +device_macpds_card_interface::device_macpds_card_interface(const machine_config &mconfig, device_t &device) : + device_interface(device, "macpds"), + m_macpds(nullptr), + m_macpds_slot(nullptr) { } @@ -153,26 +156,18 @@ device_macpds_card_interface::~device_macpds_card_interface() void device_macpds_card_interface::set_macpds_device() { - m_macpds = dynamic_cast<macpds_device *>(device().machine().device(m_macpds_tag)); - m_macpds->add_macpds_card(this); + m_macpds->add_macpds_card(*this); } -void device_macpds_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_macpds_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - char bank[256]; - - // append an underscore and the slot name to the bank so it's guaranteed unique - snprintf(bank, sizeof(bank), "%s_%s", tag, m_macpds_slottag); - - m_macpds->install_bank(start, end, bank, data); + m_macpds->install_bank(start, end, data); } void device_macpds_card_interface::install_rom(device_t *dev, const char *romregion, uint32_t addr) { uint8_t *rom = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->base(); uint32_t romlen = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->bytes(); - char bankname[128]; - sprintf(bankname, "rom_%x", addr); - m_macpds->install_bank(addr, addr+romlen-1, bankname, rom); + m_macpds->install_bank(addr, addr+romlen-1, rom); } |