Make your own free website on Tripod.com

DJNZ e

Decrement B and jump e relative on no zero.
Function: B <- B-1; if B != 0: PC <- PC + e
 
Format:
0001 0000
 
byte 1: 10
 
<-- e-2 -->
 
byte 2: offset value
 
Description: The B register is decremented. If the result is not zero, the immediate offset value is added to the program counter using two's complement arithmetic so as to enable both forward and backward jumps. The offset value is added to the value of PC + 2 (after the jump). As a result, the effective offset is -126 to +129 bytes. The assembler automatically subtracts from the source offset value to generate the hex code.
 
Data Flow:
 
Timing:
 
Addressing Mode:
 
Flags:
 
(no effect)
 
Example:

OBJECT CODE
Before:
 
After: