From 9d1bf83edf614c842c9f02eb43452d6292199c8c Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 2 Jan 2018 09:40:14 -0500 Subject: [PATCH] cbus: Remove machine().firstcpu calls (nw) --- src/devices/bus/cbus/mpu_pc98.cpp | 3 ++- src/devices/bus/cbus/mpu_pc98.h | 1 + src/devices/bus/cbus/pc9801_118.cpp | 10 +++++----- src/devices/bus/cbus/pc9801_118.h | 4 ++-- src/devices/bus/cbus/pc9801_26.cpp | 10 +++++----- src/devices/bus/cbus/pc9801_26.h | 4 ++-- src/devices/bus/cbus/pc9801_86.cpp | 9 +++++---- src/devices/bus/cbus/pc9801_86.h | 4 +++- src/devices/bus/cbus/pc9801_amd98.cpp | 10 +++++----- src/devices/bus/cbus/pc9801_amd98.h | 4 ++-- src/devices/bus/cbus/pc9801_cbus.cpp | 3 ++- src/devices/bus/cbus/pc9801_cbus.h | 7 +++++-- 12 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/devices/bus/cbus/mpu_pc98.cpp b/src/devices/bus/cbus/mpu_pc98.cpp index c471f3169d2..489d5779562 100644 --- a/src/devices/bus/cbus/mpu_pc98.cpp +++ b/src/devices/bus/cbus/mpu_pc98.cpp @@ -56,6 +56,7 @@ MACHINE_CONFIG_END mpu_pc98_device::mpu_pc98_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, MPU_PC98, tag, owner, clock) + , m_bus(*this, DEVICE_SELF_OWNER) , m_mpu401(*this, MPU_CORE_TAG) { } @@ -70,7 +71,7 @@ ADDRESS_MAP_END void mpu_pc98_device::device_start() { - address_space &iospace = machine().firstcpu->space(AS_IO); + address_space &iospace = m_bus->io_space(); iospace.install_device(0xe0d0, 0xe0d3, *this, &mpu_pc98_device::map, 16, 0xffffffffffffffffU >> (64 - iospace.data_width())); } diff --git a/src/devices/bus/cbus/mpu_pc98.h b/src/devices/bus/cbus/mpu_pc98.h index 2131f0e94b5..024ac574f14 100644 --- a/src/devices/bus/cbus/mpu_pc98.h +++ b/src/devices/bus/cbus/mpu_pc98.h @@ -32,6 +32,7 @@ private: // called back by the MPU401 core to set the IRQ line state DECLARE_WRITE_LINE_MEMBER(mpu_irq_out); + required_device m_bus; required_device m_mpu401; }; diff --git a/src/devices/bus/cbus/pc9801_118.cpp b/src/devices/bus/cbus/pc9801_118.cpp index 57d99ff4d29..79e9195167a 100644 --- a/src/devices/bus/cbus/pc9801_118.cpp +++ b/src/devices/bus/cbus/pc9801_118.cpp @@ -116,7 +116,7 @@ const tiny_rom_entry *pc9801_118_device::device_rom_region() const pc9801_118_device::pc9801_118_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PC9801_118, tag, owner, clock), -// m_maincpu(*this, "^maincpu"), + m_bus(*this, DEVICE_SELF_OWNER), m_opn3(*this, "opn3") { } @@ -137,17 +137,17 @@ void pc9801_118_device::device_validity_check(validity_checker &valid) const void pc9801_118_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) { - int buswidth = machine().firstcpu->space_config(AS_IO)->m_data_width; + int buswidth = m_bus->io_space().data_width(); switch(buswidth) { case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0); break; case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff); break; case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); break; default: fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth); diff --git a/src/devices/bus/cbus/pc9801_118.h b/src/devices/bus/cbus/pc9801_118.h index fd71c27c3bb..892f893abc3 100644 --- a/src/devices/bus/cbus/pc9801_118.h +++ b/src/devices/bus/cbus/pc9801_118.h @@ -11,7 +11,7 @@ #pragma once - +#include "bus/cbus/pc9801_cbus.h" #include "machine/pic8259.h" #include "sound/2608intf.h" @@ -45,7 +45,7 @@ protected: void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); private: -// required_device m_maincpu; + required_device m_bus; required_device m_opn3; uint8_t m_joy_sel; diff --git a/src/devices/bus/cbus/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp index b9e2d84eb3d..5a2b8bb611b 100644 --- a/src/devices/bus/cbus/pc9801_26.cpp +++ b/src/devices/bus/cbus/pc9801_26.cpp @@ -109,7 +109,7 @@ ioport_constructor pc9801_26_device::device_input_ports() const pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PC9801_26, tag, owner, clock), -// m_maincpu(*this, "^maincpu"), + m_bus(*this, DEVICE_SELF_OWNER), m_opn(*this, "opn") { } @@ -130,17 +130,17 @@ void pc9801_26_device::device_validity_check(validity_checker &valid) const void pc9801_26_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) { - int buswidth = machine().firstcpu->space_config(AS_IO)->m_data_width; + int buswidth = m_bus->io_space().data_width(); switch(buswidth) { case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0); break; case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff); break; case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); break; default: fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth); diff --git a/src/devices/bus/cbus/pc9801_26.h b/src/devices/bus/cbus/pc9801_26.h index a006daf9bac..7d0f183cc3a 100644 --- a/src/devices/bus/cbus/pc9801_26.h +++ b/src/devices/bus/cbus/pc9801_26.h @@ -11,7 +11,7 @@ Template for skeleton device #pragma once - +#include "bus/cbus/pc9801_cbus.h" #include "machine/pic8259.h" #include "sound/2203intf.h" @@ -42,7 +42,7 @@ protected: void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); private: -// required_device m_maincpu; + required_device m_bus; required_device m_opn; uint8_t m_joy_sel; diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp index 7736bf93d95..cad2d56c505 100644 --- a/src/devices/bus/cbus/pc9801_86.cpp +++ b/src/devices/bus/cbus/pc9801_86.cpp @@ -125,6 +125,7 @@ ioport_constructor pc9801_86_device::device_input_ports() const pc9801_86_device::pc9801_86_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PC9801_86, tag, owner, clock), + m_bus(*this, DEVICE_SELF_OWNER), m_opna(*this, "opna"), m_ldac(*this, "ldac"), m_rdac(*this, "rdac"), @@ -148,17 +149,17 @@ void pc9801_86_device::device_validity_check(validity_checker &valid) const void pc9801_86_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) { - int buswidth = machine().firstcpu->space_config(AS_IO)->m_data_width; + int buswidth = m_bus->io_space().data_width(); switch(buswidth) { case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0); break; case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff); break; case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); break; default: fatalerror("PC-9801-86: Bus width %d not supported\n", buswidth); diff --git a/src/devices/bus/cbus/pc9801_86.h b/src/devices/bus/cbus/pc9801_86.h index 29d2e79c071..97f09328e2f 100644 --- a/src/devices/bus/cbus/pc9801_86.h +++ b/src/devices/bus/cbus/pc9801_86.h @@ -11,7 +11,7 @@ #pragma once - +#include "bus/cbus/pc9801_cbus.h" #include "machine/pic8259.h" #include "sound/2608intf.h" #include "sound/dac.h" @@ -51,6 +51,8 @@ private: int queue_count(); uint8_t queue_pop(); + required_device m_bus; + uint8_t m_joy_sel, m_mask, m_pcm_mode, m_vol[7], m_pcm_ctrl, m_pcm_mute; uint16_t m_head, m_tail, m_count, m_irq_rate; bool m_pcmirq, m_fmirq; diff --git a/src/devices/bus/cbus/pc9801_amd98.cpp b/src/devices/bus/cbus/pc9801_amd98.cpp index ecb8b9343d8..4f0518f0e89 100644 --- a/src/devices/bus/cbus/pc9801_amd98.cpp +++ b/src/devices/bus/cbus/pc9801_amd98.cpp @@ -102,7 +102,7 @@ ioport_constructor pc9801_amd98_device::device_input_ports() const pc9801_amd98_device::pc9801_amd98_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PC9801_AMD98, tag, owner, clock), -// m_maincpu(*this, "^maincpu"), + m_bus(*this, DEVICE_SELF_OWNER), m_ay1(*this, "ay1"), m_ay2(*this, "ay2"), m_ay3(*this, "ay3") @@ -125,17 +125,17 @@ void pc9801_amd98_device::device_validity_check(validity_checker &valid) const void pc9801_amd98_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler) { - int buswidth = machine().firstcpu->space_config(AS_IO)->m_data_width; + int buswidth = m_bus->io_space().data_width(); switch(buswidth) { case 8: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0); break; case 16: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff); break; case 32: - machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); + m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); break; default: fatalerror("PC-9801-AMD98: Bus width %d not supported\n", buswidth); diff --git a/src/devices/bus/cbus/pc9801_amd98.h b/src/devices/bus/cbus/pc9801_amd98.h index 4e17d25ce53..db5d6d89727 100644 --- a/src/devices/bus/cbus/pc9801_amd98.h +++ b/src/devices/bus/cbus/pc9801_amd98.h @@ -11,7 +11,7 @@ #pragma once - +#include "bus/cbus/pc9801_cbus.h" #include "sound/ay8910.h" @@ -48,7 +48,7 @@ private: uint8_t m_ay3_latch; -// required_device m_maincpu; + required_device m_bus; required_device m_ay1; required_device m_ay2; required_device m_ay3; diff --git a/src/devices/bus/cbus/pc9801_cbus.cpp b/src/devices/bus/cbus/pc9801_cbus.cpp index 06af21561d3..b07235204af 100644 --- a/src/devices/bus/cbus/pc9801_cbus.cpp +++ b/src/devices/bus/cbus/pc9801_cbus.cpp @@ -54,7 +54,8 @@ device_pc9801cbus_card_interface::~device_pc9801cbus_card_interface() pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PC9801CBUS_SLOT, tag, owner, clock), - device_slot_interface(mconfig, *this) + device_slot_interface(mconfig, *this), + m_cpu(*this, "^maincpu") { } diff --git a/src/devices/bus/cbus/pc9801_cbus.h b/src/devices/bus/cbus/pc9801_cbus.h index 1b1084d8961..890519dfbbf 100644 --- a/src/devices/bus/cbus/pc9801_cbus.h +++ b/src/devices/bus/cbus/pc9801_cbus.h @@ -58,13 +58,16 @@ public: // construction/destruction pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + address_space &io_space() const { return m_cpu->space(AS_IO); } + protected: // device-level overrides virtual void device_start() override; virtual void device_config_complete() override; -//private: -// device_pc9801_slot_card_interface *m_card; +private: +// device_pc9801_slot_card_interface *m_card; + required_device m_cpu; };