A few more obvious uses for required_address_space (nw)

This commit is contained in:
AJR 2019-01-22 14:17:17 -05:00
parent d90d06b3a8
commit edda9abeee
4 changed files with 9 additions and 23 deletions

View File

@ -16,8 +16,7 @@ acs8600_ics_device::acs8600_ics_device(const machine_config &mconfig, const char
m_icscpu(*this, "icscpu"),
m_out_irq1_func(*this),
m_out_irq2_func(*this),
m_host_space_device(*this, finder_base::DUMMY_TAG),
m_host_space_index(-1)
m_host_space(*this, finder_base::DUMMY_TAG, -1)
{
}
@ -44,12 +43,12 @@ WRITE8_MEMBER(acs8600_ics_device::ctrl_w)
READ8_MEMBER(acs8600_ics_device::hostram_r)
{
return m_maincpu_mem->read_byte((m_hiaddr << 16) | (BIT(m_ctrl, 0) << 15) | (offset & 0x7fff));
return m_host_space->read_byte((m_hiaddr << 16) | (BIT(m_ctrl, 0) << 15) | (offset & 0x7fff));
}
WRITE8_MEMBER(acs8600_ics_device::hostram_w)
{
m_maincpu_mem->write_byte((m_hiaddr << 16) | (BIT(m_ctrl, 0) << 15) | (offset & 0x7fff), data);
m_host_space->write_byte((m_hiaddr << 16) | (BIT(m_ctrl, 0) << 15) | (offset & 0x7fff), data);
}
WRITE_LINE_MEMBER(acs8600_ics_device::attn_w)
@ -202,7 +201,6 @@ void acs8600_ics_device::device_add_mconfig(machine_config &config)
void acs8600_ics_device::device_resolve_objects()
{
m_maincpu_mem = &m_host_space_device->space(m_host_space_index);
m_out_irq1_func.resolve_safe();
m_out_irq2_func.resolve_safe();
}

View File

@ -17,7 +17,7 @@ public:
auto irq1_callback() { return m_out_irq1_func.bind(); }
auto irq2_callback() { return m_out_irq2_func.bind(); }
template <typename T> void set_host_space(T &&tag, int index) { m_host_space_device.set_tag(std::forward<T>(tag)); m_host_space_index = index; }
template <typename T> void set_host_space(T &&tag, int index) { m_host_space.set_tag(std::forward<T>(tag), index); }
const tiny_rom_entry *device_rom_region() const override;
protected:
@ -37,9 +37,7 @@ private:
required_device<z80_device> m_icscpu;
devcb_write_line m_out_irq1_func;
devcb_write_line m_out_irq2_func;
required_device<device_memory_interface> m_host_space_device;
int m_host_space_index;
address_space *m_maincpu_mem;
required_address_space m_host_space;
u8 m_hiaddr;
u8 m_ctrl;
};

View File

@ -133,7 +133,7 @@ DEFINE_DEVICE_TYPE(SAPPHIRE_IOGA, sapphire_ioga_device, "ioga_s", "I/O Gate Arra
interpro_ioga_device::interpro_ioga_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_memory_device(*this, finder_base::DUMMY_TAG)
, m_memory_space(*this, finder_base::DUMMY_TAG, -1, 32)
, m_memory(nullptr)
, m_out_nmi_func(*this)
, m_out_irq_func(*this)
@ -168,12 +168,7 @@ sapphire_ioga_device::sapphire_ioga_device(const machine_config &mconfig, const
void interpro_ioga_device::device_start()
{
// get the memory space
if (!m_memory_device->has_space(m_memory_spacenum))
fatalerror("%s: device %s (%s) doesn't have memory space %d\n",
tag(), m_memory_device->device().tag(), m_memory_device->device().name(), m_memory_spacenum);
m_memory = m_memory_device->space(m_memory_spacenum).cache<2, 0, ENDIANNESS_LITTLE>();
m_memory = m_memory_space->cache<2, 0, ENDIANNESS_LITTLE>();
// resolve callbacks
m_out_nmi_func.resolve();

View File

@ -60,11 +60,7 @@ public:
auto fdc_tc_callback() { return m_fdc_tc_func.bind(); }
auto eth_ca_callback() { return m_eth_ca_func.bind(); }
template <typename T> void set_memory(T &&tag, int spacenum)
{
m_memory_device.set_tag(std::forward<T>(tag));
m_memory_spacenum = spacenum;
}
template <typename T> void set_memory(T &&tag, int spacenum) { m_memory_space.set_tag(std::forward<T>(tag), spacenum); }
virtual void map(address_map &map) = 0;
@ -246,8 +242,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
required_device<device_memory_interface> m_memory_device;
int m_memory_spacenum;
required_address_space m_memory_space;
memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_memory;
// callbacks