multibus: restore bus/slot structural flexibility

This commit is contained in:
Patrick Mackinlay 2025-02-11 14:15:21 +07:00
parent f2ba762e0a
commit cf67936396
9 changed files with 59 additions and 53 deletions

View File

@ -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) 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_t(mconfig, MULTIBUS_SLOT, tag, owner, clock)
, device_slot_interface(mconfig, *this) , 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() void device_multibus_interface::interface_config_complete()
{ {
if (device().owner() && device().owner()->owner()) if (device().owner())
{ {
multibus_device *const bus = downcast<multibus_device *>(device().owner()->owner()); m_bus.set_tag(downcast<multibus_slot_device &>(*device().owner()).bus());
multibus_device &bus(*m_bus.lookup());
m_bus.set_tag(*bus);
// route incoming interrupt requests to all cards // route incoming interrupt requests to all cards
bus->int_callback<0>().append([this](int state) { m_int[0](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<1>().append([this](int state) { m_int[1](state); });
bus->int_callback<2>().append([this](int state) { m_int[2](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<3>().append([this](int state) { m_int[3](state); });
bus->int_callback<4>().append([this](int state) { m_int[4](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<5>().append([this](int state) { m_int[5](state); });
bus->int_callback<6>().append([this](int state) { m_int[6](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<7>().append([this](int state) { m_int[7](state); });
} }
} }

View File

@ -123,18 +123,25 @@ class multibus_slot_device
public: public:
multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = DERIVED_CLOCK(1, 1)); multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = DERIVED_CLOCK(1, 1));
template <typename T> template <typename T, typename U>
multibus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, char const *default_option, bool const fixed) 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)) : multibus_slot_device(mconfig, tag, owner, DERIVED_CLOCK(1,1))
{ {
m_bus.set_tag(std::forward<T>(bus_tag));
option_reset(); option_reset();
slot_options(*this); slot_options(*this);
set_default_option(default_option); set_default_option(default_option);
set_fixed(fixed); set_fixed(fixed);
} }
auto bus() const { return m_bus; }
protected: protected:
virtual void device_start() override ATTR_COLD; virtual void device_start() override ATTR_COLD;
private:
required_device<multibus_device> m_bus;
}; };
class device_multibus_interface : public device_interface class device_multibus_interface : public device_interface

View File

@ -61,7 +61,7 @@ class labtam_state : public driver_device
public: public:
labtam_state(machine_config const &mconfig, device_type type, char const *tag) labtam_state(machine_config const &mconfig, device_type type, char const *tag)
: driver_device(mconfig, type, 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(config, m_bus, 10_MHz_XTAL); // FIXME: clock driven by bus master
MULTIBUS_SLOT(config, "slot:0", labtam_cards, nullptr, false); MULTIBUS_SLOT(config, "slot0", m_bus, labtam_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:1", labtam_cards, nullptr, false); MULTIBUS_SLOT(config, "slot1", m_bus, labtam_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:2", labtam_cards, nullptr, false); MULTIBUS_SLOT(config, "slot2", m_bus, labtam_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:3", labtam_cards, "labtam_8086cpu", false); MULTIBUS_SLOT(config, "slot3", m_bus, labtam_cards, "labtam_8086cpu", false);
MULTIBUS_SLOT(config, "slot:4", labtam_cards, "labtam_vducom", false); MULTIBUS_SLOT(config, "slot4", m_bus, labtam_cards, "labtam_vducom", false);
MULTIBUS_SLOT(config, "slot:5", labtam_cards, "labtam_z80sbc", false); MULTIBUS_SLOT(config, "slot5", m_bus, labtam_cards, "labtam_z80sbc", false);
} }
ROM_START(labtam) ROM_START(labtam)

View File

@ -188,8 +188,8 @@ imds2_state::imds2_state(const machine_config &mconfig, device_type type, const
m_ipcctrl(*this, "ipcctrl"), m_ipcctrl(*this, "ipcctrl"),
m_serial(*this, "serial%u", 0U), m_serial(*this, "serial%u", 0U),
m_ioc(*this, "ioc"), m_ioc(*this, "ioc"),
m_bus(*this, "slot"), m_bus(*this, "bus"),
m_slot(*this, "slot:1"), m_slot(*this, "slot1"),
m_ram(*this, "ram"), m_ram(*this, "ram"),
m_boot(*this, "boot") m_boot(*this, "boot")
{ {
@ -310,7 +310,7 @@ void imds2_state::imds2(machine_config &config)
MULTIBUS(config, m_bus, 9'830'400); MULTIBUS(config, m_bus, 9'830'400);
m_bus->xack_cb().set(FUNC(imds2_state::xack)); 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) void imds2_state::xack(int state)

View File

@ -29,7 +29,7 @@ class isbc660_state : public driver_device
public: public:
isbc660_state(machine_config const &mconfig, device_type type, char const *tag) isbc660_state(machine_config const &mconfig, device_type type, char const *tag)
: driver_device(mconfig, type, 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(config, m_bus, 10_MHz_XTAL); // FIXME: clock driven by bus master
MULTIBUS_SLOT(config, "slot:1", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot1", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:2", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot2", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:3", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot3", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:4", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot4", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:5", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot5", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:6", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot6", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:7", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot7", m_bus, isbc660_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:8", isbc660_cards, nullptr, false); MULTIBUS_SLOT(config, "slot8", m_bus, isbc660_cards, nullptr, false);
} }
ROM_START(isbc660) ROM_START(isbc660)

View File

@ -53,7 +53,7 @@ class a7150_state : public driver_device
public: public:
a7150_state(const machine_config &mconfig, device_type type, const char *tag) a7150_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) : driver_device(mconfig, type, tag)
, m_bus(*this, "slot") , m_bus(*this, "bus")
, m_maincpu(*this, "maincpu") , m_maincpu(*this, "maincpu")
, m_uart8251(*this, "uart8251") , m_uart8251(*this, "uart8251")
, m_pit8253(*this, "pit8253") , 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<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<6>().set(m_pic8259, FUNC(pic8259_device::ir6_w));
m_bus->int_callback<7>().set(m_pic8259, FUNC(pic8259_device::ir7_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 // ZRE board

View File

@ -39,7 +39,7 @@ class pcmx2_state : public driver_device
public: public:
pcmx2_state(machine_config const &mconfig, device_type type, char const *tag) pcmx2_state(machine_config const &mconfig, device_type type, char const *tag)
: driver_device(mconfig, type, 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(config, m_bus, 20_MHz_XTAL / 2);
MULTIBUS_SLOT(config, "slot:1", pcmx2_cards, nullptr, false); // DTC 86-1 or Storager MULTIBUS_SLOT(config, "slot1", m_bus, pcmx2_cards, nullptr, false); // DTC 86-1 or Storager
MULTIBUS_SLOT(config, "slot:2", pcmx2_cards, nullptr, false); MULTIBUS_SLOT(config, "slot2", m_bus, pcmx2_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:3", pcmx2_cards, "serad", false); MULTIBUS_SLOT(config, "slot3", m_bus, pcmx2_cards, "serad", false);
MULTIBUS_SLOT(config, "slot:4", pcmx2_cards, nullptr, false); MULTIBUS_SLOT(config, "slot4", m_bus, pcmx2_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:5", pcmx2_cards, nullptr, false); MULTIBUS_SLOT(config, "slot5", m_bus, pcmx2_cards, nullptr, false);
MULTIBUS_SLOT(config, "slot:6", pcmx2_cards, "cpuap", false); MULTIBUS_SLOT(config, "slot6", m_bus, pcmx2_cards, "cpuap", false);
MULTIBUS_SLOT(config, "slot:7", pcmx2_cards, nullptr, false); // MEM MULTIBUS_SLOT(config, "slot7", m_bus, pcmx2_cards, nullptr, false); // MEM
MULTIBUS_SLOT(config, "slot:8", pcmx2_cards, nullptr, false); MULTIBUS_SLOT(config, "slot8", m_bus, pcmx2_cards, nullptr, false);
} }
ROM_START(pcmx2) ROM_START(pcmx2)

View File

@ -76,7 +76,7 @@ class sun1_state : public driver_device
public: public:
sun1_state(const machine_config &mconfig, device_type type, const char *tag) sun1_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, 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); MULTIBUS(config, m_bus, 19.6608_MHz_XTAL / 2);
// slot 1 is physically located at top, only slots 1-3 have P2 // 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, "slot1", m_bus, sun1_cards, nullptr, false); // memory expansion 2
MULTIBUS_SLOT(config, "slot:2", sun1_cards, nullptr, false); // memory expansion 1 MULTIBUS_SLOT(config, "slot2", m_bus, sun1_cards, nullptr, false); // memory expansion 1
MULTIBUS_SLOT(config, "slot:3", sun1_cards, "sun1cpu", false); // processor MULTIBUS_SLOT(config, "slot3", m_bus, sun1_cards, "sun1cpu", false); // processor
MULTIBUS_SLOT(config, "slot:4", sun1_cards, nullptr, false); // bus master 1 MULTIBUS_SLOT(config, "slot4", m_bus, sun1_cards, nullptr, false); // bus master 1
MULTIBUS_SLOT(config, "slot:5", sun1_cards, nullptr, false); // bus master 2 MULTIBUS_SLOT(config, "slot5", m_bus, sun1_cards, nullptr, false); // bus master 2
MULTIBUS_SLOT(config, "slot:6", sun1_cards, nullptr, false); // multibus memory, optional MULTIBUS_SLOT(config, "slot6", m_bus, sun1_cards, nullptr, false); // multibus memory, optional
MULTIBUS_SLOT(config, "slot:7", sun1_cards, nullptr, false); // graphics MULTIBUS_SLOT(config, "slot7", m_bus, sun1_cards, nullptr, false); // graphics
} }
ROM_START(sun1) ROM_START(sun1)

View File

@ -14,7 +14,6 @@ class sun1mmu_device
{ {
public: public:
template <unsigned N, typename T> void set_space(T &&tag, int spacenum) { m_space[N].set_tag(std::forward<T>(tag), spacenum); } template <unsigned N, typename T> void set_space(T &&tag, int spacenum) { m_space[N].set_tag(std::forward<T>(tag), spacenum); }
template <unsigned N> void set_space(device_t &base, char const *tag, int spacenum) { m_space[N].set_tag(base, tag, spacenum); }
enum error_type : unsigned enum error_type : unsigned
{ {