ARM: Run tighter loop in CPU

This commit is contained in:
Jeffrey Pfau 2014-11-16 20:51:36 -08:00
parent 888b64f8b5
commit 845d6e1d24
2 changed files with 6 additions and 3 deletions

View File

@ -290,10 +290,12 @@ void ARMRun(struct ARMCore* cpu) {
} }
void ARMRunLoop(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); ThumbStep(cpu);
}
} else { } else {
while (cpu->cycles < cpu->nextEvent) {
ARMStep(cpu); ARMStep(cpu);
} }
} }

View File

@ -74,6 +74,7 @@ static inline void _ARMSetMode(struct ARMCore* cpu, enum ExecutionMode execution
case MODE_THUMB: case MODE_THUMB:
cpu->cpsr.t = 1; cpu->cpsr.t = 1;
} }
cpu->nextEvent = 0;
} }
static inline void _ARMReadCPSR(struct ARMCore* cpu) { static inline void _ARMReadCPSR(struct ARMCore* cpu) {