From bfc4ccd18a1c9171791cc19cd1492692f22a0f22 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 21 Feb 2018 00:22:20 -0500 Subject: cdicdic: Safer DMA handling (nw) This fixes the regression in quizard. It's surprising that this very unsafe code hadn't been crashing until just recently. --- src/mame/machine/cdicdic.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/mame/machine/cdicdic.cpp b/src/mame/machine/cdicdic.cpp index c04602721d4..7fb907504c4 100644 --- a/src/mame/machine/cdicdic.cpp +++ b/src/mame/machine/cdicdic.cpp @@ -1051,25 +1051,20 @@ WRITE16_MEMBER( cdicdic_device::regs_w ) uint32_t count = state->m_scc->dma().channel[0].transfer_counter; uint32_t index = 0; uint32_t device_index = (data & 0x3fff) >> 1; - uint16_t *memory = state->m_planea; + address_space &memory_space = state->m_maincpu->space(AS_PROGRAM); verboselog(*this, 0, "memory address counter: %08x\n", state->m_scc->dma().channel[0].memory_address_counter); verboselog(*this, 0, "cdic_w: DMA Control Register = %04x & %04x\n", data, mem_mask); verboselog(*this, 0, "Doing copy, transferring %04x bytes\n", count * 2 ); ////printf("Doing copy, transferring %04x bytes\n", count * 2 ); - if((start & 0x00f00000) == 0x00200000) - { - start -= 0x00200000; - memory = state->m_planeb; - } for(index = start / 2; index < (start / 2 + count); index++) { if(state->m_scc->dma().channel[0].operation_control & OCR_D) { - memory[index] = m_ram[device_index++]; + memory_space.write_word(index * 2, m_ram[device_index++]); } else { - m_ram[device_index++] = memory[index]; + m_ram[device_index++] = memory_space.read_word(index * 2); } } state->m_scc->dma().channel[0].memory_address_counter += state->m_scc->dma().channel[0].transfer_counter * 2; -- cgit v1.2.3