Z8
®
CPU
User Manual
UM001604-0108 Instruction Description
190
Jump Relative
Syntax
JR cc, dst
Instruction Format
Operation
If cc is true, PC ← PC + dst
If the condition specified by the cc is true, the relative address is added to the PC and con-
trol passes to the instruction located at the address specified by the PC (see Condition
Codes on page 146 for a list of condition codes). Otherwise, the instruction following the
JR instruction is executed. The range of the relative address is +127 to –128, and the orig-
inal value of the PC is taken to be the address of the first instruction byte following the JR
instruction.
Example 1
If the result of the last arithmetic operation executed is negative, the next four statements
(which occupy a total of seven bytes) are skipped with the statement:
JR Ml, #9
Op Code: 5B 09
If the result was not negative, execution would have continued with the instruction follow-
ing the JR instruction.
Example 2
A short form of a jump –45 is:
JR #–45
Op Code: 8B D3
The condition code is blank in this case, and is assumed to be always true.
Cycles OPC (Hex)
Address Mode
dst
cc OPC dst
12 If jump taken ccB RR
10 if jump not taken cc = 0 to F
Flag Description
C Unaffected
Z Unaffected
S Unaffected
V Unaffected
D Unaffected
H Unaffected