English
Language : 

Z86E3016PSG Datasheet, PDF (266/348 Pages) Zilog, Inc. – Z86E3016PSG
Z8 Family of Microcontrollers
User Manual
248
Example
DJNZ is typically used to control a loop of instructions. In this example,
12 bytes are moved from one buffer area in the register file to another. The
steps involved are:
• Load 12 into the counter (Working Register R6)
• Set up the loop to perform the moves
• End the loop with DJNZ
The assembly listing required for this routine is as follows:
LD R6, 12
;Load Counter
LOOP: LD R9, @R6 ;Move one byte to
LD @R6, R9 ;new location
DJNZ R6, LOOP ;Decrement and Loop until counter
;= 0
Instruction Description
UM001602-0904