From 48774d6c8a8ce3102d492d6703ca6f2458f1ebe5 Mon Sep 17 00:00:00 2001 From: smf- Date: Thu, 6 Oct 2016 11:20:09 +0100 Subject: [PATCH] Applied IBM AT 16-bit DMA wrap round fix to other implementations. (nw) --- src/devices/bus/lpci/southbridge.cpp | 12 ++++++------ src/devices/machine/wd7600.cpp | 4 ++-- src/mame/drivers/ngen.cpp | 12 ++++++------ src/mame/machine/at.cpp | 12 ++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/devices/bus/lpci/southbridge.cpp b/src/devices/bus/lpci/southbridge.cpp index 72959090f7d..14ff2d977de 100644 --- a/src/devices/bus/lpci/southbridge.cpp +++ b/src/devices/bus/lpci/southbridge.cpp @@ -329,7 +329,7 @@ READ8_MEMBER(southbridge_device::pc_dma_read_byte) if(m_dma_channel == -1) return 0xff; UINT8 result; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + offs_t page_offset = ((offs_t) m_dma_offset[0][m_dma_channel]) << 16; result = prog_space.read_byte(page_offset + offset); return result; @@ -341,7 +341,7 @@ WRITE8_MEMBER(southbridge_device::pc_dma_write_byte) address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + offs_t page_offset = ((offs_t) m_dma_offset[0][m_dma_channel]) << 16; prog_space.write_byte(page_offset + offset, data); } @@ -353,9 +353,9 @@ READ8_MEMBER(southbridge_device::pc_dma_read_word) if(m_dma_channel == -1) return 0xff; UINT16 result; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + offs_t page_offset = ((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16; - result = prog_space.read_word(page_offset + ( offset << 1 ) ); + result = prog_space.read_word(page_offset + ((offset << 1) & 0xffff)); m_dma_high_byte = result & 0xFF00; return result & 0xFF; @@ -367,9 +367,9 @@ WRITE8_MEMBER(southbridge_device::pc_dma_write_word) address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + offs_t page_offset = ((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16; - prog_space.write_word(page_offset + ( offset << 1 ), m_dma_high_byte | data); + prog_space.write_word(page_offset + ((offset << 1) & 0xffff), m_dma_high_byte | data); } diff --git a/src/devices/machine/wd7600.cpp b/src/devices/machine/wd7600.cpp index b1540fd7bff..4e1844e2a54 100644 --- a/src/devices/machine/wd7600.cpp +++ b/src/devices/machine/wd7600.cpp @@ -372,7 +372,7 @@ READ8_MEMBER( wd7600_device::dma_read_word ) if (m_dma_channel == -1) return 0xff; - UINT16 result = m_space->read_word(page_offset() + (offset << 1)); + UINT16 result = m_space->read_word(page_offset() + ((offset << 1) & 0xffff)); m_dma_high_byte = result >> 8; return result; @@ -383,7 +383,7 @@ WRITE8_MEMBER( wd7600_device::dma_write_word ) if (m_dma_channel == -1) return; - m_space->write_word(page_offset() + (offset << 1), (m_dma_high_byte << 8) | data); + m_space->write_word(page_offset() + ((offset << 1) & 0xffff), (m_dma_high_byte << 8) | data); } WRITE_LINE_MEMBER( wd7600_device::dma2_dack0_w ) diff --git a/src/mame/drivers/ngen.cpp b/src/mame/drivers/ngen.cpp index 0d2dbac5add..2d56c547618 100644 --- a/src/mame/drivers/ngen.cpp +++ b/src/mame/drivers/ngen.cpp @@ -713,11 +713,11 @@ READ8_MEMBER(ngen_state::dma_read_word) if(m_dma_channel == -1) return 0xff; - offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0xFE0000; + offs_t page_offset = ((offs_t) m_dma_offset[m_dma_channel]) << 16; - result = prog_space.read_word(page_offset + (offset << 1)); + result = prog_space.read_word(page_offset + ((offset << 1) & 0xffff)); m_dma_high_byte = result & 0xFF00; - popmessage("DMA byte address %06x read %04x\n",page_offset+(offset<<1),result); + popmessage("DMA byte address %06x read %04x\n", page_offset + ((offset << 1) & 0xffff),result); return result & 0xff; } @@ -734,10 +734,10 @@ WRITE8_MEMBER(ngen_state::dma_write_word) if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0xFE0000; + offs_t page_offset = ((offs_t) m_dma_offset[m_dma_channel]) << 16; - prog_space.write_word(page_offset + (offset << 1), data); - popmessage("DMA byte address %06x write %04x\n",page_offset+(offset<<1), m_dma_high_byte | data); + prog_space.write_word(page_offset + ((offset << 1) & 0xffff), data); + popmessage("DMA byte address %06x write %04x\n", page_offset + ((offset << 1) & 0xffff), m_dma_high_byte | data); } diff --git a/src/mame/machine/at.cpp b/src/mame/machine/at.cpp index 25cb4eafb1b..c1f3572ea27 100644 --- a/src/mame/machine/at.cpp +++ b/src/mame/machine/at.cpp @@ -266,7 +266,7 @@ READ8_MEMBER(at_mb_device::dma_read_byte) if(m_dma_channel == -1) return 0xff; UINT8 result; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + offs_t page_offset = ((offs_t) m_dma_offset[0][m_dma_channel]) << 16; result = prog_space.read_byte(page_offset + offset); return result; @@ -278,7 +278,7 @@ WRITE8_MEMBER(at_mb_device::dma_write_byte) address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[0][m_dma_channel]) << 16) & 0xFF0000; + offs_t page_offset = ((offs_t) m_dma_offset[0][m_dma_channel]) << 16; prog_space.write_byte(page_offset + offset, data); } @@ -290,9 +290,9 @@ READ8_MEMBER(at_mb_device::dma_read_word) if(m_dma_channel == -1) return 0xff; UINT16 result; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + offs_t page_offset = ((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16; - result = prog_space.read_word(page_offset + ( offset << 1 ) ); + result = prog_space.read_word(page_offset + ((offset << 1) & 0xffff)); m_dma_high_byte = result & 0xFF00; return result & 0xFF; @@ -304,9 +304,9 @@ WRITE8_MEMBER(at_mb_device::dma_write_word) address_space& prog_space = m_maincpu->space(AS_PROGRAM); // get the right address space if(m_dma_channel == -1) return; - offs_t page_offset = (((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16) & 0xFE0000; + offs_t page_offset = ((offs_t) m_dma_offset[1][m_dma_channel & 3]) << 16; - prog_space.write_word(page_offset + ( offset << 1 ), m_dma_high_byte | data); + prog_space.write_word(page_offset + ((offset << 1) & 0xffff), m_dma_high_byte | data); } READ8_MEMBER( at_mb_device::dma8237_0_dack_r ) { return m_isabus->dack_r(0); }