If Z = 0, continue
If Z = 1, PC <- PC + e
JR
Z,e
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | $28 |
e-2 |
This instruction provides for conditional branching to other segments of a program depending on the results of a test on the Zero Flag. If the flag = 1, the value of displacement e is added to the Program Counter (PC) and the next instruction is fetched from the location designated by the new contents of the PC. The jump is measured from the address of the instruction op code and contains a range of -126 to +129 bytes. The assembler automatically adjusts for the twice-incremented PC.
If the Zero flag = 0, the next instruction executed is taken from the location following this instruction.
None
The Zero Flag is set and it is required to jump forward five locations from address $300. The following assembly language statement is used:
JR Z,$+5
The resulting object code and final Program Counter value is shown in the following table:
Location | Instruction | |
---|---|---|
$300 | $28 | |
$301 | $03 | |
$302 | --- | |
$303 | --- | |
$304 | --- | |
$305 | <- PC after jump |