r <- (C)
IN
r,(C)
b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | $ED |
0 | 1 | r | 0 | 0 | 0 |
The contents of Register C are placed on the bottom half (A0 through A7) 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 through 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. Register r identifies any of the CPU registers shown in the following table, which also indicates the corresponding 3-bit r field for each. The flags are affected, checking the input data.
Register | r | Hex |
---|---|---|
B | 000 | $40 |
C | 001 | $48 |
D | 010 | $50 |
E | 011 | $58 |
H | 100 | $60 |
L | 101 | $68 |
Flag | 110 | Undefined op code; set the flag |
A | 111 | $78 |
S | is set if result is negative, otherwise it is reset. |
Z | is set if result is 0, otherwise it is reset. |
H | is reset. |
P/V | is set if parity is even, otherwise it is reset |
N | is reset. |
C | is not affecte. |
Register C contains $07, Register B contains $10, and byte $7B is available at the peripheral device mapped to I/O port address $07. Upon the execution of
IN D,(C)
the D Register contains $7B.