JR Z,e

Operation

If Z = 0, continue
If Z = 1, PC <- PC + e

Mnemonic

JR

Operands

Z,e

b7b6b5b4b3b2b1b0
0 0 1 0 1 0 0 0$28
e-2

Description

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.

Condition Bits Affected

None

Example

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:

LocationInstruction
$300$28
$301$03
$302---
$303---
$304---
$305<- PC after jump