aboutsummaryrefslogtreecommitdiff
path: root/src/ARM.cpp
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2020-07-28 00:44:58 +0200
committerRSDuck <rsduck@users.noreply.github.com>2020-07-28 00:44:58 +0200
commitf56aa60eb693ed41212960db60e01ceecf5d64c5 (patch)
treee61479f88a19c13b68bcf07a5a2c781649da00a8 /src/ARM.cpp
parentea734084cad4334e0a1247be99320e37f3bd2ee1 (diff)
check IRQ first then Idle loop
apparently I put it this way for a reason
Diffstat (limited to 'src/ARM.cpp')
-rw-r--r--src/ARM.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp
index c1743ea..7eeacb7 100644
--- a/src/ARM.cpp
+++ b/src/ARM.cpp
@@ -660,19 +660,20 @@ void ARMv5::ExecuteJIT()
if (StopExecution)
{
+ // this order is crucial otherwise idle loops waiting for an IRQ won't function
+ if (IRQ)
+ TriggerIRQ();
+
if (Halted || IdleLoop)
{
- bool idleLoop = IdleLoop;
- IdleLoop = 0;
- if ((Halted == 1 || idleLoop) && NDS::ARM9Timestamp < NDS::ARM9Target)
+ if ((Halted == 1 || IdleLoop) && NDS::ARM9Timestamp < NDS::ARM9Target)
{
+ Cycles = 0;
NDS::ARM9Timestamp = NDS::ARM9Target;
}
+ IdleLoop = 0;
break;
}
-
- if (IRQ)
- TriggerIRQ();
}
NDS::ARM9Timestamp += Cycles;
@@ -808,22 +809,21 @@ void ARMv4::ExecuteJIT()
else
ARMJIT::CompileBlock(this);
- // TODO optimize this shit!!!
if (StopExecution)
{
+ if (IRQ)
+ TriggerIRQ();
+
if (Halted || IdleLoop)
{
- bool idleLoop = IdleLoop;
- IdleLoop = 0;
- if ((Halted == 1 || idleLoop) && NDS::ARM7Timestamp < NDS::ARM7Target)
+ if ((Halted == 1 || IdleLoop) && NDS::ARM7Timestamp < NDS::ARM7Target)
{
+ Cycles = 0;
NDS::ARM7Timestamp = NDS::ARM7Target;
}
+ IdleLoop = 0;
break;
}
-
- if (IRQ)
- TriggerIRQ();
}
NDS::ARM7Timestamp += Cycles;