Zilog Z16F2810 User Manual
Page 117

UM018809-0611
DJNZ Instruction
ZNEO
®
CPU Core
User Manual
101
Flags are set based on the 32-bit decrement register value.
Syntax and Opcodes
Example
DJNZ controls a loop of instructions. In the following example, 9 words (18 bytes) are moved
from one buffer area in memory to another.
Instruction, Operands
Word 0
Word 1
Word 2
DJNZ Rd, urel4
{FDH, urel4, Rd}
LD R6, #9H
;Load word counter with 9H
Object Code: 3609
LEA R5, B024H:RAM
;Load source pointer
Object Code: 4515 B024
LEA R4, B036H:RAM
;Load destination pointer
Object Code: 4514 B036
LOOP: LD.UW R3, (R5++)
;Load word and inc R5
Object Code: 1B53
LD.W (R4++), R3
;Write word and inc R4
Object Code: 1734
DJNZ R6, LOOP
;Dec R6 and loop until
count=0
Object Code: FDD6
Note: