diff --git a/src/gba/gba.c b/src/gba/gba.c index 038e40e55..8534fc6c6 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -537,7 +537,7 @@ void GBATimerUpdateRegister(struct GBA* gba, int timer) { struct GBATimer* currentTimer = &gba->timers[timer]; if (GBATimerFlagsIsEnable(currentTimer->flags) && !GBATimerFlagsIsCountUp(currentTimer->flags)) { int32_t prefetchSkew = 0; - if (gba->memory.lastPrefetchedPc - gba->memory.lastPrefetchedLoads * WORD_SIZE_THUMB >= (uint32_t) gba->cpu->gprs[ARM_PC]) { + if (gba->memory.lastPrefetchedPc >= (uint32_t) gba->cpu->gprs[ARM_PC]) { prefetchSkew = (gba->memory.lastPrefetchedPc - gba->cpu->gprs[ARM_PC]) * (gba->cpu->memory.activeSeqCycles16 + 1) / WORD_SIZE_THUMB; } // Reading this takes two cycles (1N+1I), so let's remove them preemptively diff --git a/src/gba/memory.c b/src/gba/memory.c index 61c5bf087..c52907d47 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -244,7 +244,6 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) { gba->lastJump = address; memory->lastPrefetchedPc = 0; - memory->lastPrefetchedLoads = 0; if (newRegion == memory->activeRegion) { if (newRegion < REGION_CART0 || (address & (SIZE_CART0 - 1)) < memory->romSize) { return; @@ -1779,7 +1778,6 @@ int32_t GBAMemoryStall(struct ARMCore* cpu, int32_t wait) { wait -= n2s; // TODO: Invalidate prefetch on branch - memory->lastPrefetchedLoads = loads; memory->lastPrefetchedPc = cpu->gprs[ARM_PC] + WORD_SIZE_THUMB * loads; // The next |loads|S waitstates disappear entirely, so long as they're all in a row diff --git a/src/gba/memory.h b/src/gba/memory.h index 8b4df9904..de3bba160 100644 --- a/src/gba/memory.h +++ b/src/gba/memory.h @@ -136,7 +136,6 @@ struct GBAMemory { int activeRegion; bool prefetch; uint32_t lastPrefetchedPc; - uint32_t lastPrefetchedLoads; uint32_t biosPrefetch; struct GBADMA dma[4];