all repos — mgba @ 433f0ba360002c2bf210ab1a4eab6e6e595a5b8d

mGBA Game Boy Advance Emulator

Tighter looping for ARMRun
Jeffrey Pfau jeffrey@endrift.com
Thu, 28 Aug 2014 05:00:38 -0700
commit

433f0ba360002c2bf210ab1a4eab6e6e595a5b8d

parent

61c410154f5d71731271287f4aae73bb8ed4f60f

3 files changed, 13 insertions(+), 1 deletions(-)

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

@@ -291,3 +291,14 @@ if (cpu->cycles >= cpu->nextEvent) {

cpu->irqh.processEvents(cpu); } } + +void ARMRunLoop(struct ARMCore* cpu) { + while (cpu->cycles < cpu->nextEvent) { + if (cpu->executionMode == MODE_THUMB) { + ThumbStep(cpu); + } else { + ARMStep(cpu); + } + } + cpu->irqh.processEvents(cpu); +}
M src/arm/arm.hsrc/arm/arm.h

@@ -156,5 +156,6 @@ void ARMRaiseIRQ(struct ARMCore*);

void ARMRaiseSWI(struct ARMCore*); void ARMRun(struct ARMCore* cpu); +void ARMRunLoop(struct ARMCore* cpu); #endif
M src/gba/gba-thread.csrc/gba/gba-thread.c

@@ -167,7 +167,7 @@ _changeState(threadContext, THREAD_EXITING, false);

} } else { while (threadContext->state == THREAD_RUNNING) { - ARMRun(&cpu); + ARMRunLoop(&cpu); } }