; NMI behavior when it interrupts BRK. Occasionally fails on ; NES due to PPU-CPU synchronization. ; ; Result when run: ; NMI BRK -- ; 27 36 00 NMI before CLC ; 26 36 00 NMI after CLC ; 26 36 00 ; 36 00 00 NMI interrupting BRK, with B bit set on stack ; 36 00 00 ; 36 00 00 ; 36 00 00 ; 36 00 00 ; 27 36 00 NMI after SEC at beginning of IRQ handler ; 27 36 00 CUSTOM_IRQ=1 CUSTOM_NMI=1 .include "shell.inc" .include "sync_vbl.s" zp_byte irq_flag ; IRQ sets this to saved flags on stack zp_byte irq_temp zp_byte nmi_flag ; NMI sets this to saved flags on stack zp_byte nmi_temp nmi: ; 7 sta