in

Input

Reads a byte from an I/O port into a register, with the port addressed by BC or by A and nn.

2 bytes

Used in
SZHP/VNC ●●0●0–
  • ● depends on the result
  • 0 always 0
  • – not changed

Forms that affect the flags differently are shown in their row.

Forms

  • in a, () 11 cycles flags unchanged

    Reads a byte into A from the port whose address has A in the high byte and nn in the low byte.

  • Reads a byte into r from the port whose 16-bit address is in BC.

Pseudo-instructions

The assembler also accepts these forms, which are other ways to write Z80 instructions. Open a row to see what each form becomes.

  • Reads a byte into A from the port whose address has A in the high byte and nn in the low byte.

  • Reads a byte into r from the port whose 16-bit address is in BC.

Undocumented 1 row

Zilog’s manual does not list these forms, but the Z80 runs them.

  • in (c) 12 cycles

    Reads a byte from the port whose 16-bit address is in BC and uses it only to set the flags.

Pseudo-instructions · Undocumented 1 row

The assembler also accepts these forms, which are other ways to write Z80 instructions. Open a row to see what each form becomes. Zilog’s manual does not list these forms, but the Z80 runs them.

  • Reads a byte from the port whose 16-bit address is in BC and uses it only to set the flags.

Operands

nn
An 8-bit immediate value, 0 to 255 or -128 to 127, written as a number, character constant or symbol. More
r
An 8-bit register: a, b, c, d, e, h or l.
        .org 0x8000
        in a, (0x11)    ; ask the console for a number
        add a, a        ; double it
        out (0x11), a   ; print the result
        halt