PCl <- (SP), PCh <- (SP+1)
RET
none
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | $C9 |
The byte at the memory location specified by the contents of the Stack Pointer (SP) Register pair is moved to the low-order eight bits of the Program Counter (PC). The SP is now incremented and the byte at the memory location specified by the new contents of this instruction is fetched from the memory location specified by the PC. This instruction is normally used to return to the main line program at the completion of a routine entered by a CALL instruction.
None
The Program Counter contains $3535, the Stack Pointer contains $2000, memory location $2000 contains $B5, and memory location $2001 contains $18. Upon the execution of
RET
the Stack Pointer contains $2002 and the Program Counter contains $18B5, thereby pointing to the address of the next program op code to be fetched.