|
Re: Trying to follow C18 interrupt context code...
Bud,
I think the confusion is in the "MOVF 0xfe6, F, ACCESS" statement. The only purpose of this line is to increment FSR1 register (stack pointer) or in your notation (SP)++. Technically, it modifies the status register as well, but it's not used in this case. This line enables the code to go from pre-incrementing the stack pointer in the previous lines, to post incrementing the stack pointer in later lines. If they didn't do this, then the same register would get overwritten during the switch. It has nothing to do with actually saving any registers or the PRODH register.
When restoring the context, the equivilent MOVF statment just decrements the stack pointer. Hopefully, this will make things a little clearer.
Mike
Last edited by Mike Bortfeldt : 20-12-2006 at 18:43.
|