7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
---|---|---|---|---|---|---|---|---|
\(PC \longleftarrow PC + e\) | ||||||||
JR e | ||||||||
0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 18 |
e-2 | ||||||||
\(\begin{rcases} PC \longleftarrow (PC) + e \end{rcases} \text {if } cc = true\) | ||||||||
JR cc, e | ||||||||
0 | 0 | 1 | cc | 0 | 0 | 0 | ||
e-2 | ||||||||
\(B \longleftarrow B - 1\\ \begin{rcases} PC \longleftarrow PC + e \end{rcases} \text{ if } B \not = 0\) | ||||||||
DJNZ e | ||||||||
0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 10 |
e-2 |
cc | Abbrev | Condition | Flag |
---|---|---|---|
00 | NZ | Non Zero | Z |
01 | Z | Zero | |
10 | NC | No Carry | C |
11 | C | 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
Uncond | C | NC | Z | NZ | B!=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 |
Instruction
Opcode hexSize bytesCycle count
| Flow |