diff options
Diffstat (limited to 'src/devices/bus/hp_dio/hp_dio.cpp')
-rw-r--r-- | src/devices/bus/hp_dio/hp_dio.cpp | 178 |
1 files changed, 155 insertions, 23 deletions
diff --git a/src/devices/bus/hp_dio/hp_dio.cpp b/src/devices/bus/hp_dio/hp_dio.cpp index e487fa5b396..b6a57b006ba 100644 --- a/src/devices/bus/hp_dio/hp_dio.cpp +++ b/src/devices/bus/hp_dio/hp_dio.cpp @@ -8,6 +8,11 @@ #include "emu.h" #include "hp_dio.h" +#include "hp98543.h" +#include "hp98544.h" +#include "hp98603a.h" +#include "hp98603b.h" +#include "hp98644.h" //************************************************************************** // GLOBAL VARIABLES @@ -96,11 +101,17 @@ dio16_device::dio16_device(const machine_config &mconfig, device_type type, cons device_t(mconfig, type, tag, owner, clock), m_maincpu(*this, finder_base::DUMMY_TAG), m_prgspace(nullptr), - m_out_irq3_cb(*this), - m_out_irq4_cb(*this), - m_out_irq5_cb(*this), - m_out_irq6_cb(*this) + m_irq1_out_cb(*this), + m_irq2_out_cb(*this), + m_irq3_out_cb(*this), + m_irq4_out_cb(*this), + m_irq5_out_cb(*this), + m_irq6_out_cb(*this), + m_irq7_out_cb(*this), + m_dmar0_out_cb(*this), + m_dmar1_out_cb(*this) { + std::fill(std::begin(m_cards), std::end(m_cards), nullptr); m_prgwidth = 0; } @@ -110,13 +121,21 @@ dio16_device::dio16_device(const machine_config &mconfig, device_type type, cons void dio16_device::device_start() { - m_out_irq3_cb.resolve_safe(); - m_out_irq4_cb.resolve_safe(); - m_out_irq5_cb.resolve_safe(); - m_out_irq6_cb.resolve_safe(); + m_irq1_out_cb.resolve_safe(); + m_irq2_out_cb.resolve_safe(); + m_irq3_out_cb.resolve_safe(); + m_irq4_out_cb.resolve_safe(); + m_irq5_out_cb.resolve_safe(); + m_irq6_out_cb.resolve_safe(); + m_irq7_out_cb.resolve_safe(); + m_dmar0_out_cb.resolve_safe(); + m_dmar1_out_cb.resolve_safe(); m_prgspace = &m_maincpu->space(AS_PROGRAM); m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->data_width(); + + save_item(NAME(m_irq)); + save_item(NAME(m_dmar)); } //------------------------------------------------- @@ -127,25 +146,128 @@ void dio16_device::device_reset() { } +unsigned dio16_device::add_card(device_dio16_card_interface &card) +{ + m_cards.push_back(&card); + return m_bus_index++; +} -void dio16_device::install_memory(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler) +void dio16_device::set_irq(unsigned index, unsigned int level, int state) { - switch (m_prgwidth) - { - case 16: - m_prgspace->install_readwrite_handler(start, end, rhandler, whandler); + bool const changed(bool(state) != BIT(m_irq[level], index)); + if (!changed) + return; + + if (state) + m_irq[level] |= (1 << index); + else + m_irq[level] &= ~(1 << index); + + if (m_bus_index != index) { + switch (level) { + case 0: + m_irq1_out_cb(state); + break; + case 1: + m_irq2_out_cb(state); + break; + case 2: + m_irq3_out_cb(state); + break; + case 3: + m_irq4_out_cb(state); break; - case 32: - m_prgspace->install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + case 4: + m_irq5_out_cb(state); break; - default: - fatalerror("DIO: Bus width %d not supported\n", m_prgwidth); + case 5: + m_irq6_out_cb(state); + break; + case 6: + m_irq7_out_cb(state); + break; + } + } +} + +void dio16_device::set_dmar(unsigned int index, unsigned int num, int state) +{ + assert(num <= 1); + + bool const changed(bool(state) != BIT(m_dmar[num], index)); + if (!changed) + return; + if (state) + m_dmar[num] |= (1 << index); + else + m_dmar[num] &= ~(1 << index); + + + for (auto & card:m_cards) { + + if (card->get_index() == index) + continue; + + switch (num) { + case 0: + card->dmar0_in(state); + break; + case 1: + card->dmar1_in(state); + break; + } + } +} + +void dio16_device::dmack_w_out(int index, int channel, uint8_t val) +{ + for (auto & card:m_cards) { + if (card->get_index() == index) + continue; + card->dmack_w_in(channel, val); + } +} + +uint8_t dio16_device::dmack_r_out(int index, int channel) +{ + uint8_t ret = 0xff; + + for (auto & card:m_cards) { + if (card->get_index() == index) + continue; + ret &= card->dmack_r_in(channel); + } + return ret; +} + +WRITE_LINE_MEMBER(dio16_device::reset_in) +{ + for (auto & card:m_cards) { + if (card->get_index() != m_bus_index) + card->reset_in(state); + } +} + +void dio16_device::install_memory(offs_t start, offs_t end, + read16_delegate rhandler, + write16_delegate whandler) { + switch (m_prgwidth) { + case 16: + m_prgspace->install_readwrite_handler(start, end, rhandler, + whandler); + break; + case 32: + m_prgspace->install_readwrite_handler(start, end, rhandler, + whandler, 0xffffffff); + break; + default: + fatalerror("DIO: Bus width %d not supported\n", m_prgwidth); } } void dio16_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) { - m_prgspace->install_readwrite_bank(start, end, 0, tag ); + m_prgspace->install_readwrite_bank(start, end, 0, tag); machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data); } @@ -165,6 +287,10 @@ void dio16_device::unmap_rom(offs_t start, offs_t end) m_prgspace->unmap_read(start, end); } +void device_dio16_card_interface::set_bus(dio16_device &bus) +{ + m_index = (m_dio_dev = &bus)->add_card(*this); +} //************************************************************************** // DEVICE DIO16 CARD INTERFACE @@ -186,13 +312,10 @@ void device_dio16_card_interface::interface_pre_start() throw emu_fatalerror("device_dio16_card_interface: DIO bus not configured\n"); } - //************************************************************************** // DIO32 DEVICE //************************************************************************** - - dio32_device::dio32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : dio16_device(mconfig, DIO32, tag, owner, clock) { @@ -203,7 +326,6 @@ void dio32_device::device_start() dio16_device::device_start(); } - //************************************************************************** // DEVICE DIO32 CARD INTERFACE //************************************************************************** @@ -224,5 +346,15 @@ void device_dio32_card_interface::interface_pre_start() if (m_dio_dev && !dynamic_cast<dio32_device *>(m_dio_dev)) throw emu_fatalerror("device_dio32_card_interface: DIO32 device %s (%s) in DIO16 slot %s\n", device().tag(), device().name(), m_dio_dev->name()); } -} + +} // namespace bus::hp_dio +} // namespace bus + +void hpdio_cards(device_slot_interface & device) +{ + device.option_add("hp98543", HPDIO_98543); + device.option_add("hp98544", HPDIO_98544); + device.option_add("hp98603a", HPDIO_98603A); + device.option_add("hp98603b", HPDIO_98603B); + device.option_add("hp98644", HPDIO_98644); } |