The RETI instruction is used to end an interrupt service routine.
This instruction pops the high-order and low-order bytes of the PC (and decrements the stack pointer by 2) and restores the interrput logic to accept additional interrupts.
No other registers are affected by this instruction.
The RETI instruction does not restore the PSW to its value before the interrupt.
The interrupt service routine must save and restore the PSW.
Execution returns to the instruction immediately after the point at which the interrupt was detected.
If another interrupt was pending when the RETI instruction is executed, one instruction at the return address is executed before the pending interrupt is processed.
RETI ;1 byte 2 cycles