beautypg.com

Djnz, e – Zilog Z08470 User Manual

Page 287

background image

UM008007-0715

Z80 Instruction Description

Z80 CPU

User Manual

275

DJNZ, e

Operation

B ← B –

1

If B = 0, continue

If B ≠ 0, PC ← PC + e

Op Code

DJNZ

Operand

e

Description

This instruction is similar to the conditional jump instructions except that a register value
is used to determine branching. Register B is decremented, and if a nonzero value remains,
the value of displacement e is added to the Program Counter (PC). The next instruction is
fetched from the location designated by the new contents of the PC. The jump is measured
from the address of the instruction op code and contains a range of –126 to +129 bytes.
The assembler automatically adjusts for the twice incremented PC.

If the result of decrementing leaves B with a zero value, the next instruction executed is
taken from the location following this instruction.

if B ≠

0:

If B = 0:

M Cycles

T States

4 MHz E.T.

3

13 (5,3, 5)

3.25

M Cycles

T States

4 MHz E.T.

2

8 (5, 3)

2.00

0

0

1

0

0

0

0

0

10

e–2

This manual is related to the following products: