dsp56800 Freescale Semiconductor, Inc, dsp56800 Datasheet - Page 379

no-image

dsp56800

Manufacturer Part Number
dsp56800
Description
16-bit Digital Signal Controllers
Manufacturer
Freescale Semiconductor, Inc
Datasheet
RTS
Operation:
X:(SP) → (stored SR; discarded); SP-1→ SP
X:(SP) → PC; SP-1→ SP
Description: Return from a call to a subroutine. To perform the return, RTS pulls and discards the previously pushed
Example:
Explanation of Example:
Restrictions:
Condition Codes Affected:
Instruction Fields:
Timing:
Memory:
Freescale Semiconductor
Operation
RTS
SR and pops the PC from the software stack. The previous PC is lost. The generated SR from the called
function is not affected.
RTS
The example makes the assumption that during entry of the subroutine, only the LF bit (SR bit 15) is
on. During execution of the subroutine, the C and N bits were set. To perform the return, RTS pops the
16-bit PC from the software stack, and updates the SP. Program execution continues at $754C.
Due to pipelining in the program controller and the fact that the RTS instruction accesses certain pro-
gram controller registers, the RTS instruction must not be immediately preceded by the following in-
struction:
An RTS instruction cannot be the last instruction in a DO loop (at the LA).
An RTS instruction cannot be repeated using the REP instruction.
Manipulation of bits 10-14 in the stack location corresponding to the SR register may generate unwant-
ed behavior. These bits will read as zero during DSC read operations and should be written as zero to
ensure future compatibility.
The condition codes are not affected by this instruction.
10 + rx oscillator clock cycles
1 program word
Before Execution
X:$00FF
X:$0100
SR
SP
MOVE(C) to the SP
Operands
754C
8000
8009
0100
Return from Subroutine
Instruction Set Details
10
C
Assembler Syntax:
RTS
W
1
Return from subroutine, restoring 16-bit PC from the
stack
After Execution
X:$00FF
X:$0100
; pull SR (and discard it) &
; pull PC from the stack
SR
SP
Comments
754C
00FE
8000
8009
RTS
A-149

Related parts for dsp56800