9.1.3.4 Fast Register Stack

There are three levels of fast stack registers available - one for CALL type instructions and two for interrupts. A fast register stack is provided for the STATUS, WREG and BSR registers, to provide a “fast return” option for interrupts. It is loaded with the current value of the corresponding register when the processor vectors for an interrupt. All interrupt sources will push values into the stack registers. The values in the registers are then loaded back into their associated registers if the RETFIE, FAST instruction is used to return from the interrupt. Refer to the “Call Shadow Register” section for interrupt call shadow registers.

The following example shows a source code example that uses the Fast Register Stack during a subroutine call and return.

Fast Register Stack Code Example

CALL SUB1, FAST  ;STATUS, WREG, BSR SAVED IN FAST REGISTER STACK
         •
         •
SUB1:
         •
         •
     RETURN, FAST     ;RESTORE VALUES SAVED IN FAST REGISTER STACK