OUT (C), r

Write r to a port
76543210
 
\((C) \longleftarrow r\)
OUT (C), r
11101101ED
01r001
 
\((C) \longleftarrow F\)
OUT (C), F
11101101ED
0111000171
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111

The contents of Register C are placed on the bottom half (A0…7) of the address bus to select the I/O device at one of 256 possible ports.

The contents of Register B are placed on the top half (A8…A15) of the address bus at this time.

Then the byte contained in r is placed on the data bus and written to the selected peripheral device.

There is an undocumented code where r=%110 which writes the flag register.

Unlike it's IN F, (C) counterpart, this instruction is completely undocumented, but it's here not in the undocumented section to be consistent.

Flags Affected
None.
Opcode Matrix
ABCDEHLF
OUT (C)
OUT (C),A
ED79212
OUT (C),B
ED41212
OUT (C),C
ED49212
OUT (C),D
ED51212
OUT (C),E
ED59212
OUT (C),H
ED61212
OUT (C),L
ED69212
OUT (C),F
ED71212
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Special Undocumented