UM012811-0904
eZ8 CPU Instruction Set Description
eZ8 CPU
User Manual
156
RET
Return
RET
Operation
PC
←
@SP
SP
←
SP + 2
Description
This instruction returns from a procedure entered by a CALL instruction. The contents of
the location addressed by the Stack Pointer are loaded into the Program Counter. The next
statement executed is the one addressed by the new contents of the Program Counter. The
Stack Pointer also increments by two.
Flags
Any PUSH instruction executed within the subroutine must be countered with a POP instruction to
guarantee the Stack Pointer is at the correct location when the RET instruction is executed.
Otherwise, the wrong address loads into the Program Counter and the program cannot operate
properly.
Attributes
Example
If Stack Pointer contains the value
01A0H
, register memory location 01A0 contains the
value
30H
and location 01A1 contains the value
15H
, the statement:
RET
Object Code: AF
leaves the value 01A2 in the SP, and the PC contains the value
3015H
, the address of the
next instruction to be executed.
C
Unaffected.
Z
Unaffected.
S
Unaffected.
V
Unaffected.
D
Unaffected.
H
Unaffected.
Mnemonic
Destination, Source
Opcode (Hex)
Operand 1
Operand 2
Operand 3
RET
—
AF
—
—
—
Note: