### `#pragma saved_regs register,register,register, ..`

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:

1. Data was saved in the stack frame of the function, so the available space on the stack was reduced,
2. because data was saved after the local variables, these variables were not properly managed by the compiler. It was indeed a very bad feature, because the code of ISRs was obliged to use only global variables.

With the new pragma, registers are saved before the stack frame, so the two previous defaults disappear.

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 source code if you are not happy with the standard registers list. Note that doing such a redefinition does not add new registers, but replace the previous ones. It means that you can easily turn off all the registers savings with:

    #pragma saved_regs

Also remember that the registers used by FP calculation are not saved if you use the standard registers list, so if an ISR performs FP calculations, 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 (`INTCON`x or `PIR`x) because, as stated in the documentation, they cannot be manipulated with the `movff` instruction.

#### Footnotes

... pragma 4
  However, it is generally not a good idea to perform complex calculations in an interrupt service routine.