JR NZ,e

Operation

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

Mnemonic

JR

Operands

NZ,e

b7b6b5b4b3b2b1b0
0 0 1 0 0 0 0 0$20
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 = 0, 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 = 1, the next instruction executed is taken from the location following this instruction.

Condition Bits Affected

None

Example

The Zero Flag is reset and it is required to jump back four locations from $480. The assembly language statement is

	JR	NZ,$-4

The resulting object code and final Program Counter avlue is:

LocationInstruction
$47C<- PC after jump
$47D---
$47E---
$47F---
$480$20
$481$FA (two's complement -6)