From 75ab4efc4c2d17d441e59a3d7efead01431ad0bc Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Mon, 7 Sep 2020 14:19:09 +0100 Subject: bus/electron: Use input_merger for IRQs where required and various minor cleanups. --- src/devices/bus/electron/cart/abr.cpp | 3 +++ src/devices/bus/electron/cart/ap34.cpp | 22 +++++++--------------- src/devices/bus/electron/cart/ap34.h | 3 +-- src/devices/bus/electron/cart/ap5.cpp | 9 ++++++--- src/devices/bus/electron/cart/ap5.h | 2 ++ src/devices/bus/electron/cart/cumana.cpp | 16 ++++++---------- src/devices/bus/electron/cart/peg400.cpp | 14 ++++---------- src/devices/bus/electron/cart/stlefs.cpp | 17 +++++++---------- src/devices/bus/electron/cart/stlefs.h | 2 ++ src/devices/bus/electron/exp.cpp | 7 ------- src/devices/bus/electron/exp.h | 1 - src/devices/bus/electron/mode7.cpp | 1 - src/devices/bus/electron/plus1.cpp | 7 +++++-- src/devices/bus/electron/plus1.h | 2 ++ src/devices/bus/electron/plus2.cpp | 11 +++++++---- src/devices/bus/electron/plus2.h | 2 ++ src/devices/bus/electron/romboxp.cpp | 7 +++++-- src/devices/bus/electron/romboxp.h | 2 ++ 18 files changed, 61 insertions(+), 67 deletions(-) diff --git a/src/devices/bus/electron/cart/abr.cpp b/src/devices/bus/electron/cart/abr.cpp index 1d2455e56c1..0c82ca65782 100644 --- a/src/devices/bus/electron/cart/abr.cpp +++ b/src/devices/bus/electron/cart/abr.cpp @@ -39,6 +39,9 @@ void electron_abr_device::device_start() { m_bank_locked[0] = false; m_bank_locked[1] = false; + + // register for save states + save_item(NAME(m_bank_locked)); } diff --git a/src/devices/bus/electron/cart/ap34.cpp b/src/devices/bus/electron/cart/ap34.cpp index 70047b271ed..6d1b0188674 100644 --- a/src/devices/bus/electron/cart/ap34.cpp +++ b/src/devices/bus/electron/cart/ap34.cpp @@ -7,7 +7,6 @@ http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/PRES_AP3A.html TODO: - - AP4 (DFS) is unreliable, maybe WD1770 reset issue to be investigated - add spare ROM slot in AP3 and AP4, not AP3/4 **********************************************************************/ @@ -48,8 +47,8 @@ void electron_ap34_device::device_add_mconfig(machine_config &config) { /* fdc */ WD1770(config, m_fdc, DERIVED_CLOCK(1, 2)); - FLOPPY_CONNECTOR(config, m_floppy0, ap34_floppies, "525qd", electron_ap34_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, ap34_floppies, nullptr, electron_ap34_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[0], ap34_floppies, "525qd", electron_ap34_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], ap34_floppies, nullptr, electron_ap34_device::floppy_formats).enable_sound(true); } //************************************************************************** @@ -64,8 +63,7 @@ electron_ap34_device::electron_ap34_device(const machine_config &mconfig, const : device_t(mconfig, ELECTRON_AP34, tag, owner, clock) , device_electron_cart_interface(mconfig, *this) , m_fdc(*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") + , m_floppy(*this, "fdc:%u", 0) { } @@ -87,12 +85,9 @@ uint8_t electron_ap34_device::read(offs_t offset, int infc, int infd, int romqa, if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: data = m_fdc->read(offset & 0x03); break; } @@ -120,15 +115,12 @@ void electron_ap34_device::write(offs_t offset, uint8_t data, int infc, int infd { if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0xc0: wd1770_control_w(data); break; case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: m_fdc->write(offset & 0x03, data); break; } @@ -152,8 +144,8 @@ void electron_ap34_device::wd1770_control_w(uint8_t data) floppy_image_device *floppy = nullptr; // bit 0, 1: drive select - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 0)) floppy = m_floppy[0]->get_device(); + if (BIT(data, 1)) floppy = m_floppy[1]->get_device(); m_fdc->set_floppy(floppy); // bit 2: side select diff --git a/src/devices/bus/electron/cart/ap34.h b/src/devices/bus/electron/cart/ap34.h index 69b47514487..d58f0eab37e 100644 --- a/src/devices/bus/electron/cart/ap34.h +++ b/src/devices/bus/electron/cart/ap34.h @@ -44,8 +44,7 @@ private: DECLARE_FLOPPY_FORMATS(floppy_formats); required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; + required_device_array m_floppy; }; diff --git a/src/devices/bus/electron/cart/ap5.cpp b/src/devices/bus/electron/cart/ap5.cpp index 2929374cd48..c65daf911d4 100644 --- a/src/devices/bus/electron/cart/ap5.cpp +++ b/src/devices/bus/electron/cart/ap5.cpp @@ -24,6 +24,8 @@ DEFINE_DEVICE_TYPE(ELECTRON_AP5, electron_ap5_device, "electron_ap5", "P.R.E.S. void electron_ap5_device::device_add_mconfig(machine_config &config) { + INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w)); + /* rom sockets */ GENERIC_SOCKET(config, m_romslot[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 14 m_romslot[0]->set_device_load(FUNC(electron_ap5_device::rom1_load)); @@ -34,7 +36,7 @@ void electron_ap5_device::device_add_mconfig(machine_config &config) VIA6522(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_cartslot_device::irq_w)); + m_via->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); /* user port */ BBC_USERPORT_SLOT(config, m_userport, bbc_userport_devices, nullptr); @@ -43,12 +45,12 @@ void electron_ap5_device::device_add_mconfig(machine_config &config) /* 1mhz bus port */ BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 16), bbc_1mhzbus_devices, nullptr); - m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w)); + m_1mhzbus->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w)); /* tube port */ BBC_TUBE_SLOT(config, m_tube, electron_tube_devices, nullptr); - m_tube->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w)); + m_tube->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<2>)); } //************************************************************************** @@ -62,6 +64,7 @@ void electron_ap5_device::device_add_mconfig(machine_config &config) electron_ap5_device::electron_ap5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ELECTRON_AP5, tag, owner, clock) , device_electron_cart_interface(mconfig, *this) + , m_irqs(*this, "irqs") , m_via(*this, "via6522") , m_tube(*this, "tube") , m_1mhzbus(*this, "1mhzbus") diff --git a/src/devices/bus/electron/cart/ap5.h b/src/devices/bus/electron/cart/ap5.h index 846f3fbc649..9e69c775c63 100644 --- a/src/devices/bus/electron/cart/ap5.h +++ b/src/devices/bus/electron/cart/ap5.h @@ -11,6 +11,7 @@ #include "slot.h" #include "machine/6522via.h" +#include "machine/input_merger.h" #include "bus/bbc/1mhzbus/1mhzbus.h" #include "bus/bbc/tube/tube.h" #include "bus/bbc/userport/userport.h" @@ -45,6 +46,7 @@ private: DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_romslot[0]); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romslot[1]); } + required_device m_irqs; required_device m_via; required_device m_tube; required_device m_1mhzbus; diff --git a/src/devices/bus/electron/cart/cumana.cpp b/src/devices/bus/electron/cart/cumana.cpp index 8792395b503..e849748ed2a 100644 --- a/src/devices/bus/electron/cart/cumana.cpp +++ b/src/devices/bus/electron/cart/cumana.cpp @@ -26,14 +26,14 @@ DEFINE_DEVICE_TYPE(ELECTRON_CUMANA, electron_cumana_device, "electron_cumana", " //------------------------------------------------- -// MACHINE_DRIVER( cumana ) +// FLOPPY_FORMATS( cumana ) //------------------------------------------------- FLOPPY_FORMATS_MEMBER(electron_cumana_device::floppy_formats) FLOPPY_ACORN_SSD_FORMAT, FLOPPY_ACORN_DSD_FORMAT, FLOPPY_ACORN_ADFS_OLD_FORMAT -FLOPPY_FORMATS_END0 +FLOPPY_FORMATS_END void cumana_floppies(device_slot_interface &device) { @@ -93,14 +93,13 @@ uint8_t electron_cumana_device::read(offs_t offset, int infc, int infd, int romq if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0x90: - case 0x91: - case 0x92: - case 0x93: data = m_fdc->read(offset & 0x03); break; + case 0x94: + break; case 0x98: case 0x9c: data = m_rtc->read(BIT(offset, 2)); @@ -138,12 +137,9 @@ void electron_cumana_device::write(offs_t offset, uint8_t data, int infc, int in { if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0x90: - case 0x91: - case 0x92: - case 0x93: m_fdc->write(offset & 0x03, data); break; case 0x94: diff --git a/src/devices/bus/electron/cart/peg400.cpp b/src/devices/bus/electron/cart/peg400.cpp index abca703474a..a832b25cfc6 100644 --- a/src/devices/bus/electron/cart/peg400.cpp +++ b/src/devices/bus/electron/cart/peg400.cpp @@ -22,14 +22,14 @@ DEFINE_DEVICE_TYPE(ELECTRON_PEG400, electron_peg400_device, "electron_peg400", " //------------------------------------------------- -// MACHINE_DRIVER( peg400 ) +// FLOPPY_FORMATS( peg400 ) //------------------------------------------------- FLOPPY_FORMATS_MEMBER(electron_peg400_device::floppy_formats) FLOPPY_ACORN_SSD_FORMAT, FLOPPY_ACORN_DSD_FORMAT, FLOPPY_ACORN_ADFS_OLD_FORMAT -FLOPPY_FORMATS_END0 +FLOPPY_FORMATS_END void peg400_floppies(device_slot_interface &device) { @@ -85,12 +85,9 @@ uint8_t electron_peg400_device::read(offs_t offset, int infc, int infd, int romq if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: data = m_fdc->read(offset & 0x03); break; } @@ -126,15 +123,12 @@ void electron_peg400_device::write(offs_t offset, uint8_t data, int infc, int in { if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0xc0: wd1770_control_w(data); break; case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: m_fdc->write(offset & 0x03, data); break; } diff --git a/src/devices/bus/electron/cart/stlefs.cpp b/src/devices/bus/electron/cart/stlefs.cpp index 2d9ade9d5de..1b46c5d94eb 100644 --- a/src/devices/bus/electron/cart/stlefs.cpp +++ b/src/devices/bus/electron/cart/stlefs.cpp @@ -45,16 +45,18 @@ void stlefs_floppies(device_slot_interface &device) void electron_stlefs_device::device_add_mconfig(machine_config &config) { + INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w)); + /* fdc */ WD1770(config, m_fdc, DERIVED_CLOCK(1, 2)); - m_fdc->intrq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w)); + m_fdc->intrq_wr_callback().set(m_irqs, FUNC(input_merger_device::in_w<0>)); m_fdc->drq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w)); FLOPPY_CONNECTOR(config, m_floppy0, stlefs_floppies, "525qd", electron_stlefs_device::floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppy1, stlefs_floppies, nullptr, electron_stlefs_device::floppy_formats).enable_sound(true); /* winchester */ BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 16), bbc_1mhzbus_devices, nullptr); - m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w)); + m_1mhzbus->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w)); } @@ -69,6 +71,7 @@ void electron_stlefs_device::device_add_mconfig(machine_config &config) electron_stlefs_device::electron_stlefs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ELECTRON_STLEFS, tag, owner, clock) , device_electron_cart_interface(mconfig, *this) + , m_irqs(*this, "irqs") , m_1mhzbus(*this, "1mhzbus") , m_fdc(*this, "fdc") , m_floppy0(*this, "fdc:0") @@ -94,12 +97,9 @@ uint8_t electron_stlefs_device::read(offs_t offset, int infc, int infd, int romq if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: data = m_fdc->read(offset & 0x03); break; } @@ -121,15 +121,12 @@ void electron_stlefs_device::write(offs_t offset, uint8_t data, int infc, int in { if (infc) { - switch (offset & 0xff) + switch (offset & 0xfc) { case 0xc0: wd1770_control_w(data); break; case 0xc4: - case 0xc5: - case 0xc6: - case 0xc7: m_fdc->write(offset & 0x03, data); break; //case 0xcb: diff --git a/src/devices/bus/electron/cart/stlefs.h b/src/devices/bus/electron/cart/stlefs.h index 707a2e8db0c..f34c680bf02 100644 --- a/src/devices/bus/electron/cart/stlefs.h +++ b/src/devices/bus/electron/cart/stlefs.h @@ -13,6 +13,7 @@ #include "slot.h" #include "bus/bbc/1mhzbus/1mhzbus.h" +#include "machine/input_merger.h" #include "machine/wd_fdc.h" #include "imagedev/floppy.h" #include "formats/acorn_dsk.h" @@ -44,6 +45,7 @@ private: void wd1770_control_w(uint8_t data); DECLARE_FLOPPY_FORMATS(floppy_formats); + required_device m_irqs; required_device m_1mhzbus; required_device m_fdc; required_device m_floppy0; diff --git a/src/devices/bus/electron/exp.cpp b/src/devices/bus/electron/exp.cpp index 82fdf6fc462..f7c14b71c05 100644 --- a/src/devices/bus/electron/exp.cpp +++ b/src/devices/bus/electron/exp.cpp @@ -63,13 +63,6 @@ void electron_expansion_slot_device::device_start() m_nmi_handler.resolve_safe(); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void electron_expansion_slot_device::device_reset() -{ -} //------------------------------------------------- // expbus_r - expansion data read diff --git a/src/devices/bus/electron/exp.h b/src/devices/bus/electron/exp.h index 2026d95aa09..ea0c435a4be 100644 --- a/src/devices/bus/electron/exp.h +++ b/src/devices/bus/electron/exp.h @@ -126,7 +126,6 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; device_electron_expansion_interface *m_card; diff --git a/src/devices/bus/electron/mode7.cpp b/src/devices/bus/electron/mode7.cpp index be2ccb453e2..103c861c4ae 100644 --- a/src/devices/bus/electron/mode7.cpp +++ b/src/devices/bus/electron/mode7.cpp @@ -75,7 +75,6 @@ void electron_mode7_device::device_add_mconfig(machine_config &config) m_hd6845->out_vsync_callback().set(FUNC(electron_mode7_device::vsync_changed)); SAA5050(config, m_trom, 6_MHz_XTAL); - m_trom->set_screen_size(40, 25, 40); /* pass-through */ ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr); diff --git a/src/devices/bus/electron/plus1.cpp b/src/devices/bus/electron/plus1.cpp index 91f23549db9..5bf61578b2b 100644 --- a/src/devices/bus/electron/plus1.cpp +++ b/src/devices/bus/electron/plus1.cpp @@ -124,6 +124,8 @@ ioport_constructor electron_ap6_device::device_input_ports() const void electron_plus1_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)); + /* printer */ CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set([this](int state) { m_centronics_busy = state; }); @@ -140,10 +142,10 @@ void electron_plus1_device::device_add_mconfig(machine_config &config) /* cartridges */ ELECTRON_CARTSLOT(config, m_cart_sk1, DERIVED_CLOCK(1, 1), electron_cart, nullptr); - m_cart_sk1->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + m_cart_sk1->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); m_cart_sk1->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); ELECTRON_CARTSLOT(config, m_cart_sk2, DERIVED_CLOCK(1, 1), electron_cart, nullptr); - m_cart_sk2->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w)); + m_cart_sk2->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); m_cart_sk2->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); } @@ -196,6 +198,7 @@ const tiny_rom_entry *electron_ap6_device::device_rom_region() const electron_plus1_device::electron_plus1_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_electron_expansion_interface(mconfig, *this) + , m_irqs(*this, "irqs") , m_exp_rom(*this, "exp_rom") , m_cart_sk1(*this, "cart_sk1") , m_cart_sk2(*this, "cart_sk2") diff --git a/src/devices/bus/electron/plus1.h b/src/devices/bus/electron/plus1.h index cd0cb1b05dd..36a403b960c 100644 --- a/src/devices/bus/electron/plus1.h +++ b/src/devices/bus/electron/plus1.h @@ -12,6 +12,7 @@ #include "exp.h" #include "machine/adc0844.h" +#include "machine/input_merger.h" #include "bus/centronics/ctronics.h" #include "bus/electron/cart/slot.h" #include "bus/generic/slot.h" @@ -43,6 +44,7 @@ protected: virtual uint8_t expbus_r(offs_t offset) override; virtual void expbus_w(offs_t offset, uint8_t data) override; + required_device m_irqs; required_memory_region m_exp_rom; required_device m_cart_sk1; required_device m_cart_sk2; diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp index e7d60e9731b..f0e28d73150 100644 --- a/src/devices/bus/electron/plus2.cpp +++ b/src/devices/bus/electron/plus2.cpp @@ -31,6 +31,8 @@ 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)); @@ -41,17 +43,17 @@ void electron_plus2_device::device_add_mconfig(machine_config &config) /* 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)); 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->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 +62,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 +77,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) diff --git a/src/devices/bus/electron/plus2.h b/src/devices/bus/electron/plus2.h index 235ecd4f218..04e3a280377 100644 --- a/src/devices/bus/electron/plus2.h +++ b/src/devices/bus/electron/plus2.h @@ -12,6 +12,7 @@ #include "exp.h" #include "machine/6522via.h" +#include "machine/input_merger.h" #include "bus/electron/cart/slot.h" #include "bus/bbc/userport/userport.h" #include "bus/generic/slot.h" @@ -45,6 +46,7 @@ private: DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); } + required_device m_irqs; required_device m_exp; required_device m_via; required_device_array m_rom; diff --git a/src/devices/bus/electron/romboxp.cpp b/src/devices/bus/electron/romboxp.cpp index e944116a17e..9408ce1cc74 100644 --- a/src/devices/bus/electron/romboxp.cpp +++ b/src/devices/bus/electron/romboxp.cpp @@ -80,6 +80,8 @@ ioport_constructor electron_romboxp_device::device_input_ports() const void electron_romboxp_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)); + /* printer */ CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->busy_handler().set([this](int state) { m_centronics_busy = state; }); @@ -98,10 +100,10 @@ void electron_romboxp_device::device_add_mconfig(machine_config &config) /* cartridges */ ELECTRON_CARTSLOT(config, m_cart[0], DERIVED_CLOCK(1, 1), electron_cart, nullptr); // ROM SLOT 0/1 - 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); // ROM SLOT 2/3 - 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)); } @@ -121,6 +123,7 @@ const tiny_rom_entry *electron_romboxp_device::device_rom_region() const electron_romboxp_device::electron_romboxp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ELECTRON_ROMBOXP, tag, owner, clock) , device_electron_expansion_interface(mconfig, *this) + , m_irqs(*this, "irqs") , m_exp_rom(*this, "exp_rom") , m_rom(*this, "rom%u", 1) , m_cart(*this, "cart%u", 1) diff --git a/src/devices/bus/electron/romboxp.h b/src/devices/bus/electron/romboxp.h index 10b3ddfd96f..62b2124c913 100644 --- a/src/devices/bus/electron/romboxp.h +++ b/src/devices/bus/electron/romboxp.h @@ -13,6 +13,7 @@ #define MAME_BUS_ELECTRON_ROMBOXP_H #include "exp.h" +#include "machine/input_merger.h" #include "bus/centronics/ctronics.h" #include "bus/electron/cart/slot.h" #include "bus/generic/slot.h" @@ -50,6 +51,7 @@ private: DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom4_load) { return load_rom(image, m_rom[3]); } + required_device m_irqs; required_memory_region m_exp_rom; required_device_array m_rom; required_device_array m_cart; -- cgit v1.2.3