commanderx16 / x16-emulator

Emulator for the Commander X16 8-bit computer
383 stars 60 forks source link

Clear waiting with disabled interrupt #434

Closed LRFLEW closed 1 year ago

LRFLEW commented 1 year ago

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.