From 3041d13692eb28180d7f9e22818d842c54ec4ccd Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 25 Feb 2019 21:12:30 -0500 Subject: bus/apricot/expansion: Replace CPU finders with address space finders (nw) --- src/devices/bus/apricot/expansion/expansion.cpp | 25 +++++-------------------- src/devices/bus/apricot/expansion/expansion.h | 25 +++++++++---------------- src/mame/drivers/apricot.cpp | 6 +++++- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/devices/bus/apricot/expansion/expansion.cpp b/src/devices/bus/apricot/expansion/expansion.cpp index 98141860782..5a89c9a8868 100644 --- a/src/devices/bus/apricot/expansion/expansion.cpp +++ b/src/devices/bus/apricot/expansion/expansion.cpp @@ -59,18 +59,16 @@ DEFINE_DEVICE_TYPE(APRICOT_EXPANSION_BUS, apricot_expansion_bus_device, "apricot apricot_expansion_bus_device::apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, APRICOT_EXPANSION_BUS, tag, owner, clock), - m_program(nullptr), - m_io(nullptr), - m_program_iop(nullptr), - m_io_iop(nullptr), + m_program(*this, finder_base::DUMMY_TAG, -1), + m_io(*this, finder_base::DUMMY_TAG, -1), + m_program_iop(*this, finder_base::DUMMY_TAG, -1), + m_io_iop(*this, finder_base::DUMMY_TAG, -1), m_dma1_handler(*this), m_dma2_handler(*this), m_ext1_handler(*this), m_ext2_handler(*this), m_int2_handler(*this), - m_int3_handler(*this), - m_cpu(*this, finder_base::DUMMY_TAG), - m_iop(*this, finder_base::DUMMY_TAG) + m_int3_handler(*this) { } @@ -98,19 +96,6 @@ void apricot_expansion_bus_device::device_start() m_int3_handler.resolve_safe(); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void apricot_expansion_bus_device::device_reset() -{ - m_program = &m_cpu->space(AS_PROGRAM); - m_io = &m_cpu->space(AS_IO); - - m_program_iop = &m_iop->space(AS_PROGRAM); - m_io_iop = &m_iop->space(AS_IO); -} - //------------------------------------------------- // add_card - add new card to our bus //------------------------------------------------- diff --git a/src/devices/bus/apricot/expansion/expansion.h b/src/devices/bus/apricot/expansion/expansion.h index 4aada9fbd61..93c529f24e3 100644 --- a/src/devices/bus/apricot/expansion/expansion.h +++ b/src/devices/bus/apricot/expansion/expansion.h @@ -89,16 +89,14 @@ class apricot_expansion_bus_device : public device_t { public: // construction/destruction - template - apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag, U &&iop_tag) - : apricot_expansion_bus_device(mconfig, tag, owner, (uint32_t)0) - { - m_cpu.set_tag(std::forward(cpu_tag)); - m_iop.set_tag(std::forward(iop_tag)); - } apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~apricot_expansion_bus_device(); + template void set_program_space(T &&tag, int spacenum) { m_program.set_tag(std::forward(tag), spacenum); } + template void set_io_space(T &&tag, int spacenum) { m_io.set_tag(std::forward(tag), spacenum); } + template void set_program_iop_space(T &&tag, int spacenum) { m_program_iop.set_tag(std::forward(tag), spacenum); } + template void set_io_iop_space(T &&tag, int spacenum) { m_io_iop.set_tag(std::forward(tag), spacenum); } + auto dma1() { return m_dma1_handler.bind(); } auto dma2() { return m_dma2_handler.bind(); } auto ext1() { return m_ext1_handler.bind(); } @@ -129,16 +127,15 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; private: simple_list m_dev; // address spaces we have access to - address_space *m_program; - address_space *m_io; - address_space *m_program_iop; - address_space *m_io_iop; + required_address_space m_program; + required_address_space m_io; + optional_address_space m_program_iop; + optional_address_space m_io_iop; devcb_write_line m_dma1_handler; devcb_write_line m_dma2_handler; @@ -146,10 +143,6 @@ private: devcb_write_line m_ext2_handler; devcb_write_line m_int2_handler; devcb_write_line m_int3_handler; - - // configuration - required_device m_cpu; - required_device m_iop; }; // device type definition diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp index 1ad9b9c15d3..b27900d1abe 100644 --- a/src/mame/drivers/apricot.cpp +++ b/src/mame/drivers/apricot.cpp @@ -473,7 +473,11 @@ void apricot_state::apricot(machine_config &config) SOFTWARE_LIST(config, "flop_list").set_original("apricot_flop"); // expansion bus - APRICOT_EXPANSION_BUS(config, m_exp, m_cpu, m_iop); + APRICOT_EXPANSION_BUS(config, m_exp, 0); + m_exp->set_program_space(m_cpu, AS_PROGRAM); + m_exp->set_io_space(m_cpu, AS_IO); + m_exp->set_program_iop_space(m_iop, AS_PROGRAM); + m_exp->set_io_iop_space(m_iop, AS_IO); m_exp->int2().set(m_pic, FUNC(pic8259_device::ir2_w)); m_exp->int3().set(m_pic, FUNC(pic8259_device::ir3_w)); APRICOT_EXPANSION_SLOT(config, "exp:1", apricot_expansion_cards, nullptr); -- cgit v1.2.3