beautypg.com

Zilog Z8F0130 User Manual

Page 222

background image

eZ8

CPU Core

User Manual

UM012820-0810

RET Instruction

207

RET

Definition

Return.

Syntax

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 oper-
ate properly.

C

Unaffected

Z

Unaffected

S

Unaffected

V

Unaffected

D

Unaffected

H

Unaffected

Note: