cbus: Remove machine().firstcpu calls (nw)

This commit is contained in:
AJR 2018-01-02 09:40:14 -05:00
parent 5132a3460c
commit 9d1bf83edf
12 changed files with 39 additions and 30 deletions

View File

@ -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()));
}

View File

@ -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<pc9801_slot_device> m_bus;
required_device<mpu401_device> m_mpu401;
};

View File

@ -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);

View File

@ -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<cpu_device> m_maincpu;
required_device<pc9801_slot_device> m_bus;
required_device<ym2608_device> m_opn3;
uint8_t m_joy_sel;

View File

@ -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);

View File

@ -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<cpu_device> m_maincpu;
required_device<pc9801_slot_device> m_bus;
required_device<ym2203_device> m_opn;
uint8_t m_joy_sel;

View File

@ -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);

View File

@ -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<pc9801_slot_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;

View File

@ -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);

View File

@ -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<cpu_device> m_maincpu;
required_device<pc9801_slot_device> m_bus;
required_device<ay8910_device> m_ay1;
required_device<ay8910_device> m_ay2;
required_device<ay8910_device> m_ay3;

View File

@ -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")
{
}

View File

@ -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<cpu_device> m_cpu;
};