A83: EXX and EX af, af'


[Prev][Next][Index][Thread]

A83: EXX and EX af, af'




I don't completely understand the commands EXX and EX af, af'... Im aware that
they are used to swap all the 16-Bit registers with their shadow registers,
and that I should disable interrupts to use them... I've heard that sometimes
a person will use these commands Instead of sequences of push/pops if they
need to save these values, usually if they are calling a routine that will
mess up those registers. The problem I think may occur is that if I want to
save the values for After that routine BUT I still need those values For the
routine, I don't think EXX and EX af, af' will work because those commands
simply Swap the registers, and I can't be sure of what is Currently in the
Shadow registers... I suppose I could push all the 16-Bit registers, then EXX
& EX af, af' and then pop everything again to get the Same values into the
normal registers And their shadow ones, but this would defeat the purpose then
because I would still be going through a sequence of push/pops. =P  How do I
really use the commands EXX and EX af, af' to my advantage...? 
														--Jason K.