diff options
Diffstat (limited to 'src/devices/bus/electron/plus2.cpp')
-rw-r--r-- | src/devices/bus/electron/plus2.cpp | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp index dd8be6e09eb..92a9599dfb0 100644 --- a/src/devices/bus/electron/plus2.cpp +++ b/src/devices/bus/electron/plus2.cpp @@ -4,7 +4,7 @@ Slogger Plus 2 - The Plus 2 interface from Slogger has been designed to compliment + The Plus 2 interface from Slogger has been designed to complement the Slogger Rombox Plus and Acorn Plus 1 by offering further expansion capabilities. This has been achieved by providing two extra cartridge slots, three ROM sockets and connections for a @@ -31,27 +31,31 @@ DEFINE_DEVICE_TYPE(ELECTRON_PLUS2, electron_plus2_device, "electron_plus2", "Slo void electron_plus2_device::device_add_mconfig(machine_config &config) { + INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + /* rom sockets */ GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 13 - m_rom[0]->set_device_load(FUNC(electron_plus2_device::rom1_load), this); + m_rom[0]->set_device_load(FUNC(electron_plus2_device::rom1_load)); GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 14 - m_rom[1]->set_device_load(FUNC(electron_plus2_device::rom2_load), this); + m_rom[1]->set_device_load(FUNC(electron_plus2_device::rom2_load)); GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 15 - m_rom[2]->set_device_load(FUNC(electron_plus2_device::rom3_load), this); + m_rom[2]->set_device_load(FUNC(electron_plus2_device::rom3_load)); /* cartridges */ ELECTRON_CARTSLOT(config, m_cart[0], DERIVED_CLOCK(1, 1), electron_cart, nullptr); - m_cart[0]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + m_cart[0]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); m_cart[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); ELECTRON_CARTSLOT(config, m_cart[1], DERIVED_CLOCK(1, 1), electron_cart, nullptr); - m_cart[1]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + m_cart[1]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); m_cart[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); /* via */ - VIA6522(config, m_via, DERIVED_CLOCK(1, 16)); + MOS6522(config, m_via, DERIVED_CLOCK(1, 16)); m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); - m_via->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + m_via->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); + m_via->cb2_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb2)); + m_via->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<2>)); /* user port */ BBC_USERPORT_SLOT(config, m_userport, bbc_userport_devices, nullptr); @@ -60,7 +64,7 @@ void electron_plus2_device::device_add_mconfig(machine_config &config) /* pass-through */ ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr); - m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + m_exp->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<3>)); m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); } @@ -75,6 +79,7 @@ void electron_plus2_device::device_add_mconfig(machine_config &config) electron_plus2_device::electron_plus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ELECTRON_PLUS2, tag, owner, clock) , device_electron_expansion_interface(mconfig, *this) + , m_irqs(*this, "irqs") , m_exp(*this, "exp") , m_via(*this, "via6522") , m_rom(*this, "rom%u", 1) @@ -121,6 +126,7 @@ uint8_t electron_plus2_device::expbus_r(offs_t offset) case 13: data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: data &= m_rom[m_romsel - 13]->read_rom(offset & 0x3fff); @@ -176,6 +182,10 @@ void electron_plus2_device::expbus_w(offs_t offset, uint8_t data) case 7: m_cart[0]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0); break; + case 13: + m_cart[0]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 0, 1); + m_cart[1]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 0, 1); + break; } break; @@ -198,7 +208,7 @@ void electron_plus2_device::expbus_w(offs_t offset, uint8_t data) break; case 0xfe: - if (offset == 0xfe05) + if ((offset == 0xfe05) && !(data & 0xf0)) { m_romsel = data & 0x0f; } @@ -214,23 +224,21 @@ void electron_plus2_device::expbus_w(offs_t offset, uint8_t data) // IMPLEMENTATION //************************************************************************** -image_init_result electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot) +std::pair<std::error_condition, std::string> electron_plus2_device::load_rom(device_image_interface &image, generic_slot_device *slot) { - uint32_t size = slot->common_get_size("rom"); + uint32_t const size = slot->common_get_size("rom"); // socket accepts 8K and 16K ROM only if (size != 0x2000 && size != 0x4000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 8K/16K is supported"); - return image_init_result::FAIL; - } + return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported"); slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); slot->common_load_rom(slot->get_rom_base(), size, "rom"); // mirror 8K ROMs - uint8_t *crt = slot->get_rom_base(); - if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000); + uint8_t *const crt = slot->get_rom_base(); + if (size <= 0x2000) + memcpy(crt + 0x2000, crt, 0x2000); - return image_init_result::PASS; + return std::make_pair(std::error_condition(), std::string()); } |