| |
TWW
Registered: Jul 2009 Posts: 545 |
NMI Grounding vs. IRQ Raster interrupts
Ello'
Right!
So If You ground an NMI (trigger it and don't acknowledge it) how come IRQ's are allowed?
Simple, You do the RTI which ends the NMI code but don't ack. the NMI 8-D
Can't for the life of me understand why people don't get that ;-)
cheers! |
|
| |
Ventura Account closed
Registered: Jan 2006 Posts: 67 |
NMI = Non Maskable Interrupt, it's oblivious to the interrupt flag: SEI, CLI all you want.
When the NMI doesn't get acknowledged you can always set the timer to count for you, usefull for DYSP w. sideborder?.
cheers back!
|
| |
ready.
Registered: Feb 2003 Posts: 441 |
Quote:So If You ground an NMI (trigger it and don't acknowledge it) how come IRQ's are allowed?
to be precise, the IRQs are not allowed until the RTI of the NMI. While the NMI is being executed (i.e. before RTI), no IRQ will be served.
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
I added a little section about this at the end of Ninja's article on how to block NMI's in case people may wonder about this in the future. Feel free to modify it in case you think I didn't explain it good enough.
http://codebase64.org/doku.php?id=base:nmi_lock |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Quote: Quote:So If You ground an NMI (trigger it and don't acknowledge it) how come IRQ's are allowed?
to be precise, the IRQs are not allowed until the RTI of the NMI. While the NMI is being executed (i.e. before RTI), no IRQ will be served.
Which I believe was excatly the same as my conclusion:
"Simple, You do the RTI which ends the NMI code but don't ack. the NMI 8-D"
So yes you are excatly right :-)
@ Frantic: Looks good and detailed too me 8-b |
| |
Ventura Account closed
Registered: Jan 2006 Posts: 67 |
TWW: You beat me to it, but reading that article raises a question:
Does all that talk in the article either confuse or clarify things for people who like to know?. |
| |
assiduous Account closed
Registered: Jun 2007 Posts: 343 |
Quoting ready.to be precise, the IRQs are not allowed until the RTI of the NMI. While the NMI is being executed (i.e. before RTI), no IRQ will be served.
to be even more precise IRQs are not allowed until the interrupt mask flag of CPU is cleared. when a NMI starts the I flag is set automatically and RTI clears the I flag among other things. if you clear the mask manually (using CLI) before quitting the NMI code with RTI,you can serve IRQs while executing your NMI. |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Quote: Quoting ready.to be precise, the IRQs are not allowed until the RTI of the NMI. While the NMI is being executed (i.e. before RTI), no IRQ will be served.
to be even more precise IRQs are not allowed until the interrupt mask flag of CPU is cleared. when a NMI starts the I flag is set automatically and RTI clears the I flag among other things. if you clear the mask manually (using CLI) before quitting the NMI code with RTI,you can serve IRQs while executing your NMI.
No shit...
A CLI inside a NMI allows IRQs... Shit my head is spinning now.....
I guess you'd need to pay special attention to the stack O.o
|
| |
assiduous Account closed
Registered: Jun 2007 Posts: 343 |
usually you dont need any other interrupts during nmi. but it may be useful if you want to keep related code in 1 block for clarity. for example in your nmi routine:-
1. a block of code that shouldnt be interrupted by any irq
2. cli (I flag cleared)
3. a block of code related to the one above where irqs are expected and can take priority
4. rti
since stack works on the last in first out basis you dont need any special handling |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Alright.
What if you got one IRQ running, then NMI occurs on top then you CLI inside the NMI, the "old IRQ" would have higer priority then the NMI?
What about BRK interrupt in all this? |
| |
assiduous Account closed
Registered: Jun 2007 Posts: 343 |
Quote:What if you got one IRQ running, then NMI occurs on top then you CLI inside the NMI, the "old IRQ" would have higer priority then the NMI?
its not a matter of priority (the old irq source can be acknowlegded so even with the interrupt mask cleared the old irq wouldnt be retriggered) but irqs(and brk) share the same vector so any new irqs would land at the beginning of the old irq code and you probably wouldnt want it. allowing irqs in the nmi code is a risky thing and unless you can perfectly predict the outcome it should be avoided. im saying it can be done only as a fun fact- to explain whats the reason behind rti allowing new irqs on the hardware level =) |
... 9 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |