Ret cc – Zilog Z08470 User Manual

Page 295

Advertising
background image

UM008007-0715

Z80 Instruction Description

Z80 CPU

User Manual

283

RET cc

Operation

If cc true: PCL ← (sp), pCH ← (sp+1)

Op Code

RET

Operand

cc

Description

If condition cc is true, 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 Coun-
ter (PC). The SP is incremented and the byte at the memory location specified by the new
contents of the SP are moved to the high-order eight bits of the PC. The SP is incremented
again. The next op code following 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. If condition cc is false, the PC
is simply incremented as usual, and the program continues with the next sequential
instruction. Condition cc is programmed as one of eight status that correspond to condition
bits in the Flag Register (Register F). These eight status are defined in the following table,
which also specifies the corresponding cc bit fields in the assembled object code.

cc

Condition

Relevant

Flag

000

Non-Zero (NZ)

Z

001

Zero (Z)

Z

010

Non Carry (NC)

C

011

Carry (C)

C

100

Parity Odd (PO)

P/V

101

Parity Even (PE)

P/V

110

Sign Positive (P)

S

111

Sign Negative (M)

S

1

1

0

0

0

cc

Advertising
This manual is related to the following products: