I was looking up documentation on how to use the WAI instruction, when I noticed that the emulator wasn't handling it correctly when the interrupt disable flag was set. Multiple sources I checked indicated that if the interrupt disable flag is set when calling WAI, then the interrupt handler won't be called on an IRQ, but the WAI will end and continue execution from where it was. This PR moves the check for the interrupt disable flag from main.c to cpu/fake6502.c, where it can still set waiting to zero independent of the interrupt disable flag's status.
I was looking up documentation on how to use the
WAI
instruction, when I noticed that the emulator wasn't handling it correctly when the interrupt disable flag was set. Multiple sources I checked indicated that if the interrupt disable flag is set when callingWAI
, then the interrupt handler won't be called on an IRQ, but theWAI
will end and continue execution from where it was. This PR moves the check for the interrupt disable flag frommain.c
tocpu/fake6502.c
, where it can still setwaiting
to zero independent of the interrupt disable flag's status.