summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-08-17 16:37:27 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-08-17 16:37:29 -0400
commitd607a44c10bc469ba47d05b0663afa3b96331e6c (patch)
tree39c5f6c85d1127ea3ee104738aeab0c06758f09c
parent2da06d1303ee76e32690b5b881a16af05343363d (diff)
econet: Eliminate machine().device and hardcoded bus tag (nw)
-rw-r--r--src/devices/bus/acorn/system/econet.cpp4
-rw-r--r--src/devices/bus/econet/econet.cpp3
-rw-r--r--src/devices/bus/econet/econet.h18
-rw-r--r--src/mame/drivers/accomm.cpp4
-rw-r--r--src/mame/drivers/bbc.cpp12
5 files changed, 17 insertions, 24 deletions
diff --git a/src/devices/bus/acorn/system/econet.cpp b/src/devices/bus/acorn/system/econet.cpp
index f8e2c6f0ce4..261fb4261a1 100644
--- a/src/devices/bus/acorn/system/econet.cpp
+++ b/src/devices/bus/acorn/system/econet.cpp
@@ -35,9 +35,7 @@ void acorn_econet_device::device_add_mconfig(machine_config &config)
m_econet->clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w));
m_econet->data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx));
- econet_slot_device &slot(ECONET_SLOT(config, "econet254", 0));
- econet_devices(slot);
- slot.set_slot(254);
+ ECONET_SLOT(config, "econet254", m_econet, econet_devices).set_slot(254);
}
//**************************************************************************
diff --git a/src/devices/bus/econet/econet.cpp b/src/devices/bus/econet/econet.cpp
index 63d30931823..c027614f317 100644
--- a/src/devices/bus/econet/econet.cpp
+++ b/src/devices/bus/econet/econet.cpp
@@ -57,7 +57,7 @@ device_econet_interface::device_econet_interface(const machine_config &mconfig,
econet_slot_device::econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, ECONET_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
- m_address(0), m_econet(nullptr)
+ m_address(0), m_econet(*this, finder_base::DUMMY_TAG)
{
}
@@ -68,7 +68,6 @@ econet_slot_device::econet_slot_device(const machine_config &mconfig, const char
void econet_slot_device::device_start()
{
- m_econet = machine().device<econet_device>(ECONET_TAG);
device_econet_interface *dev = dynamic_cast<device_econet_interface *>(get_card_device());
if (dev) m_econet->add_device(get_card_device(), m_address);
}
diff --git a/src/devices/bus/econet/econet.h b/src/devices/bus/econet/econet.h
index dd92811e28b..baecd8df67a 100644
--- a/src/devices/bus/econet/econet.h
+++ b/src/devices/bus/econet/econet.h
@@ -15,13 +15,6 @@
//**************************************************************************
-// MACROS / CONSTANTS
-//**************************************************************************
-
-#define ECONET_TAG "econet"
-
-
-//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -95,16 +88,25 @@ public:
// construction/destruction
econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <typename T, typename U>
+ econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&econet_tag, U &&devs)
+ : econet_slot_device(mconfig, tag, owner, 0U)
+ {
+ set_econet_tag(std::forward<T>(econet_tag));
+ devs(*this);
+ }
+
// device-level overrides
virtual void device_start() override;
// inline configuration
+ template <typename T> void set_econet_tag(T &&tag) { m_econet.set_tag(std::forward<T>(tag)); }
void set_slot(int address) { m_address = address; }
private:
// configuration
uint8_t m_address;
- econet_device *m_econet;
+ required_device<econet_device> m_econet;
};
diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp
index 37ed8a7c919..80e5efc26c1 100644
--- a/src/mame/drivers/accomm.cpp
+++ b/src/mame/drivers/accomm.cpp
@@ -875,9 +875,7 @@ void accomm_state::accomm(machine_config &config)
econet.clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w));
econet.data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx));
- econet_slot_device &econet_slot(ECONET_SLOT(config, "econet254", 0));
- econet_devices(econet_slot);
- econet_slot.set_slot(254);
+ ECONET_SLOT(config, "econet254", "econet", econet_devices).set_slot(254);
/* printer */
centronics_device &centronics(CENTRONICS(config, "centronics", centronics_devices, "printer"));
diff --git a/src/mame/drivers/bbc.cpp b/src/mame/drivers/bbc.cpp
index 8440ba4287d..a56ba806dee 100644
--- a/src/mame/drivers/bbc.cpp
+++ b/src/mame/drivers/bbc.cpp
@@ -963,7 +963,7 @@ void bbc_state::bbcb(machine_config &config)
/* econet */
MC6854(config, m_adlc);
- m_adlc->out_txd_cb().set(ECONET_TAG, FUNC(econet_device::host_data_w));
+ m_adlc->out_txd_cb().set("econet", FUNC(econet_device::host_data_w));
m_adlc->out_irq_cb().set(FUNC(bbc_state::adlc_irq_w));
econet_device &econet(ECONET(config, "econet", 0));
@@ -971,9 +971,7 @@ void bbc_state::bbcb(machine_config &config)
econet.clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w));
econet.data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx));
- econet_slot_device &econet_slot(ECONET_SLOT(config, "econet254", 0));
- econet_devices(econet_slot);
- econet_slot.set_slot(254);
+ ECONET_SLOT(config, "econet254", "econet", econet_devices).set_slot(254);
/* analogue port */
BBC_ANALOGUE_SLOT(config, m_analog, bbc_analogue_devices, nullptr);
@@ -1432,7 +1430,7 @@ void bbcm_state::bbcm(machine_config &config)
/* econet */
MC6854(config, m_adlc);
- m_adlc->out_txd_cb().set(ECONET_TAG, FUNC(econet_device::host_data_w));
+ m_adlc->out_txd_cb().set("econet", FUNC(econet_device::host_data_w));
m_adlc->out_irq_cb().set(FUNC(bbc_state::adlc_irq_w));
econet_device &econet(ECONET(config, "econet", 0));
@@ -1440,9 +1438,7 @@ void bbcm_state::bbcm(machine_config &config)
econet.clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w));
econet.data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx));
- econet_slot_device &econet_slot(ECONET_SLOT(config, "econet254", 0));
- econet_devices(econet_slot);
- econet_slot.set_slot(254);
+ ECONET_SLOT(config, "econet254", "econet", econet_devices).set_slot(254);
/* analogue port */
BBC_ANALOGUE_SLOT(config, m_analog, bbc_analogue_devices, nullptr);