GBA Memory: Fix DMA behavior for SRAM accesses
Jeffrey Pfau jeffrey@endrift.com
Fri, 06 Nov 2015 21:06:09 -0800
3 files changed,
7 insertions(+),
3 deletions(-)
M
CHANGES
→
CHANGES
@@ -19,6 +19,7 @@ - GBA BIOS: Fix misaligned CpuSet
- Libretro: Fix problems with rumble not turning off - ARM7: Fix sign of unaligned LDRSH - GBA BIOS: Fix CpuSet on 0x01XXXXXX addresses + - GBA Memory: Fix DMA behavior for SRAM accesses Misc: - Qt: Window size command line options are now supported - Qt: Increase usability of key mapper
M
src/gba/gba.h
→
src/gba/gba.h
@@ -88,7 +88,7 @@
struct ARMDebugger* debugger; uint32_t bus; - bool performingDMA; + int performingDMA; int timersEnabled; struct GBATimer timers[4];
M
src/gba/memory.c
→
src/gba/memory.c
@@ -591,6 +591,9 @@ if (memory->savedata.type == SAVEDATA_AUTODETECT) {
GBALog(gba, GBA_LOG_INFO, "Detected SRAM savegame"); GBASavedataInitSRAM(&memory->savedata); } + if (gba->performingDMA == 1) { + break; + } if (memory->savedata.type == SAVEDATA_SRAM) { value = memory->savedata.data[address & (SIZE_CART_SRAM - 1)]; } else if (memory->savedata.type == SAVEDATA_FLASH512 || memory->savedata.type == SAVEDATA_FLASH1M) {@@ -1480,7 +1483,7 @@ cycles += memory->waitstatesSeq16[sourceRegion] + memory->waitstatesSeq16[destRegion];
} } - gba->performingDMA = true; + gba->performingDMA = 1 | (number << 1); int32_t word; if (width == 4) { word = cpu->memory.load32(cpu, source, 0);@@ -1517,7 +1520,7 @@ dest += destOffset;
--wordsRemaining; } } - gba->performingDMA = false; + gba->performingDMA = 0; if (!wordsRemaining) { if (!GBADMARegisterIsRepeat(info->reg) || GBADMARegisterGetTiming(info->reg) == DMA_TIMING_NOW) {