Jump Relative

76543210
 
\(PC \longleftarrow PC + e\)
JR e
0001100018
e-2
 
\(\begin{rcases} PC \longleftarrow (PC) + e \end{rcases} \text {if } cc = true\)
JR cc, e
001cc000
e-2
 
\(B \longleftarrow B - 1\\ \begin{rcases} PC \longleftarrow PC + e \end{rcases} \text{ if } B \not = 0\)
DJNZ e
0001000010
e-2
Conditions
ccAbbrev Condition Flag
00NZ Non Zero Z
01Z Zero
10NC No Carry C
11C Carry

Relative Jumps

For relative instructions the offset is taken from the address of the op code so is in the range -126 to 129. Assemblers usually account for the difference where the value in memory is e-2.

Timing

For JR then when a jump takes place then it takes 12(4,3,5) T-States whilst no jump 7(4,3) T-States.

For DJNZ if the jump takes place then it takes 13 (5,3,5) T-States. If no jump then 8 (5,3) T-States.

Flags Affected
None.
Opcode Matrix
UncondCNCZNZB!=0
JR e
JR e
18nn212
JR C,e
38nn212
JR NC,e
30nn212
JR Z,e
28nn212
JR NZ,e
20nn212

DJNZ e





DJNZ e
10nn213
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Flow