all repos — mgba @ 4c1977d351b3ac582b5ea608ef9119a40b3c1aa3

mGBA Game Boy Advance Emulator

GBA Memory: Fix DMA behavior for SRAM accesses
Jeffrey Pfau jeffrey@endrift.com
Fri, 06 Nov 2015 21:06:09 -0800
commit

4c1977d351b3ac582b5ea608ef9119a40b3c1aa3

parent

c6f4f233321069a7e705cb78960d986110ae7f32

3 files changed, 7 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -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.hsrc/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.csrc/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) {