Instruction Set Description
197
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
CPUX
4.6.2.37 RETI
RETI
Return from interrupt
Syntax
RETI
Operation
@SP
→
SR.15:0
SP + 2
→
SP
Restore saved SR with PC.19:16
@SP
→
PC.15:0
SP + 2
→
SP
Restore saved PC.15:0
Housekeeping
Description
The SR is restored to the value at the beginning of the interrupt service routine. This
includes the 4 MSBs of the PC.19:16. The SP is incremented by 2 afterward.
The 20-bit PC is restored from PC.19:16 (from same stack location as the status bits)
and PC.15:0. The 20-bit PC is restored to the value at the beginning of the interrupt
service routine. The program continues at the address following the last executed
instruction when the interrupt was granted. The SP is incremented by 2 afterward. No
interrupt flags are modified by this command.
Status Bits
N:
Restored from stack
C:
Restored from stack
Z:
Restored from stack
V:
Restored from stack
Mode Bits
OSCOFF, CPUOFF, and GIE are restored from stack.
Example
Interrupt handler in the lower 64 K. A 20-bit return address is stored on the stack.
INTRPT
PUSHM.A
#2,R14
; Save R14 and R13 (20-bit data)
...
; Interrupt handler code
POPM.A
#2,R14
; Restore R13 and R14 (20-bit data)
RETI
; Return to 20-bit address in full memory range