Ret Return - Samsung S3P80C5 User Manual

8-bit cmos microcontrollers
Table of Contents

Advertisement

INSTRUCTION SET
RET
— Return
RET
PC ← @SP
Operation:
SP ← SP + 2
The RET instruction is normally used to return to the previously executing procedure at the end
of a 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 that is executed is the
one that is addressed by the new program counter value.
Flags:
No flags are affected.
Format:
opc
Example:
Given: SP = 00FCH, (SP) = 101AH, and PC = 1234:
RET
The statement "RET" pops the contents of stack pointer location 00FCH (10H) into the high byte
of the program counter. The stack pointer then pops the value in location 00FEH (1AH) into the
PC's low byte and the instruction at location 101AH is executed. The stack pointer now points to
memory location 00FEH.
6-70
PC = 101AH, SP = 00FEH
Bytes
Cycles
1
8 (internal stack)
10 (internal stack)
S3P80C5/C80C5/C80C8
Opcode (Hex)
AF

Advertisement

Table of Contents
loading

This manual is also suitable for:

S3c80c5S3c80c8

Table of Contents