Datasheet

www.ti.com
Instruction Set Description
4.6.4.9 RETA
* RETA Return from subroutine
RETA
Syntax
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
MOVA @SP+,PC
Emulation
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)
269
SLAU144JDecember 2004Revised July 2013 CPUX
Submit Documentation Feedback
Copyright © 2004–2013, Texas Instruments Incorporated