Everything
9.1.1.1 General registers AX, BC, DE, and HL

This specification does not guarantee that each of the general registers AX, BC, DE, and HL has the same value before and after function calls.

Only the general registers that belong to the register bank being used are guaranteed to have the same values before and after interrupts. The following two methods can be used to guarantee the values.

-

Using a stack area

Save the register value in a stack area when an interrupt occurs, and restore the value from the stack area when the interrupt ends. This method is also used for registers other than general registers described later.

-

Using the register bank changing function

The register bank specification function of the #pragma directives for interrupt allows you to effectively save and restore general register values by changing the register bank without using a stack area.

The following describes the cautions about using register bank switching. If these cautions are not observed, the register values are not guaranteed to be the same before and after interrupts.

-

Do not change the register bank within an interrupt handler without using the #pragma directives for interrupt.

-

Do not return from within an interrupt handler by using any method other than the return statement.

-

Do not change to the same register bank as the interrupt source.

If nested interrupts are used, the first interrupt source and all interrupt handlers up to the return to the source must use different register banks.