bus/hp_dio: Replace CPU finder with required_address_space (nw)

This commit is contained in:
AJR 2019-02-25 20:45:30 -05:00
parent 8fc8ae62a7
commit 579e277fda
7 changed files with 16 additions and 19 deletions

View File

@ -168,12 +168,12 @@ void dio16_98265a_device::device_reset()
code &= REG_SW1_SELECT_CODE_MASK;
if (!m_installed_io) {
program_space()->install_readwrite_handler(
program_space().install_readwrite_handler(
0x600000 + (code * 0x10000),
0x6007ff + (code * 0x10000),
read16_delegate(FUNC(dio16_98265a_device::io_r), this),
write16_delegate(FUNC(dio16_98265a_device::io_w), this));
program_space()->install_device(0x6e0020, 0x6e003f, *m_spc, &mb87030_device::map, 0x00ff00ff);
program_space().install_device(0x6e0020, 0x6e003f, *m_spc, &mb87030_device::map, 0x00ff00ff);
m_installed_io = true;
}
m_control = 0;

View File

@ -74,7 +74,7 @@ void dio16_98620_device::device_reset()
{
if (!m_installed_io)
{
program_space()->install_readwrite_handler(0x500000, 0x50020f,
program_space().install_readwrite_handler(0x500000, 0x50020f,
read16_delegate(FUNC(dio16_98620_device::dma_r), this),
write16_delegate(FUNC(dio16_98620_device::dma_w), this));
m_installed_io = true;
@ -343,9 +343,9 @@ void dio16_98620_device::dma_transfer(int channel)
if (m_regs[channel].dma_out) {
dmack_w_out(channel, program_space()->read_byte(m_regs[channel].address++));
dmack_w_out(channel, program_space().read_byte(m_regs[channel].address++));
} else {
program_space()->write_byte(m_regs[channel].address++, dmack_r_out(channel));
program_space().write_byte(m_regs[channel].address++, dmack_r_out(channel));
}

View File

@ -105,7 +105,7 @@ void dio16_98643_device::device_reset()
uint32_t baseaddr = 0x600000 + (code << 16);
program_space()->install_device(baseaddr, baseaddr + 0xffff,
program_space().install_device(baseaddr, baseaddr + 0xffff,
*this, &dio16_98643_device::addrmap);
m_installed_io = true;
}

View File

@ -104,8 +104,7 @@ dio16_device::dio16_device(const machine_config &mconfig, const char *tag, devic
dio16_device::dio16_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(*this, finder_base::DUMMY_TAG),
m_prgspace(nullptr),
m_prgspace(*this, finder_base::DUMMY_TAG, -1),
m_irq1_out_cb(*this),
m_irq2_out_cb(*this),
m_irq3_out_cb(*this),
@ -136,8 +135,7 @@ void dio16_device::device_start()
m_dmar0_out_cb.resolve_safe();
m_dmar1_out_cb.resolve_safe();
m_prgspace = &m_maincpu->space(AS_PROGRAM);
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
m_prgwidth = m_prgspace->data_width();
save_item(NAME(m_irq));
save_item(NAME(m_dmar));

View File

@ -65,7 +65,7 @@ public:
// construction/destruction
dio16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// inline configuration
template <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
template <typename T> void set_program_space(T &&tag, int spacenum) { m_prgspace.set_tag(std::forward<T>(tag), spacenum); }
// callback configuration
auto dmar0_out_cb() { return m_dmar0_out_cb.bind(); }
@ -89,7 +89,7 @@ public:
void unmap_bank(offs_t start, offs_t end);
void unmap_rom(offs_t start, offs_t end);
address_space *program_space() { return m_prgspace; }
address_space &program_space() { return *m_prgspace; }
// IRQs 1, 2, and 7 are reserved for non-bus usage.
@ -137,11 +137,10 @@ protected:
virtual void device_reset() override;
// internal state
required_device<cpu_device> m_maincpu;
std::list<device_dio16_card_interface *> m_cards;
// address spaces
address_space *m_prgspace;
required_address_space m_prgspace;
int m_bus_index;
// packed line states
@ -187,7 +186,7 @@ protected:
virtual void interface_pre_start() override;
int get_index() { return m_index; };
address_space *program_space() { return m_dio_dev->program_space(); }
address_space &program_space() { return m_dio_dev->program_space(); }
DECLARE_WRITE_LINE_MEMBER(irq1_out) { m_dio_dev->set_irq(m_index, 0, state); }
DECLARE_WRITE_LINE_MEMBER(irq2_out) { m_dio_dev->set_irq(m_index, 1, state); }

View File

@ -114,11 +114,11 @@ human_interface_device::human_interface_device(const machine_config &mconfig, de
void human_interface_device::device_start()
{
program_space()->install_readwrite_handler(0x420000, 0x420003, 0x0003, 0xfffc, 0,
program_space().install_readwrite_handler(0x420000, 0x420003, 0x0003, 0xfffc, 0,
read8_delegate(FUNC(upi41_cpu_device::upi41_master_r), &(*m_iocpu)),
write8_delegate(FUNC(upi41_cpu_device::upi41_master_w), &(*m_iocpu)), 0x00ff00ff);
program_space()->install_readwrite_handler(0x470000, 0x47001f, 0x1f, 0xffe0, 0,
program_space().install_readwrite_handler(0x470000, 0x47001f, 0x1f, 0xffe0, 0,
read8_delegate(FUNC(human_interface_device::gpib_r), this),
write8_delegate(FUNC(human_interface_device::gpib_w), this), 0x00ff00ff);

View File

@ -258,7 +258,7 @@ WRITE16_MEMBER(hp9k3xx_state::led_w)
void hp9k3xx_state::add_dio16_bus(machine_config &config)
{
bus::hp_dio::dio16_device &dio16(DIO16(config, "diobus", 0));
dio16.set_cputag(m_maincpu);
dio16.set_program_space(m_maincpu, AS_PROGRAM);
dio16.irq1_out_cb().set(FUNC(hp9k3xx_state::dio_irq1_w));
dio16.irq2_out_cb().set(FUNC(hp9k3xx_state::dio_irq2_w));
@ -272,7 +272,7 @@ void hp9k3xx_state::add_dio16_bus(machine_config &config)
void hp9k3xx_state::add_dio32_bus(machine_config &config)
{
bus::hp_dio::dio32_device &dio32(DIO32(config, "diobus", 0));
dio32.set_cputag(m_maincpu);
dio32.set_program_space(m_maincpu, AS_PROGRAM);
dio32.irq1_out_cb().set(FUNC(hp9k3xx_state::dio_irq1_w));
dio32.irq2_out_cb().set(FUNC(hp9k3xx_state::dio_irq2_w));