From ade90cff23484b528c0f78614e9418fbadd84d69 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 10 Jan 2019 17:47:53 -0500 Subject: [PATCH] a2bus: Simplify and consolidate DMA handlers now that address_space is no longer tied to disabling side effects (nw) --- src/devices/bus/a2bus/a2bus.cpp | 14 ++------------ src/devices/bus/a2bus/a2bus.h | 16 ++++------------ src/devices/bus/a2bus/a2mcms.cpp | 2 +- src/devices/bus/a2bus/a2softcard.cpp | 24 ++++++++++++------------ src/devices/bus/a2bus/a2themill.cpp | 28 ++++++++++++++-------------- src/devices/bus/a2bus/transwarp.cpp | 4 ++-- 6 files changed, 35 insertions(+), 53 deletions(-) diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp index 84df6f73b35..bc0b7c295d3 100644 --- a/src/devices/bus/a2bus/a2bus.cpp +++ b/src/devices/bus/a2bus/a2bus.cpp @@ -244,22 +244,12 @@ void a2bus_device::set_maincpu_halt(int 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); } -void a2bus_device::dma_w(address_space &space, 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) +void a2bus_device::dma_w(uint16_t offset, uint8_t data) { m_maincpu_space->write_byte(offset, data); } diff --git a/src/devices/bus/a2bus/a2bus.h b/src/devices/bus/a2bus/a2bus.h index 862aeca3803..f22d9f7b870 100644 --- a/src/devices/bus/a2bus/a2bus.h +++ b/src/devices/bus/a2bus/a2bus.h @@ -118,10 +118,8 @@ public: void set_nmi_line(int state, int slot); void set_maincpu_halt(int state); void recalc_inh(int slot); - uint8_t dma_r(address_space &space, uint16_t offset); - void dma_w(address_space &space, uint16_t offset, uint8_t data); - uint8_t dma_nospace_r(uint16_t offset); - void dma_nospace_w(uint16_t offset, uint8_t data); + uint8_t dma_r(uint16_t offset); + void dma_w(uint16_t offset, uint8_t data); DECLARE_WRITE_LINE_MEMBER( irq_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; } template void set_onboard(T &&a2bus) { m_a2bus_finder.set_tag(std::forward(a2bus)); m_a2bus_slottag = device().tag(); } - // pass through the original address space if any for debugger protection - // when debugging e.g. coprocessor cards (Z80 SoftCard etc). - 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); } + uint8_t slot_dma_read(uint16_t offset) { return m_a2bus->dma_r(offset); } + void slot_dma_write(uint16_t offset, uint8_t data) { m_a2bus->dma_w(offset, data); } protected: uint32_t get_slotromspace() { return 0xc000 | (m_slot<<8); } // return Cn00 address for this slot diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp index 1442d7d68bc..fec8e309efb 100644 --- a/src/devices/bus/a2bus/a2mcms.cpp +++ b/src/devices/bus/a2bus/a2mcms.cpp @@ -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); 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) { mixL += sample * m_vols[v]; diff --git a/src/devices/bus/a2bus/a2softcard.cpp b/src/devices/bus/a2bus/a2softcard.cpp index b8c71153e7b..be10dc26eb4 100644 --- a/src/devices/bus/a2bus/a2softcard.cpp +++ b/src/devices/bus/a2bus/a2softcard.cpp @@ -106,27 +106,27 @@ READ8_MEMBER( a2bus_softcard_device::dma_r ) { 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 { - return slot_dma_read(space, (offset&0xfff) + 0xd000); + return slot_dma_read((offset&0xfff) + 0xd000); } 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?) { - return slot_dma_read(space, (offset&0xfff) + 0xf000); + return slot_dma_read((offset&0xfff) + 0xf000); } 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 { - 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) { - slot_dma_write(space, offset+0x1000, data); + slot_dma_write(offset+0x1000, data); } 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 { - slot_dma_write(space, (offset&0xfff) + 0xe000, data); + slot_dma_write((offset&0xfff) + 0xe000, data); } 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 { - slot_dma_write(space, (offset&0xfff) + 0xc000, data); + slot_dma_write((offset&0xfff) + 0xc000, data); } else // zero page { - slot_dma_write(space, offset&0xfff, data); + slot_dma_write(offset&0xfff, data); } } } diff --git a/src/devices/bus/a2bus/a2themill.cpp b/src/devices/bus/a2bus/a2themill.cpp index effa5ac9cfb..14474662ef8 100644 --- a/src/devices/bus/a2bus/a2themill.cpp +++ b/src/devices/bus/a2bus/a2themill.cpp @@ -238,34 +238,34 @@ READ8_MEMBER( a2bus_themill_device::dma_r ) { if (offset <= 0x7fff) { - return slot_dma_read(space, offset+0x1000); + return slot_dma_read(offset+0x1000); } else if (offset <= 0xafff) { - return slot_dma_read(space, (offset&0x3fff) + 0xd000); + return slot_dma_read((offset&0x3fff) + 0xd000); } 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 { - return slot_dma_read(space, (offset&0xfff)); + return slot_dma_read((offset&0xfff)); } else // 6809 Dxxx -> 6502 9000 { - return slot_dma_read(space, (offset-0xd000)+0x9000); + return slot_dma_read((offset-0xd000)+0x9000); } } else { if (m_flipAddrSpace) { - return slot_dma_read(space, offset^0x8000); + return slot_dma_read(offset^0x8000); } 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) { - slot_dma_write(space, offset+0x1000, data); + slot_dma_write(offset+0x1000, data); } else if (offset <= 0xafff) { - slot_dma_write(space, (offset&0x3fff) + 0xd000, data); + slot_dma_write((offset&0x3fff) + 0xd000, data); } else if (offset <= 0xbfff) { - slot_dma_write(space, (offset&0xfff) + 0xc000, data); + slot_dma_write((offset&0xfff) + 0xc000, data); } else if (offset <= 0xcfff) { - slot_dma_write(space, (offset&0xfff), data); + slot_dma_write((offset&0xfff), data); } else // 6809 Dxxx -> 6502 9000 { - slot_dma_write(space, (offset-0xd000)+0x9000, data); + slot_dma_write((offset-0xd000)+0x9000, data); } } else { if (m_flipAddrSpace) { - slot_dma_write(space, offset^0x8000, data); + slot_dma_write(offset^0x8000, data); } else { - slot_dma_write(space, offset, data); + slot_dma_write(offset, data); } } } diff --git a/src/devices/bus/a2bus/transwarp.cpp b/src/devices/bus/a2bus/transwarp.cpp index 06557e28cb0..c4799bc07a6 100644 --- a/src/devices/bus/a2bus/transwarp.cpp +++ b/src/devices/bus/a2bus/transwarp.cpp @@ -199,7 +199,7 @@ READ8_MEMBER( a2bus_transwarp_device::dma_r ) 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); } - slot_dma_write(space, offset, data); + slot_dma_write(offset, data); } bool a2bus_transwarp_device::take_c800()