From cf679363963f8981237c06f4dbdfc45802d1f40e Mon Sep 17 00:00:00 2001 From: Patrick Mackinlay Date: Tue, 11 Feb 2025 14:15:21 +0700 Subject: [PATCH] multibus: restore bus/slot structural flexibility --- src/devices/bus/multibus/multibus.cpp | 24 ++++++++++++------------ src/devices/bus/multibus/multibus.h | 11 +++++++++-- src/mame/ausnz/labtam.cpp | 14 +++++++------- src/mame/intel/imds2.cpp | 6 +++--- src/mame/intel/isbc660.cpp | 18 +++++++++--------- src/mame/robotron/a7150.cpp | 4 ++-- src/mame/siemens/pcmx2.cpp | 18 +++++++++--------- src/mame/sun/sun1.cpp | 16 ++++++++-------- src/mame/sun/sun1_mmu.h | 1 - 9 files changed, 59 insertions(+), 53 deletions(-) diff --git a/src/devices/bus/multibus/multibus.cpp b/src/devices/bus/multibus/multibus.cpp index 07f5785030b..a53aaaf753b 100644 --- a/src/devices/bus/multibus/multibus.cpp +++ b/src/devices/bus/multibus/multibus.cpp @@ -56,6 +56,7 @@ void multibus_device::pio_map(address_map &map) multibus_slot_device::multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : device_t(mconfig, MULTIBUS_SLOT, tag, owner, clock) , device_slot_interface(mconfig, *this) + , m_bus(*this, finder_base::DUMMY_TAG) { } @@ -72,21 +73,20 @@ device_multibus_interface::device_multibus_interface(machine_config const &mconf void device_multibus_interface::interface_config_complete() { - if (device().owner() && device().owner()->owner()) + if (device().owner()) { - multibus_device *const bus = downcast(device().owner()->owner()); - - m_bus.set_tag(*bus); + m_bus.set_tag(downcast(*device().owner()).bus()); + multibus_device &bus(*m_bus.lookup()); // route incoming interrupt requests to all cards - bus->int_callback<0>().append([this](int state) { m_int[0](state); }); - bus->int_callback<1>().append([this](int state) { m_int[1](state); }); - bus->int_callback<2>().append([this](int state) { m_int[2](state); }); - bus->int_callback<3>().append([this](int state) { m_int[3](state); }); - bus->int_callback<4>().append([this](int state) { m_int[4](state); }); - bus->int_callback<5>().append([this](int state) { m_int[5](state); }); - bus->int_callback<6>().append([this](int state) { m_int[6](state); }); - bus->int_callback<7>().append([this](int state) { m_int[7](state); }); + bus.int_callback<0>().append([this](int state) { m_int[0](state); }); + bus.int_callback<1>().append([this](int state) { m_int[1](state); }); + bus.int_callback<2>().append([this](int state) { m_int[2](state); }); + bus.int_callback<3>().append([this](int state) { m_int[3](state); }); + bus.int_callback<4>().append([this](int state) { m_int[4](state); }); + bus.int_callback<5>().append([this](int state) { m_int[5](state); }); + bus.int_callback<6>().append([this](int state) { m_int[6](state); }); + bus.int_callback<7>().append([this](int state) { m_int[7](state); }); } } diff --git a/src/devices/bus/multibus/multibus.h b/src/devices/bus/multibus/multibus.h index 4ad4b6d5763..3260ebac5ea 100644 --- a/src/devices/bus/multibus/multibus.h +++ b/src/devices/bus/multibus/multibus.h @@ -123,18 +123,25 @@ class multibus_slot_device public: multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = DERIVED_CLOCK(1, 1)); - template - multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, char const *default_option, bool const fixed) + template + multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&bus_tag, U &&slot_options, char const *default_option, bool const fixed) : multibus_slot_device(mconfig, tag, owner, DERIVED_CLOCK(1,1)) { + m_bus.set_tag(std::forward(bus_tag)); + option_reset(); slot_options(*this); set_default_option(default_option); set_fixed(fixed); } + auto bus() const { return m_bus; } + protected: virtual void device_start() override ATTR_COLD; + +private: + required_device m_bus; }; class device_multibus_interface : public device_interface diff --git a/src/mame/ausnz/labtam.cpp b/src/mame/ausnz/labtam.cpp index 96da6030737..0ae6cb93c76 100644 --- a/src/mame/ausnz/labtam.cpp +++ b/src/mame/ausnz/labtam.cpp @@ -61,7 +61,7 @@ class labtam_state : public driver_device public: labtam_state(machine_config const &mconfig, device_type type, char const *tag) : driver_device(mconfig, type, tag) - , m_bus(*this, "slot") + , m_bus(*this, "bus") { } @@ -98,12 +98,12 @@ void labtam_state::labtam(machine_config &config) { MULTIBUS(config, m_bus, 10_MHz_XTAL); // FIXME: clock driven by bus master - MULTIBUS_SLOT(config, "slot:0", labtam_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:1", labtam_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:2", labtam_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:3", labtam_cards, "labtam_8086cpu", false); - MULTIBUS_SLOT(config, "slot:4", labtam_cards, "labtam_vducom", false); - MULTIBUS_SLOT(config, "slot:5", labtam_cards, "labtam_z80sbc", false); + MULTIBUS_SLOT(config, "slot0", m_bus, labtam_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot1", m_bus, labtam_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot2", m_bus, labtam_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot3", m_bus, labtam_cards, "labtam_8086cpu", false); + MULTIBUS_SLOT(config, "slot4", m_bus, labtam_cards, "labtam_vducom", false); + MULTIBUS_SLOT(config, "slot5", m_bus, labtam_cards, "labtam_z80sbc", false); } ROM_START(labtam) diff --git a/src/mame/intel/imds2.cpp b/src/mame/intel/imds2.cpp index 8a229ca8946..78b03d12e26 100644 --- a/src/mame/intel/imds2.cpp +++ b/src/mame/intel/imds2.cpp @@ -188,8 +188,8 @@ imds2_state::imds2_state(const machine_config &mconfig, device_type type, const m_ipcctrl(*this, "ipcctrl"), m_serial(*this, "serial%u", 0U), m_ioc(*this, "ioc"), - m_bus(*this, "slot"), - m_slot(*this, "slot:1"), + m_bus(*this, "bus"), + m_slot(*this, "slot1"), m_ram(*this, "ram"), m_boot(*this, "boot") { @@ -310,7 +310,7 @@ void imds2_state::imds2(machine_config &config) MULTIBUS(config, m_bus, 9'830'400); m_bus->xack_cb().set(FUNC(imds2_state::xack)); - MULTIBUS_SLOT(config, m_slot, imds2_cards, nullptr, false); // FIXME: isbc202 + MULTIBUS_SLOT(config, m_slot, m_bus, imds2_cards, nullptr, false); // FIXME: isbc202 } void imds2_state::xack(int state) diff --git a/src/mame/intel/isbc660.cpp b/src/mame/intel/isbc660.cpp index 0b4a675883e..e258b92ed65 100644 --- a/src/mame/intel/isbc660.cpp +++ b/src/mame/intel/isbc660.cpp @@ -29,7 +29,7 @@ class isbc660_state : public driver_device public: isbc660_state(machine_config const &mconfig, device_type type, char const *tag) : driver_device(mconfig, type, tag) - , m_bus(*this, "slot") + , m_bus(*this, "bus") { } @@ -63,14 +63,14 @@ void isbc660_state::isbc660(machine_config &config) { MULTIBUS(config, m_bus, 10_MHz_XTAL); // FIXME: clock driven by bus master - MULTIBUS_SLOT(config, "slot:1", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:2", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:3", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:4", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:5", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:6", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:7", isbc660_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:8", isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot1", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot2", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot3", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot4", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot5", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot6", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot7", m_bus, isbc660_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot8", m_bus, isbc660_cards, nullptr, false); } ROM_START(isbc660) diff --git a/src/mame/robotron/a7150.cpp b/src/mame/robotron/a7150.cpp index e244b0691ab..0859c89cff5 100644 --- a/src/mame/robotron/a7150.cpp +++ b/src/mame/robotron/a7150.cpp @@ -53,7 +53,7 @@ class a7150_state : public driver_device public: a7150_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - , m_bus(*this, "slot") + , m_bus(*this, "bus") , m_maincpu(*this, "maincpu") , m_uart8251(*this, "uart8251") , m_pit8253(*this, "pit8253") @@ -157,7 +157,7 @@ void a7150_state::a7150(machine_config &config) m_bus->int_callback<1>().set(m_pic8259, FUNC(pic8259_device::ir1_w)); m_bus->int_callback<6>().set(m_pic8259, FUNC(pic8259_device::ir6_w)); m_bus->int_callback<7>().set(m_pic8259, FUNC(pic8259_device::ir7_w)); - MULTIBUS_SLOT(config, "slot:1", a7150_cards, "kgs", false); + MULTIBUS_SLOT(config, "slot1", m_bus, a7150_cards, "kgs", false); // ZRE board diff --git a/src/mame/siemens/pcmx2.cpp b/src/mame/siemens/pcmx2.cpp index 753f7bf4ed9..c603d9669ff 100644 --- a/src/mame/siemens/pcmx2.cpp +++ b/src/mame/siemens/pcmx2.cpp @@ -39,7 +39,7 @@ class pcmx2_state : public driver_device public: pcmx2_state(machine_config const &mconfig, device_type type, char const *tag) : driver_device(mconfig, type, tag) - , m_bus(*this, "slot") + , m_bus(*this, "bus") { } @@ -75,14 +75,14 @@ void pcmx2_state::pcmx2(machine_config &config) { MULTIBUS(config, m_bus, 20_MHz_XTAL / 2); - MULTIBUS_SLOT(config, "slot:1", pcmx2_cards, nullptr, false); // DTC 86-1 or Storager - MULTIBUS_SLOT(config, "slot:2", pcmx2_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:3", pcmx2_cards, "serad", false); - MULTIBUS_SLOT(config, "slot:4", pcmx2_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:5", pcmx2_cards, nullptr, false); - MULTIBUS_SLOT(config, "slot:6", pcmx2_cards, "cpuap", false); - MULTIBUS_SLOT(config, "slot:7", pcmx2_cards, nullptr, false); // MEM - MULTIBUS_SLOT(config, "slot:8", pcmx2_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot1", m_bus, pcmx2_cards, nullptr, false); // DTC 86-1 or Storager + MULTIBUS_SLOT(config, "slot2", m_bus, pcmx2_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot3", m_bus, pcmx2_cards, "serad", false); + MULTIBUS_SLOT(config, "slot4", m_bus, pcmx2_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot5", m_bus, pcmx2_cards, nullptr, false); + MULTIBUS_SLOT(config, "slot6", m_bus, pcmx2_cards, "cpuap", false); + MULTIBUS_SLOT(config, "slot7", m_bus, pcmx2_cards, nullptr, false); // MEM + MULTIBUS_SLOT(config, "slot8", m_bus, pcmx2_cards, nullptr, false); } ROM_START(pcmx2) diff --git a/src/mame/sun/sun1.cpp b/src/mame/sun/sun1.cpp index b3ce3ee78f4..c8779430e71 100644 --- a/src/mame/sun/sun1.cpp +++ b/src/mame/sun/sun1.cpp @@ -76,7 +76,7 @@ class sun1_state : public driver_device public: sun1_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - , m_bus(*this, "slot") + , m_bus(*this, "bus") { } @@ -108,13 +108,13 @@ void sun1_state::sun1(machine_config &config) MULTIBUS(config, m_bus, 19.6608_MHz_XTAL / 2); // slot 1 is physically located at top, only slots 1-3 have P2 - MULTIBUS_SLOT(config, "slot:1", sun1_cards, nullptr, false); // memory expansion 2 - MULTIBUS_SLOT(config, "slot:2", sun1_cards, nullptr, false); // memory expansion 1 - MULTIBUS_SLOT(config, "slot:3", sun1_cards, "sun1cpu", false); // processor - MULTIBUS_SLOT(config, "slot:4", sun1_cards, nullptr, false); // bus master 1 - MULTIBUS_SLOT(config, "slot:5", sun1_cards, nullptr, false); // bus master 2 - MULTIBUS_SLOT(config, "slot:6", sun1_cards, nullptr, false); // multibus memory, optional - MULTIBUS_SLOT(config, "slot:7", sun1_cards, nullptr, false); // graphics + MULTIBUS_SLOT(config, "slot1", m_bus, sun1_cards, nullptr, false); // memory expansion 2 + MULTIBUS_SLOT(config, "slot2", m_bus, sun1_cards, nullptr, false); // memory expansion 1 + MULTIBUS_SLOT(config, "slot3", m_bus, sun1_cards, "sun1cpu", false); // processor + MULTIBUS_SLOT(config, "slot4", m_bus, sun1_cards, nullptr, false); // bus master 1 + MULTIBUS_SLOT(config, "slot5", m_bus, sun1_cards, nullptr, false); // bus master 2 + MULTIBUS_SLOT(config, "slot6", m_bus, sun1_cards, nullptr, false); // multibus memory, optional + MULTIBUS_SLOT(config, "slot7", m_bus, sun1_cards, nullptr, false); // graphics } ROM_START(sun1) diff --git a/src/mame/sun/sun1_mmu.h b/src/mame/sun/sun1_mmu.h index 12e0e98c06b..0177da8fe76 100644 --- a/src/mame/sun/sun1_mmu.h +++ b/src/mame/sun/sun1_mmu.h @@ -14,7 +14,6 @@ class sun1mmu_device { public: template void set_space(T &&tag, int spacenum) { m_space[N].set_tag(std::forward(tag), spacenum); } - template void set_space(device_t &base, char const *tag, int spacenum) { m_space[N].set_tag(base, tag, spacenum); } enum error_type : unsigned {