Control Flow // JR (Jump Relative)
This instruction provides for unconditional branching to other segments of a program. 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. This 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.
To jump forward five locations from address 480, the following assembly language statement is used: JR $+5 The resulting object code and final Program Counter value is shown in the following table: Location Instruction 480 18 481 03 482 – 483 – 484 – 485 ← PC after jump