EasyManua.ls Logo

ZiLOG Z8 - Page 192

ZiLOG Z8
220 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Z8 Microcontrollers
Instruction Descriptions and Formats ZiLOG
12-52 UM001601-0803
RET
RETURN
RET
Return
RET
Instruction Format:
Operation:
PC <— @SP
SP <— SP + 2
This instruction is normally used to return from a procedure entered by a CALL instruction. The contents of the
location addressed by the SP are popped into the PC. The next statement executed is the one addressed by the new
contents of the PC. The stack pointer is also incremented by two.
Note:
Each PUSH instruction executed within the subroutine should be countered with a POP instruction in order to
guarantee the SP is at the correct location when the RET instruction is executed. Otherwise the wrong address will
be loaded into the PC and the program will not operate as desired.
Example:
If SP contains 2000H, external data memory location 2000H contains 18H, and location 2001H contains B5H, the
statement:
RET
Op Code: AF
leaves the value 2002H in the SP, and the PC contains 18B5H, the address of the next instruction to be executed.
Flags: C: Unaffected
Z: Unaffected
S: Unaffected
V: Unaffected
D: Unaffected
H: Unaffected

Table of Contents

Other manuals for ZiLOG Z8

Related product manuals