Instruction Set Description
267
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
CPUX
4.6.4.9
RETA
* RETA
Return from subroutine
Syntax
RETA
Operation
@SP
→
PC.15:0 LSBs (15:0) of saved PC to PC.15:0
SP + 2
→
SP
@SP
→
PC.19:16 MSBs (19:16) of saved PC to PC.19:16
SP + 2
→
SP
Emulation
MOVA @SP+,PC
Description
The 20-bit return address information, pushed onto the stack by a CALLA instruction, is
restored to the PC. The program continues at the address following the subroutine call.
The SR bits SR.11:0 are not affected. This allows the transfer of information with these
bits.
Status Bits
N:
Not affected
Z:
Not affected
C:
Not affected
V:
Not affected
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
Call a subroutine SUBR from anywhere in the 20-bit address space and return to the
address after the CALLA
CALLA
#SUBR
; Call subroutine starting at SUBR
...
; Return by RETA to here
SUBR
PUSHM.A
#2,R14
; Save R14 and R13 (20 bit data)
...
; Subroutine code
POPM.A
#2,R14
; Restore R13 and R14 (20 bit data)
RETA
; Return (to full address space)