z80:Opcodes:IN

From Learn @ Cemetech
Jump to navigationJump to search

Reads a value from a hardware port.

Syntax

   in op8,(op8)

Allowed Instructions

   in a,(n)        ;8-bit constant
   in a,(c)
   in b,(c)
   in c,(c)
   in d,(c)
   in e,(c)
   in h,(c)
   in l,(c)
   in (c)          ;undocumented command

Effects

IN A,(N)

This command alters no flags.

Others

N flag reset, P/V represents parity, C flag preserved, all other flags affected by definition.

Uses

This command, along with OUT, is used for hardware interfacing. The undocumented command IN (C) reads from the port and affects flags, but does not store the value to a register.

T-States

r denotes 8-bit register.

A, X 11
r, (C) 12

See Also

IND,INDR,INI,INIR,OUT,OUTD,OTDR,OUTI,OTIR