9.1.1.2 Registers whose values are guaranteed before and after interrupts

Some general-purpose registers are guaranteed to have the same values before and after interrupts, and others are not. The rules for guaranteeing register values are as follows.

(1)

Registers guaranteed to have the same values before and after interrupts

ES, CS, and general registers AX, BC, DE, and HL which belong to the register bank being usedNote

Note

Since #pragma interrupt with register bank changing option is transformed to the codes which changes the register bank when an interrupt begins and restores to original bank when the interrupt ends, alll general registers belonging to the original register bank are guaranteed to have the same values before and after the interrupt.
On the other hand, if the register bank is changed within an interrupt handler without using #pragma interrupt or if an #pragma interrupt is used but returning is to be performed by another method than return instruction, general registers are not guaranteed to have the same values before and after the interrupt.

(2)

Registers not guaranteed to have the same values before and after interrupts

General registers AX, BC, DE, and HL which belong to the register bank not being used