GBA Memory: Fix timing of DMAs

This commit is contained in:
Jeffrey Pfau 2015-11-18 20:44:18 -08:00
parent 21d51964e8
commit 3d321bc0b9
2 changed files with 5 additions and 3 deletions

View File

@ -32,6 +32,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:
- Qt: Window size command line options are now supported
- Qt: Increase usability of key mapper

View File

@ -1611,9 +1611,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;