Since version 0.7.3, the SAVE_REGS and RESTORE_REGS macro are suppressed. These macros were used to save and restore the data modified by an Interrupt Service Routine on to the stack. However, this kind of context saving had two disadvantages:
The following saved_regs pragma is provided in the <interrupt.h> header:
#pragma saved_regs _r0,_r0+1,_r1,_r1+1,_r2,_r2+1,_r3,_r3+1,PRODL,PRODH
You can redefine this pragma just before an ISR routine if you are not happy with the standard registers list. Note that doing such a redefinition does not expand the previous list of registers, but creates a new list. It means that you can easily turn off all the registers savings with:
#pragma saved_regs
Also remember that the registers used by the floating point routines are not saved if you use the standard registers list, so if an ISR performs floating point maths, you will have to use this pragma4.
The register specification can be any expression or address that refers to a valid location in memory because data is pushed with a movff instruction, that can access any page. However, never use this pragma to save any interrupt control registers (INTCONx or PIRx) because, as stated in the documentation, they cannot be manipulated with the movff instruction. |