<< Previous | Next >>

DWJNZ label     Decrement Word and Jump if Not Zero     Rabbit 4000/5000 Instruction

Opcode
Instruction
Operation
ED 10 e DWJNZ label
DWJNZ mn1
BC = BC - 1
if {BC != 0} PC = PC2 + e

1 The 16-bit constant mn is the destination logical address of the jump.

2 The value of PC after the instruction fetch.

8-Bit Access
16-Bit Unaligned
16-Bit Aligned
Rabbit 4000
7
n/a
n/a
Rabbit 5000
8
8
8

Flags ALTD IOI/IOE
S
Z
L/V
C
F
R
SP
S
D
-
-
-
-
·

Description

This instruction controls program flow by allowing conditional jumps to specified locations.

First, BC is decremented. If BC does not equal zero, the instruction transfers control to the specified address. The address is specified by a label or logical address. The assembler translates the label or logical address "mn" to an 8-bit signed displacement value "e".

The displacement value "e" is relative to the address of the first byte of the instruction following DWJNZ. This fact is because the processor calculates the new PC value after it increments the PC for the instruction fetch of DWJNZ.

If BC does equal zero, PC is incremented normally.

Note that the relative jump has a limited range of [-128, 127] from the address of the first byte of the instruction following the DWJNZ instruction.


Rabbit Instructions << Previous | Next >> rabbit.com