
UM012811-0904
eZ8 CPU Instruction Set Description
eZ8 CPU
User Manual
106
DJNZ
Decrement and Jump if Non-Zero
DJNZ dst, RA
Operation
dst
←
dst -1
if dst
≠
0 {
PC
←
PC + X
}
where the jump offset, X, is calculated by the eZ8 CPU assembler from the Program
Counter (PC) value and the Destination Address (DA).
Description
The Working Register that is used as a counter is decremented. If the contents of the
Working Register are not zero after being decremented, then the relative address is added
to the Program Counter and control passes to the statement whose address is now in the
Program Counter. The range of the relative address is +127 to -128. The original value of
the Program Counter is the address of the instruction byte following the DJNZ statement.
When the specified Working Register counter reaches zero, control falls through to the
statement following the DJNZ instruction.
Flags
C
Unaffected.
Z
Unaffected.
S
Unaffected.
V
Unaffected.
D
Unaffected.
H
Unaffected.