Page 1 of 1

Quick NMI/endless loop question

Posted: Mon Sep 18, 2006 3:25 pm
by Celius
Hello.

I have a really quick question about dealing with endless loops and NMIs. So you have an endless loop checking if a byte is a certain value, like this:

loop:
lda $FF
bpl loop
blah blah code

It's checking if $FF is below $80, so when it isn't, then the code afterwards can be executed. I know that you have to save the A, X, and Y registers if you want them to be the same at the beggining of your NMI routine. But, is it possible for something like this to happen?:

loop:
lda (NMI happens here) $FF
bpl loop

Where it would completely ruin everything? Or does the 6502 do an instruction along with it's value at the same time?

Posted: Mon Sep 18, 2006 3:28 pm
by Quietust
Interrupts can never occur in the middle of an instruction, if that's what you're asking.

Posted: Mon Sep 18, 2006 7:07 pm
by Celius
Okay, thanks! That is what I was wondering.