On NMOS, if NMI is asserted during the first 4 ticks of a BRK instruction, the BRK instruction will execute normally at first (PC increments will occur and P will be pushed with the BF flag set), but execution will branch to the NMI vector instead of the IRQ/BRK vector. On CMOS, this situation is correctly handled by executing BRK and then servicing the interrupt.
Similarly, an NMI can hijack an IRQ, and an An IRQ can also hijack a BRK (, though it won't be as visible since they use the same interrupt vector).
This Similarly, an NMI can hijack an IRQ. But this is not usually a problem for an IRQ interrupted by an NMI because the IRQ will normally still be asserted when the NMI returns and generate a new interrupt. The BRK instruction, however, can effectively be cancelled by an NMI (or an IRQ) this way, so code utilizing BRK should be careful not to have a chance of coinciding with an NMI.
<br>