diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2019-02-26 09:17:30 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2019-02-26 09:19:01 -0500 |
commit | b5758a744aa657c0c080bb29b643b73d79297911 (patch) | |
tree | 9cce3fd9d07d9db606b4ae8b3ae3a7dc4d389b7f /src/devices/bus/nubus | |
parent | e02a5cf1f526385363d874fa6fbe3ffacb217e4e (diff) |
nubus: Use required_address_space rather than old-style CPU lookup (nw)
Diffstat (limited to 'src/devices/bus/nubus')
-rw-r--r-- | src/devices/bus/nubus/nubus.cpp | 56 | ||||
-rw-r--r-- | src/devices/bus/nubus/nubus.h | 7 |
2 files changed, 28 insertions, 35 deletions
diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp index b0fc2a4667d..dc7db80a2ef 100644 --- a/src/devices/bus/nubus/nubus.cpp +++ b/src/devices/bus/nubus/nubus.cpp @@ -70,23 +70,24 @@ nubus_device::nubus_device(const machine_config &mconfig, const char *tag, devic nubus_device::nubus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), - m_maincpu(nullptr), + m_space(*this, finder_base::DUMMY_TAG, -1), m_out_irq9_cb(*this), m_out_irqa_cb(*this), m_out_irqb_cb(*this), m_out_irqc_cb(*this), m_out_irqd_cb(*this), - m_out_irqe_cb(*this), - m_cputag(nullptr) + m_out_irqe_cb(*this) { } + //------------------------------------------------- -// device_start - device-specific startup +// device_resolve_objects - resolve objects that +// may be needed for other devices to set +// initial conditions at start time //------------------------------------------------- -void nubus_device::device_start() +void nubus_device::device_resolve_objects() { - m_maincpu = machine().device<cpu_device>(m_cputag); // resolve callbacks m_out_irq9_cb.resolve_safe(); m_out_irqa_cb.resolve_safe(); @@ -97,10 +98,10 @@ void nubus_device::device_start() } //------------------------------------------------- -// device_reset - device-specific reset +// device_start - device-specific startup //------------------------------------------------- -void nubus_device::device_reset() +void nubus_device::device_start() { } @@ -111,15 +112,14 @@ void nubus_device::add_nubus_card(device_nubus_card_interface *card) void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask) { - m_maincpu = machine().device<cpu_device>(m_cputag); - int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width(); + int buswidth = m_space->data_width(); switch(buswidth) { case 32: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); + m_space->install_readwrite_handler(start, end, rhandler, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask); + m_space->install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -128,15 +128,14 @@ void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhand void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask) { - m_maincpu = machine().device<cpu_device>(m_cputag); - int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width(); + int buswidth = m_space->data_width(); switch(buswidth) { case 32: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); + m_space->install_readwrite_handler(start, end, rhandler, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask); + m_space->install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -145,15 +144,14 @@ void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhan void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhandler, write32_delegate whandler, uint32_t mask) { - m_maincpu = machine().device<cpu_device>(m_cputag); - int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width(); + int buswidth = m_space->data_width(); switch(buswidth) { case 32: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask); + m_space->install_readwrite_handler(start, end, rhandler, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask); + m_space->install_readwrite_handler(start, end, rhandler, whandler, ((uint64_t)mask<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -162,15 +160,14 @@ void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhan void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_delegate rhandler, uint32_t mask) { - m_maincpu = machine().device<cpu_device>(m_cputag); - int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width(); + int buswidth = m_space->data_width(); switch(buswidth) { case 32: - m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, mask); + m_space->install_read_handler(start, end, rhandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, ((uint64_t)mask<<32)|mask); + m_space->install_read_handler(start, end, rhandler, ((uint64_t)mask<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -179,15 +176,14 @@ void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_dele void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_delegate whandler, uint32_t mask) { - m_maincpu = machine().device<cpu_device>(m_cputag); - int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width(); + int buswidth = m_space->data_width(); switch(buswidth) { case 32: - m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, mask); + m_space->install_write_handler(start, end, whandler, mask); break; case 64: - m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, ((uint64_t)mask<<32)|mask); + m_space->install_write_handler(start, end, whandler, ((uint64_t)mask<<32)|mask); break; default: fatalerror("NUBUS: Bus width %d not supported\n", buswidth); @@ -197,9 +193,7 @@ void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_de void nubus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); - m_maincpu = machine().device<cpu_device>(m_cputag); - address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_readwrite_bank(start, end, 0, tag ); + m_space->install_readwrite_bank(start, end, 0, tag); machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); } diff --git a/src/devices/bus/nubus/nubus.h b/src/devices/bus/nubus/nubus.h index 2d42a4edd26..a1b9496fcf8 100644 --- a/src/devices/bus/nubus/nubus.h +++ b/src/devices/bus/nubus/nubus.h @@ -62,7 +62,7 @@ public: ~nubus_device() { m_device_list.detach_all(); } // inline configuration - void set_cputag(const char *tag) { m_cputag = tag; } + template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); } auto out_irq9_callback() { return m_out_irq9_cb.bind(); } auto out_irqa_callback() { return m_out_irqa_cb.bind(); } auto out_irqb_callback() { return m_out_irqb_cb.bind(); } @@ -90,11 +90,11 @@ protected: nubus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides + virtual void device_resolve_objects() override; virtual void device_start() override; - virtual void device_reset() override; // internal state - cpu_device *m_maincpu; + required_address_space m_space; devcb_write_line m_out_irq9_cb; devcb_write_line m_out_irqa_cb; @@ -104,7 +104,6 @@ protected: devcb_write_line m_out_irqe_cb; simple_list<device_nubus_card_interface> m_device_list; - const char *m_cputag; }; |