From what I could gather the Z80 NMI interrupt (0x66) is triggered from an edge detection of the NMI pin. What happens when another edge is detected when still inside the NMI handler code (RETN has not executed yet)?
Is NMI reentrant and will the Z80 just push the current address on the stack and start at 0x66 again?
My reading is that a second NMI would interrupt processing of the first. The only special thing that NMI processing does to avoid additional interruption is back up IFF1 to IFF2 and then set IFF1 (with RETN
s special feature being restoration in the other direction). But that won't prohibit NMIs. So there is no mechanism by which a future NMI will be ignored.
This is lightly backed up in the literature, albeit subtlely — e.g. "This negative edge triggered interrupt cannot be disabled under program control and will be accepted at any time by the CPU to be honored at the completion of the current instruction (if Bus Request not pending)"; emphasis added but also note that bus request has been pulled out as a special case with no mention of an existing NMI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With