INSTRUCTION SET S3C84E5/C84E9/P84E9
6-70
RET Return
RET
Operation: PC @SP
SP SP + 2
The RET instruction is normally used to return to the previously executed procedure at the end of
the procedure entered by a CALL instruction. The contents of the location addressed by the stack
pointer are popped into the program counter. The next statement to be executed is the one that is
addressed by the new program counter value.
Flags: No flags are affected.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 10 AF
Example: Given: SP = 00FCH, (SP) = 101AH, and PC = 1234:
RET PC = 101AH, SP = 00FEH
The RET instruction pops the contents of the stack pointer location 00FCH (10H) into the high byte
of the program counter. The stack pointer then pops the value in the location 00FEH (1AH) into the
PC's low byte and the instruction at the location 101AH is executed. The stack pointer now points
to the memory location 00FEH.