diff --git a/src/arm/isa-inlines.h b/src/arm/isa-inlines.h index 0e837712f..19a92d0d9 100644 --- a/src/arm/isa-inlines.h +++ b/src/arm/isa-inlines.h @@ -68,14 +68,12 @@ #define ARM_WRITE_PC \ cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_ARM) + WORD_SIZE_ARM; \ cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); \ - cpu->memory->loadU16(cpu->memory, cpu->gprs[ARM_PC], &cpu->cycles); \ - cpu->cycles += 2 + cpu->memory->activePrefetchCycles32; + cpu->cycles += 1 + cpu->memory->activePrefetchCycles32; #define THUMB_WRITE_PC \ cpu->gprs[ARM_PC] = (cpu->gprs[ARM_PC] & -WORD_SIZE_THUMB) + WORD_SIZE_THUMB; \ cpu->memory->setActiveRegion(cpu->memory, cpu->gprs[ARM_PC]); \ - cpu->memory->load32(cpu->memory, cpu->gprs[ARM_PC], &cpu->cycles); \ - cpu->cycles += 2 + cpu->memory->activePrefetchCycles16; + cpu->cycles += 1 + cpu->memory->activePrefetchCycles16; static inline int _ARMModeHasSPSR(enum PrivilegeMode mode) { return mode != MODE_SYSTEM && mode != MODE_USER; diff --git a/src/gba/gba-memory.c b/src/gba/gba-memory.c index 3213437e8..f7e166eb7 100644 --- a/src/gba/gba-memory.c +++ b/src/gba/gba-memory.c @@ -109,6 +109,7 @@ static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t address) { memory->activeMask = 0; break; } + gbaMemory->p->cpu.cycles += 1 + (gbaMemory->p->cpu.executionMode == MODE_ARM ? gbaMemory->waitstates32[address >> BASE_OFFSET] : gbaMemory->waitstates16[address >> BASE_OFFSET]); } int32_t GBALoad32(struct ARMMemory* memory, uint32_t address, int* cycleCounter) {