OneLoneCoder / olcNES

NES Emulator, and Tutorial Video Code
1.35k stars 225 forks source link

RTI #19

Open ch570512 opened 4 years ago

ch570512 commented 4 years ago

I guess RTI should not restore the Interrupt flag because when I unset it with CLI and then RTI from the Interrupt routine it is set again bacause it was saved when entering the IRQ.

OR the IRQ routine may simply set the I flag after the Status-Register is saved. Same with NMI.

EDIT: Found this in the datasheet :) The Program Counter and Processor Status Register are stored in the stack. The microprocessor will then set the interrupt mask flag high so that no further interrupts may occur.