bus/x68k: Use object finder to get at CPU address space (nw)

This commit is contained in:
AJR 2019-02-26 10:07:45 -05:00
parent 0a50f714bd
commit 63d0c5d33f
6 changed files with 15 additions and 13 deletions

View File

@ -39,10 +39,8 @@ x68k_midi_device::x68k_midi_device(const machine_config &mconfig, const char *ta
void x68k_midi_device::device_start()
{
device_t* cpu = machine().device("maincpu");
address_space& space = cpu->memory().space(AS_PROGRAM);
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
space.install_readwrite_handler(0xeafa00,0xeafa0f,read8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_r),this),write8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_w),this),0x00ff00ff);
m_slot->space().install_readwrite_handler(0xeafa00,0xeafa0f,read8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_r),this),write8_delegate(FUNC(x68k_midi_device::x68k_midi_reg_w),this),0x00ff00ff);
}
void x68k_midi_device::device_reset()

View File

@ -39,17 +39,15 @@ x68k_neptune_device::x68k_neptune_device(const machine_config &mconfig, const ch
void x68k_neptune_device::device_start()
{
device_t* cpu = machine().device("maincpu");
char mac[7];
uint32_t num = machine().rand();
address_space& space = cpu->memory().space(AS_PROGRAM);
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
memset(m_prom, 0x57, 16);
sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
mac[0] = 0; mac[1] = 0; // avoid gcc warning
memcpy(m_prom, mac, 6);
m_dp8390->set_mac(mac);
space.install_readwrite_handler(0xece000,0xece3ff,read16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_r),this),write16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_w),this),0xffffffff);
m_slot->space().install_readwrite_handler(0xece000,0xece3ff,read16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_r),this),write16_delegate(FUNC(x68k_neptune_device::x68k_neptune_port_w),this),0xffffffff);
}
void x68k_neptune_device::device_reset() {

View File

@ -65,15 +65,14 @@ x68k_scsiext_device::x68k_scsiext_device(const machine_config &mconfig, const ch
void x68k_scsiext_device::device_start()
{
device_t* cpu = machine().device("maincpu");
uint8_t* ROM;
address_space& space = cpu->memory().space(AS_PROGRAM);
m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
space.install_read_bank(0xea0020,0xea1fff,"scsi_ext");
space.unmap_write(0xea0020,0xea1fff);
ROM = machine().root_device().memregion(subtag("scsiexrom").c_str())->base();
m_slot->space().install_read_bank(0xea0020,0xea1fff,"scsi_ext");
m_slot->space().unmap_write(0xea0020,0xea1fff);
uint8_t *ROM = machine().root_device().memregion(subtag("scsiexrom").c_str())->base();
machine().root_device().membank("scsi_ext")->set_base(ROM);
space.install_readwrite_handler(0xea0000,0xea001f,read8_delegate(FUNC(x68k_scsiext_device::register_r),this),write8_delegate(FUNC(x68k_scsiext_device::register_w),this),0x00ff00ff);
m_slot->space().install_readwrite_handler(0xea0000,0xea001f,read8_delegate(FUNC(x68k_scsiext_device::register_r),this),write8_delegate(FUNC(x68k_scsiext_device::register_w),this),0x00ff00ff);
}
void x68k_scsiext_device::device_reset()

View File

@ -36,6 +36,7 @@ device_x68k_expansion_card_interface::~device_x68k_expansion_card_interface()
x68k_expansion_slot_device::x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, X68K_EXPANSION_SLOT, tag, owner, clock),
device_slot_interface(mconfig, *this),
m_space(*this, finder_base::DUMMY_TAG, -1),
m_out_irq2_cb(*this),
m_out_irq4_cb(*this),
m_out_nmi_cb(*this),

View File

@ -119,11 +119,14 @@ public:
x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~x68k_expansion_slot_device();
template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
auto out_irq2_callback() { return m_out_irq2_cb.bind(); }
auto out_irq4_callback() { return m_out_irq4_cb.bind(); }
auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
auto out_reset_callback() { return m_out_reset_cb.bind(); }
address_space &space() { return *m_space; }
DECLARE_WRITE_LINE_MEMBER( irq2_w );
DECLARE_WRITE_LINE_MEMBER( irq4_w );
@ -137,6 +140,8 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
required_address_space m_space;
devcb_write_line m_out_irq2_cb;
devcb_write_line m_out_irq4_cb;
devcb_write_line m_out_nmi_cb;

View File

@ -1628,6 +1628,7 @@ void x68k_state::x68000_base(machine_config &config)
SOFTWARE_LIST(config, "flop_list").set_original("x68k_flop");
X68K_EXPANSION_SLOT(config, m_expansion, x68000_exp_cards, nullptr);
m_expansion->set_space(m_maincpu, AS_PROGRAM);
m_expansion->out_irq2_callback().set(FUNC(x68k_state::irq2_line));
m_expansion->out_irq4_callback().set(FUNC(x68k_state::irq4_line));
m_expansion->out_nmi_callback().set_inputline(m_maincpu, M68K_IRQ_7);