diff --git a/src/arm/arm.c b/src/arm/arm.c index c31c91997..fe6bf10c2 100644 --- a/src/arm/arm.c +++ b/src/arm/arm.c @@ -290,10 +290,12 @@ void ARMRun(struct ARMCore* cpu) { } void ARMRunLoop(struct ARMCore* cpu) { - while (cpu->cycles < cpu->nextEvent) { - if (cpu->executionMode == MODE_THUMB) { + if (cpu->executionMode == MODE_THUMB) { + while (cpu->cycles < cpu->nextEvent) { ThumbStep(cpu); - } else { + } + } else { + while (cpu->cycles < cpu->nextEvent) { ARMStep(cpu); } } diff --git a/src/arm/isa-inlines.h b/src/arm/isa-inlines.h index 1ef92caf8..d2657cffa 100644 --- a/src/arm/isa-inlines.h +++ b/src/arm/isa-inlines.h @@ -74,6 +74,7 @@ static inline void _ARMSetMode(struct ARMCore* cpu, enum ExecutionMode execution case MODE_THUMB: cpu->cpsr.t = 1; } + cpu->nextEvent = 0; } static inline void _ARMReadCPSR(struct ARMCore* cpu) {