jr

Jump relative

Jumps to a target up to 128 bytes away, either always or only when a flag condition is met.

12/7 cycles: 12 when it jumps, 7 when it does not

SZHP/VNC ––––––
  • Changes no flag

Forms

  • jr 2 bytes · 12 cycles

    The signed value offset is added to PC. The jump is measured from the start of the instruction opcode.

  • If the condition cc is true, the signed value offset is added to PC. The jump is measured from the start of the instruction opcode.

Operands

offset
A relative-jump target, written as a label or address. The assembler calculates the displacement, -128 to 127, and reports an error if the target is out of range. More
cc
A flag condition: nz (zero flag clear, Z = 0), z (zero flag set, Z = 1), nc (carry flag clear, C = 0) or c (carry flag set, C = 1). Here c tests the carry flag; it does not name the c register. More
        .org 0x8000
        jr target
target: halt