<< Previous | Next >>

JR cc,label     Jump Relative     Rabbit 2000/3000/4000/5000 Instruction

Opcode
Instruction
Operation
---- JR cc,label
JR
cc,mn1
if {cc} PC = PC2 + e
20 e JR NZ,mn if {NZ} PC = PC + e
28 e JR Z,mn if {Z} PC = PC + e
30 e JR NC,mn if {NC} PC = PC + e
38 e JR C,mn if {C} PC = PC + 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 2000/3000/4000
5
n/a
n/a
Rabbit 5000
6
6
6

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

Description

If condition cc is true, this instruction transfers control to the specifed 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 JR. This fact is because the processor calculates the new PC value after it increments the PC for the instruction fetch of JR. If condition cc is false, PC is incremented normally.

Condition Code
Flag Bit Value
Description
NZ
Z=0
True when the Z flag has not been set
Z
Z=1
True when the Z flag has been set
NC
C=0
True when the C flag has not been set
C
C=1
True when the C flag has been set

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


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