diff --git a/CHANGES b/CHANGES index 8ea25461c..86a862548 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Bugfixes: - GBA BIOS: Fix Sqrt sign - GBA BIOS: Fix misaligned RLUnCompReadNormalWrite* - Qt: Fix race condition with setting sample rate + - GBA Memory: Fix timing of DMAs Misc: - GBA Audio: Implement missing flags on SOUNDCNT_X register diff --git a/src/gba/memory.c b/src/gba/memory.c index ba0d8047c..0c5c91cd1 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -1453,9 +1453,10 @@ void GBAMemoryServiceDMA(struct GBA* gba, int number, struct GBADMA* info) { uint32_t destRegion = dest >> BASE_OFFSET; int32_t cycles = 2; - if (source == info->source) { - // TODO: support 4 cycles for ROM access - cycles += 2; + if (source == info->source && dest == info->dest && wordsRemaining == info->count) { + if (sourceRegion < REGION_CART0 || destRegion < REGION_CART0) { + cycles += 2; + } if (width == 4) { cycles += memory->waitstatesNonseq32[sourceRegion] + memory->waitstatesNonseq32[destRegion]; source &= 0xFFFFFFFC;