From 107ebac287ade96946d11ef3fd2c05f283adc30c Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 2 Jan 2018 08:54:58 -0500 Subject: [PATCH] bml3bus: Remove firstcpu usage (nw) --- src/devices/bus/bml3/bml3bus.cpp | 6 ++---- src/devices/bus/bml3/bml3bus.h | 6 ++++-- src/devices/bus/bml3/bml3kanji.cpp | 2 +- src/devices/bus/bml3/bml3mp1802.cpp | 2 +- src/devices/bus/bml3/bml3mp1805.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/devices/bus/bml3/bml3bus.cpp b/src/devices/bus/bml3/bml3bus.cpp index fc427756876..5eed3140a52 100644 --- a/src/devices/bus/bml3/bml3bus.cpp +++ b/src/devices/bus/bml3/bml3bus.cpp @@ -97,7 +97,7 @@ DEFINE_DEVICE_TYPE(BML3BUS, bml3bus_device, "bml3bus", "Hitachi MB-6890 Bus") void bml3bus_device::static_set_cputag(device_t &device, const char *tag) { bml3bus_device &bml3bus = downcast(device); - bml3bus.m_cputag = tag; + bml3bus.m_maincpu.set_tag(tag); } //************************************************************************** @@ -115,7 +115,7 @@ bml3bus_device::bml3bus_device(const machine_config &mconfig, const char *tag, d bml3bus_device::bml3bus_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_maincpu(*this, finder_base::DUMMY_TAG), m_out_nmi_cb(*this), m_out_irq_cb(*this), m_out_firq_cb(*this), @@ -128,8 +128,6 @@ bml3bus_device::bml3bus_device(const machine_config &mconfig, device_type type, void bml3bus_device::device_start() { - m_maincpu = machine().device(m_cputag); - // resolve callbacks m_out_nmi_cb.resolve_safe(); m_out_irq_cb.resolve_safe(); diff --git a/src/devices/bus/bml3/bml3bus.h b/src/devices/bus/bml3/bml3bus.h index 32046d40f57..bd1de270af2 100644 --- a/src/devices/bus/bml3/bml3bus.h +++ b/src/devices/bus/bml3/bml3bus.h @@ -21,7 +21,7 @@ //************************************************************************** #define MCFG_BML3BUS_CPU(_cputag) \ - bml3bus_device::static_set_cputag(*device, _cputag); + bml3bus_device::static_set_cputag(*device, "^" _cputag); #define MCFG_BML3BUS_OUT_NMI_CB(_devcb) \ devcb = &bml3bus_device::set_out_nmi_callback(*device, DEVCB_##_devcb); @@ -99,6 +99,8 @@ public: DECLARE_WRITE_LINE_MEMBER( irq_w ); DECLARE_WRITE_LINE_MEMBER( firq_w ); + address_space &space() const { return m_maincpu->space(AS_PROGRAM); } + protected: bml3bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -107,7 +109,7 @@ protected: virtual void device_reset() override; // internal state - cpu_device *m_maincpu; + required_device m_maincpu; devcb_write_line m_out_nmi_cb; devcb_write_line m_out_irq_cb; diff --git a/src/devices/bus/bml3/bml3kanji.cpp b/src/devices/bus/bml3/bml3kanji.cpp index a7de6108a44..375dcd7becf 100644 --- a/src/devices/bus/bml3/bml3kanji.cpp +++ b/src/devices/bus/bml3/bml3kanji.cpp @@ -78,7 +78,7 @@ void bml3bus_kanji_device::device_start() m_rom = memregion(KANJI_ROM_REGION)->base(); // install into memory - address_space &space_prg = machine().firstcpu->space(AS_PROGRAM); + address_space &space_prg = m_bml3bus->space(); space_prg.install_readwrite_handler(0xff75, 0xff76, read8_delegate( FUNC(bml3bus_kanji_device::bml3_kanji_r), this), write8_delegate(FUNC(bml3bus_kanji_device::bml3_kanji_w), this) ); } diff --git a/src/devices/bus/bml3/bml3mp1802.cpp b/src/devices/bus/bml3/bml3mp1802.cpp index 7a9b834858a..25c53e2181f 100644 --- a/src/devices/bus/bml3/bml3mp1802.cpp +++ b/src/devices/bus/bml3/bml3mp1802.cpp @@ -125,7 +125,7 @@ void bml3bus_mp1802_device::device_start() m_rom = memregion(MP1802_ROM_REGION)->base(); // install into memory - address_space &space_prg = machine().firstcpu->space(AS_PROGRAM); + address_space &space_prg = m_bml3bus->space(); space_prg.install_readwrite_handler(0xff00, 0xff03, read8_delegate(FUNC(mb8866_device::read),(mb8866_device*)m_fdc), write8_delegate(FUNC(mb8866_device::write),(mb8866_device*)m_fdc)); space_prg.install_readwrite_handler(0xff04, 0xff04, read8_delegate(FUNC(bml3bus_mp1802_device::bml3_mp1802_r), this), write8_delegate(FUNC(bml3bus_mp1802_device::bml3_mp1802_w), this)); // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work... diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp index 46e24a39e57..961f008c838 100644 --- a/src/devices/bus/bml3/bml3mp1805.cpp +++ b/src/devices/bus/bml3/bml3mp1805.cpp @@ -152,7 +152,7 @@ void bml3bus_mp1805_device::device_start() m_rom = memregion(MP1805_ROM_REGION)->base(); // install into memory - address_space &space_prg = machine().firstcpu->space(AS_PROGRAM); + address_space &space_prg = m_bml3bus->space(); space_prg.install_readwrite_handler(0xff18, 0xff1f, read8_delegate( FUNC(mc6843_device::read), (mc6843_device*)m_mc6843), write8_delegate(FUNC(mc6843_device::write), (mc6843_device*)m_mc6843) ); space_prg.install_readwrite_handler(0xff20, 0xff20, read8_delegate( FUNC(bml3bus_mp1805_device::bml3_mp1805_r), this), write8_delegate(FUNC(bml3bus_mp1805_device::bml3_mp1805_w), this) ); // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work...