![]() |
|
| << Previous | Next >> | |
| | |
DWJNZ label Decrement Word and Jump if Not Zero Rabbit 4000/5000 Instruction
ED 10 e DWJNZ label
DWJNZ mn1BC = 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.
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 |