all repos — mgba @ a8272480c144264bec8db8589e9129bb3feb41d5

mGBA Game Boy Advance Emulator

GBA Timer: Remove questionably accurate timer prefetch skew
Vicki Pfau vi@endrift.com
Sat, 18 Jul 2020 14:26:36 -0700
commit

a8272480c144264bec8db8589e9129bb3feb41d5

parent

7025fbf84ad416e406d355203839f4893369c5a2

1 files changed, 1 insertions(+), 5 deletions(-)

jump to
M src/gba/timer.csrc/gba/timer.c

@@ -105,11 +105,7 @@

void GBATimerUpdateRegister(struct GBA* gba, int timer, int32_t cyclesLate) { struct GBATimer* currentTimer = &gba->timers[timer]; if (GBATimerFlagsIsEnable(currentTimer->flags) && !GBATimerFlagsIsCountUp(currentTimer->flags)) { - int32_t prefetchSkew = cyclesLate; - if (gba->memory.lastPrefetchedPc > (uint32_t) gba->cpu->gprs[ARM_PC]) { - prefetchSkew += ((gba->memory.lastPrefetchedPc - gba->cpu->gprs[ARM_PC]) * gba->cpu->memory.activeSeqCycles16) / WORD_SIZE_THUMB; - } - GBATimerUpdateRegisterInternal(currentTimer, &gba->timing, &gba->memory.io[(REG_TM0CNT_LO + (timer << 2)) >> 1], prefetchSkew); + GBATimerUpdateRegisterInternal(currentTimer, &gba->timing, &gba->memory.io[(REG_TM0CNT_LO + (timer << 2)) >> 1], cyclesLate); } }