This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

Block read from port

Table of Contents

\(\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\)

76543210
11101101ED
101LD010

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----n-
zset if B = 0, always true for repeat operations
nset
Opcode Matrix
IncrementDecrement
Single
INI
EDA2216
IND
EDAA216
Repeat
INIR
EDB2221
INDR
EDBA221
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Special