Mnemonic |
Symbolic Operation |
Flags | OP-Code | No. of Bytes |
No. of M Cycles |
No. of T Cycles |
Comments | |||||
C | Z | P/V | S | N | H | 76 543 210 | ||||||
IN A,(n) | A ← (n) | • | • | • | • | • | • | 11 011 011 ← n → |
2 | 3 | 11 |
n to A0 ∼ A7 Acc to A8 ∼ A15 |
IN r,(C) | r ← (C) If r = 110 only the flags will be affected. See note ② |
• | ↕ | P | ↕ | 0 | ↕ | 11 101 101 01 r 000 |
2 | 3 | 12 |
C to A0 ∼ A7 B to A8 ∼ A15 r Reg 000 B 001 C 010 D 011 E 100 H 101 L 111 A |
INI |
(HL) ← (C) B ← B - 1 HL ← HL + 1 |
X | ① ↕ |
X | X | 1 | X | 11 101 101 10 100 010 |
2 | 4 | 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
INIR |
(HL) ← (C) B ← B - 1 HL ← HL + 1 Repeat until B = 0 |
X | 1 | X | X | 1 | X | 11 101 101 10 110 010 |
2 2 |
5 (If B ≠ 0) 4 (If B = 0) |
21 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
IND |
(HL) ← (C) B ← B - 1 HL ← HL - 1 |
X | ① ↕ |
X | X | 1 | X | 11 101 101 10 101 010 |
2 | 4 | 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
INDR |
(HL) ← (C) B ← B - 1 HL ← HL - 1 Repeat until B = 0 |
X | 1 | X | X | 1 | X | 11 101 101 10 111 010 |
2 2 |
5 (If B ≠ 0) 4 (If B = 0) |
21 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
OUT (n),A | (n) ← A | • | • | • | • | • | • | 11 010 011 ← n → |
2 | 3 | 11 |
n to A0 ∼ A7 Acc to A8 ∼ A15 |
OUT (C),r | (C) ← r
r as for IN r,(C) except not r = 110 |
• | • | • | • | • | • | 11 101 101 01 r 001 |
2 | 3 | 12 |
C to A0 ∼ A7 B to A8 ∼ A15 |
OUTI |
(C) ← (HL) B ← B - 1 HL ← HL + 1 |
X | ① ↕ |
X | X | 1 | X | 11 101 101 10 100 011 |
2 | 4 | 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
OTIR |
(C) ← (HL) B ← B - 1 HL ← HL + 1 Repeat until B = 0 |
X | 1 | X | X | 1 | X | 11 101 101 10 110 011 |
2 2 |
5 (If B ≠ 0) 4 (If B = 0) |
21 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
OUTD |
(C) ← (HL) B ← B - 1 HL ← HL - 1 |
X | ① ↕ |
X | X | 1 | X | 11 101 101 10 101 011 |
2 | 4 | 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
OTDR |
(C) ← (HL) B ← B - 1 HL ← HL - 1 Repeat until B = 0 |
X | 1 | X | X | 1 | X | 11 101 101 10 111 011 |
2 2 |
5 (If B ≠ 0) 4 (If B = 0) |
21 16 |
C to A0 ∼ A7 B to A8 ∼ A15 |
Notes: | ① If the result of B - 1 is zero the Z flag is set, otherwise it it reset. | |
② Althought not an "official" notation, some Z-80 assemblers accept IN FLAGS,(C) as a way of specifying r = 110. | ||
Flag Notation: | • = flag not affected, 0 = flag reset, 1 = flag set, X = flag is unknown, | |
↕ = flag is affected according to the result of the operation. | ||