Propeller Manual

Table Of Contents
JMPRET – Assembly Language Reference
Page 300 · Propeller Manual v1.1
JMPRET
Instruction: Jump to address with intention to “return” to another address.
JMPRET RetInstAddr, # DestAddress
Result: PC + 1 is written to the s-field of the register indicated by the d-field.
RetInstAddr (d-field) is the register in which to store the return address (PC + 1); often
it is the address of an appropriate
RET or JMP instruction executed by the DestAddress
routine.
DestAddress (s-field) is the register or 9-bit literal whose value is the address of the
routine to temporarily execute.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– Z Result C Result Result Clocks
010111 001i 1111 ddddddddd sssssssss
Result = 0 --- Written 4
Concise Truth Table:
In Out
Destination Source Z
C
Effects
Destination
1
Z C
2
$----_----; - $----_----; - -
-
wz wc
31:9 unchanged, 8:0 = PC+1 0 1
1
The Destination register’s s-field (lowest 9 bits) are overwritten with the return address (PC+1) at run-time.
2
The C flag is set (1) unless PC+1 equals 0; very unlikely since it would require the JMPRET to be executed from the top of cog RAM
($1FF; special purpose register VSCL).
Explanation
JMPRET (jump and return) provides a mechanism to “call” other routines and eventually return
to the instruction that follows the
JMPRET. For normal subroutine calls, use the CALL
instruction instead since it serves a function similar to its namesake in other processors. The
JMPRET instruction provides additional power beyond simple “calling” to execute multiple
routines in a task switching manner.
T
The Propeller hardware does not use a call stack, so the return address of a call-type operation
must be stored in a different manner. At run time the
JMPRET instruction stores the address of
the next instruction (PC + 1) into the source (s-field) of the register at RetInstAddr, then
jumps to DestAddress.
If the RetInstAddr register contains a RET or JMP instruction and it is eventually executed by
the DestAddress routine, the behavior is similar to a
CALL instruction; the return address is