a2bus: Simplify and consolidate DMA handlers now that address_space is no longer tied to disabling side effects (nw)

This commit is contained in:
AJR 2019-01-10 17:47:53 -05:00
parent 15ec52a930
commit ade90cff23
6 changed files with 35 additions and 53 deletions

View File

@ -244,22 +244,12 @@ void a2bus_device::set_maincpu_halt(int state)
m_maincpu->set_input_line(INPUT_LINE_HALT, state); m_maincpu->set_input_line(INPUT_LINE_HALT, state);
} }
uint8_t a2bus_device::dma_r(address_space &space, uint16_t offset) uint8_t a2bus_device::dma_r(uint16_t offset)
{ {
return m_maincpu_space->read_byte(offset); return m_maincpu_space->read_byte(offset);
} }
void a2bus_device::dma_w(address_space &space, uint16_t offset, uint8_t data) void a2bus_device::dma_w(uint16_t offset, uint8_t data)
{
m_maincpu_space->write_byte(offset, data);
}
uint8_t a2bus_device::dma_nospace_r(uint16_t offset)
{
return m_maincpu_space->read_byte(offset);
}
void a2bus_device::dma_nospace_w(uint16_t offset, uint8_t data)
{ {
m_maincpu_space->write_byte(offset, data); m_maincpu_space->write_byte(offset, data);
} }

View File

@ -118,10 +118,8 @@ public:
void set_nmi_line(int state, int slot); void set_nmi_line(int state, int slot);
void set_maincpu_halt(int state); void set_maincpu_halt(int state);
void recalc_inh(int slot); void recalc_inh(int slot);
uint8_t dma_r(address_space &space, uint16_t offset); uint8_t dma_r(uint16_t offset);
void dma_w(address_space &space, uint16_t offset, uint8_t data); void dma_w(uint16_t offset, uint8_t data);
uint8_t dma_nospace_r(uint16_t offset);
void dma_nospace_w(uint16_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER( irq_w ); DECLARE_WRITE_LINE_MEMBER( irq_w );
DECLARE_WRITE_LINE_MEMBER( nmi_w ); DECLARE_WRITE_LINE_MEMBER( nmi_w );
@ -181,14 +179,8 @@ public:
void set_a2bus(a2bus_device *a2bus, const char *slottag) { m_a2bus = a2bus; m_a2bus_slottag = slottag; } void set_a2bus(a2bus_device *a2bus, const char *slottag) { m_a2bus = a2bus; m_a2bus_slottag = slottag; }
template <typename T> void set_onboard(T &&a2bus) { m_a2bus_finder.set_tag(std::forward<T>(a2bus)); m_a2bus_slottag = device().tag(); } template <typename T> void set_onboard(T &&a2bus) { m_a2bus_finder.set_tag(std::forward<T>(a2bus)); m_a2bus_slottag = device().tag(); }
// pass through the original address space if any for debugger protection uint8_t slot_dma_read(uint16_t offset) { return m_a2bus->dma_r(offset); }
// when debugging e.g. coprocessor cards (Z80 SoftCard etc). void slot_dma_write(uint16_t offset, uint8_t data) { m_a2bus->dma_w(offset, data); }
uint8_t slot_dma_read(address_space &space, uint16_t offset) { return m_a2bus->dma_r(space, offset); }
void slot_dma_write(address_space &space, uint16_t offset, uint8_t data) { m_a2bus->dma_w(space, offset, data); }
// these versions forego that protection for when the DMA isn't coming from a debuggable CPU device
uint8_t slot_dma_read_no_space(uint16_t offset) { return m_a2bus->dma_nospace_r(offset); }
void slot_dma_write_no_space(uint16_t offset, uint8_t data) { m_a2bus->dma_nospace_w(offset, data); }
protected: protected:
uint32_t get_slotromspace() { return 0xc000 | (m_slot<<8); } // return Cn00 address for this slot uint32_t get_slotromspace() { return 0xc000 | (m_slot<<8); } // return Cn00 address for this slot

View File

@ -277,7 +277,7 @@ void mcms_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
wptr = (m_table[v]<<8) | (m_acc[v]>>8); wptr = (m_table[v]<<8) | (m_acc[v]>>8);
m_rand = (m_acc[v]>>8) & 0x1f; m_rand = (m_acc[v]>>8) & 0x1f;
sample = (m_pBusDevice->slot_dma_read_no_space(wptr) ^ 0x80); sample = (m_pBusDevice->slot_dma_read(wptr) ^ 0x80);
if (v & 1) if (v & 1)
{ {
mixL += sample * m_vols[v]; mixL += sample * m_vols[v];

View File

@ -106,27 +106,27 @@ READ8_MEMBER( a2bus_softcard_device::dma_r )
{ {
if (offset <= 0xafff) if (offset <= 0xafff)
{ {
return slot_dma_read(space, offset+0x1000); return slot_dma_read(offset+0x1000);
} }
else if (offset <= 0xbfff) // LC bank 2 d000-dfff else if (offset <= 0xbfff) // LC bank 2 d000-dfff
{ {
return slot_dma_read(space, (offset&0xfff) + 0xd000); return slot_dma_read((offset&0xfff) + 0xd000);
} }
else if (offset <= 0xcfff) // LC e000-efff else if (offset <= 0xcfff) // LC e000-efff
{ {
return slot_dma_read(space, (offset&0xfff) + 0xe000); return slot_dma_read((offset&0xfff) + 0xe000);
} }
else if (offset <= 0xdfff) // LC f000-ffff (or ROM?) else if (offset <= 0xdfff) // LC f000-ffff (or ROM?)
{ {
return slot_dma_read(space, (offset&0xfff) + 0xf000); return slot_dma_read((offset&0xfff) + 0xf000);
} }
else if (offset <= 0xefff) // I/O space c000-cfff else if (offset <= 0xefff) // I/O space c000-cfff
{ {
return slot_dma_read(space, (offset&0xfff) + 0xc000); return slot_dma_read((offset&0xfff) + 0xc000);
} }
else // zero page else // zero page
{ {
return slot_dma_read(space, offset&0xfff); return slot_dma_read(offset&0xfff);
} }
} }
@ -144,27 +144,27 @@ WRITE8_MEMBER( a2bus_softcard_device::dma_w )
{ {
if (offset <= 0xafff) if (offset <= 0xafff)
{ {
slot_dma_write(space, offset+0x1000, data); slot_dma_write(offset+0x1000, data);
} }
else if (offset <= 0xbfff) // LC bank 2 d000-dfff else if (offset <= 0xbfff) // LC bank 2 d000-dfff
{ {
slot_dma_write(space, (offset&0xfff) + 0xd000, data); slot_dma_write((offset&0xfff) + 0xd000, data);
} }
else if (offset <= 0xcfff) // LC e000-efff else if (offset <= 0xcfff) // LC e000-efff
{ {
slot_dma_write(space, (offset&0xfff) + 0xe000, data); slot_dma_write((offset&0xfff) + 0xe000, data);
} }
else if (offset <= 0xdfff) // LC f000-ffff (or ROM?) else if (offset <= 0xdfff) // LC f000-ffff (or ROM?)
{ {
slot_dma_write(space, (offset&0xfff) + 0xf000, data); slot_dma_write((offset&0xfff) + 0xf000, data);
} }
else if (offset <= 0xefff) // I/O space c000-cfff else if (offset <= 0xefff) // I/O space c000-cfff
{ {
slot_dma_write(space, (offset&0xfff) + 0xc000, data); slot_dma_write((offset&0xfff) + 0xc000, data);
} }
else // zero page else // zero page
{ {
slot_dma_write(space, offset&0xfff, data); slot_dma_write(offset&0xfff, data);
} }
} }
} }

View File

@ -238,34 +238,34 @@ READ8_MEMBER( a2bus_themill_device::dma_r )
{ {
if (offset <= 0x7fff) if (offset <= 0x7fff)
{ {
return slot_dma_read(space, offset+0x1000); return slot_dma_read(offset+0x1000);
} }
else if (offset <= 0xafff) else if (offset <= 0xafff)
{ {
return slot_dma_read(space, (offset&0x3fff) + 0xd000); return slot_dma_read((offset&0x3fff) + 0xd000);
} }
else if (offset <= 0xbfff) else if (offset <= 0xbfff)
{ {
return slot_dma_read(space, (offset&0xfff) + 0xc000); return slot_dma_read((offset&0xfff) + 0xc000);
} }
else if (offset <= 0xcfff) // 6809 Cxxx -> 6502 ZP else if (offset <= 0xcfff) // 6809 Cxxx -> 6502 ZP
{ {
return slot_dma_read(space, (offset&0xfff)); return slot_dma_read((offset&0xfff));
} }
else // 6809 Dxxx -> 6502 9000 else // 6809 Dxxx -> 6502 9000
{ {
return slot_dma_read(space, (offset-0xd000)+0x9000); return slot_dma_read((offset-0xd000)+0x9000);
} }
} }
else else
{ {
if (m_flipAddrSpace) if (m_flipAddrSpace)
{ {
return slot_dma_read(space, offset^0x8000); return slot_dma_read(offset^0x8000);
} }
else else
{ {
return slot_dma_read(space, offset); return slot_dma_read(offset);
} }
} }
@ -283,34 +283,34 @@ WRITE8_MEMBER( a2bus_themill_device::dma_w )
{ {
if (offset <= 0x7fff) if (offset <= 0x7fff)
{ {
slot_dma_write(space, offset+0x1000, data); slot_dma_write(offset+0x1000, data);
} }
else if (offset <= 0xafff) else if (offset <= 0xafff)
{ {
slot_dma_write(space, (offset&0x3fff) + 0xd000, data); slot_dma_write((offset&0x3fff) + 0xd000, data);
} }
else if (offset <= 0xbfff) else if (offset <= 0xbfff)
{ {
slot_dma_write(space, (offset&0xfff) + 0xc000, data); slot_dma_write((offset&0xfff) + 0xc000, data);
} }
else if (offset <= 0xcfff) else if (offset <= 0xcfff)
{ {
slot_dma_write(space, (offset&0xfff), data); slot_dma_write((offset&0xfff), data);
} }
else // 6809 Dxxx -> 6502 9000 else // 6809 Dxxx -> 6502 9000
{ {
slot_dma_write(space, (offset-0xd000)+0x9000, data); slot_dma_write((offset-0xd000)+0x9000, data);
} }
} }
else else
{ {
if (m_flipAddrSpace) if (m_flipAddrSpace)
{ {
slot_dma_write(space, offset^0x8000, data); slot_dma_write(offset^0x8000, data);
} }
else else
{ {
slot_dma_write(space, offset, data); slot_dma_write(offset, data);
} }
} }
} }

View File

@ -199,7 +199,7 @@ READ8_MEMBER( a2bus_transwarp_device::dma_r )
return m_rom[offset & 0xfff]; return m_rom[offset & 0xfff];
} }
return slot_dma_read(space, offset); return slot_dma_read(offset);
} }
@ -221,7 +221,7 @@ WRITE8_MEMBER( a2bus_transwarp_device::dma_w )
hit_slot(((offset >> 4) & 0xf) - 8); hit_slot(((offset >> 4) & 0xf) - 8);
} }
slot_dma_write(space, offset, data); slot_dma_write(offset, data);
} }
bool a2bus_transwarp_device::take_c800() bool a2bus_transwarp_device::take_c800()