\(\begin{rcases} (HL) \longleftarrow (C)\\HL \longleftarrow HL+1 \text{ if } D = 0\\HL \longleftarrow HL-1 \text{ if } D = 1\\B \longleftarrow B-1 \end{rcases} \text{repeat while } L=1 \And B \not = 0\)
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | ED |
1 | 0 | 1 | L | D | 0 | 1 | 0 |
D 0=Increment, 1=Decrement HL
after each iteration
L If set then if \(B \not = 0\) then \(PC \longleftarrow PC-2\) so that the instruction is repeated.
The contents of Register C are placed on the bottom half (A0…A7) of the address bus to select the I/O device at one of 256 possible ports.
Register B can be used as a byte counter, and its contents are placed on the top half (A8…15) of the address bus at this time.
Then one byte from the selected port is placed on the data bus and written to the CPU.
The contents of the HL register pair are then placed on the address bus and the input byte is written to the corresponding location of memory.
Finally, the byte counter is decremented and register pair HL is incremented.
Flags Affected
Flags |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
z | set if B = 0, always true for repeat operations | ||||||||
n | set |
Opcode Matrix
Increment | Decrement | |
---|---|---|
Single |
INI
EDA2216 |
IND
EDAA216 |
Repeat |
INIR
EDB2221 |
INDR
EDBA221 |
Instruction
Opcode hexSize bytesCycle count
| Special |