DSP Core Reference Manual

A-372 SC140 DSP Core Reference Manual
RTSD
RTSD Return From Subroutine With Delay Slot (AGU) RTSD
Description
Status and Conditions that Affect Instruction
Status and Conditions Changed by Instruction
None.
Example
rtsd
Operation Assembler Syntax
If (RAS valid), then RAS PC;
else (SP – 8) PC;
always SP – 8 SP
RTSD
RTSD
Returns from a subroutine after executing the execution set in the delay slot. If the RAS is valid, the PC is
restored from the RAS. Otherwise, the PC is popped from the active stack in memory as a 32-bit long
word. The implicit pop is done before the execution set in the delay slot is executed. The stack pointer
always decrements by 8, RAS becomes invalid, and program execution continues at the address specified
in the PC.
Note: Because RTSD uses the RAS mechanism, returning from an exception using RTSD is illegal. The
result is undefined.
Register Address Bit Name Description
SR[18] EXP Determines which stack pointer is used.
Instruction Comment
Initially ESP = $2000
jsr SUB Jump to subroutine at SUB.
- - - Skip over these instructions.
SUB MOVE.w #$20,d1 Execute the subroutine here. PC and SR pushed onto the
stack at $2000 and $2004.
- - -
rtsd move.w #$47,d9
inc d9
Execute the $47 to d9 and increment d9 to $48, the instruc-
tion in the delay slot. Return from the subroutine. PC and
SR popped from the stack.