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

Return to the regular view of this page.

IN r,(C)

Read from port in C and store in a specific register

Table of Contents

76543210
 
\(r \longleftarrow (C)\)
IN r, (C)
11101101ED
01r000
 
\(F \longleftarrow (C)\)
IN F, (C)
11101101ED
0111000070
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 one byte from the selected port is placed on the data bus and written to register r in the CPU.

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

This is actually documented in Zilog's Z80 CPU User Manual, 2016 edition Page 296. For this reason it's included on this page and not in the Undocumented instruction section.

Flags Affected
Flags
sz-h-p/vn-
sset if input data is negative
zset if input data is 0
hreset
p/vset if parity is even, reset if odd
nreset
Opcode Matrix
ABCDEHLF
IN (C)
IN A,(C)
ED7B212
IN B,(C)
ED40212
IN C,(C)
ED48212
IN D,(C)
ED50212
IN E,(C)
ED58212
IN H,(C)
ED60212
IN L,(C)
ED68212
IN F,(C)
ED70212
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Special Undocumented