Tighter looping for ARMRun

This commit is contained in:
Jeffrey Pfau 2014-08-28 05:00:38 -07:00
parent 61c410154f
commit 433f0ba360
3 changed files with 13 additions and 1 deletions

View File

@ -291,3 +291,14 @@ void ARMRun(struct ARMCore* cpu) {
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);
}

View File

@ -156,5 +156,6 @@ void ARMRaiseIRQ(struct ARMCore*);
void ARMRaiseSWI(struct ARMCore*);
void ARMRun(struct ARMCore* cpu);
void ARMRunLoop(struct ARMCore* cpu);
#endif

View File

@ -167,7 +167,7 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
}
} else {
while (threadContext->state == THREAD_RUNNING) {
ARMRun(&cpu);
ARMRunLoop(&cpu);
}
}