all repos — mgba @ 845d6e1d24d38d8bc71a2d14fa88ccbeb9f863ad

mGBA Game Boy Advance Emulator

ARM: Run tighter loop in CPU
Jeffrey Pfau jeffrey@endrift.com
Sun, 16 Nov 2014 20:51:36 -0800
commit

845d6e1d24d38d8bc71a2d14fa88ccbeb9f863ad

parent

888b64f8b5b5cee593550ebce09df600e38b2422

2 files changed, 6 insertions(+), 3 deletions(-)

jump to
M src/arm/arm.csrc/arm/arm.c

@@ -290,10 +290,12 @@ }

} 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); } }
M src/arm/isa-inlines.hsrc/arm/isa-inlines.h

@@ -74,6 +74,7 @@ break;

case MODE_THUMB: cpu->cpsr.t = 1; } + cpu->nextEvent = 0; } static inline void _ARMReadCPSR(struct ARMCore* cpu) {