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

Return to the regular view of this page.

Block write to port

Table of Contents

\(\begin{rcases} (C) \longleftarrow (HL)\\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
101LD011

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 address pointed to by HL is placed on the data bus and written to the port.

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
OUTI
EDA3216
OUTD
EDAB216
Repeat
OUTIR
EDB3221
OUTDR
EDBB221
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Special