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
- Ports: in and outZ80 assembly
- The screen, keyboard and mouse through portsZ80 assembly
- Read two numbers and print their sumZ80 assembly
- A bouncing ballZ80 assembly
- Move a square with the keyboardZ80 assembly
- The snake gameZ80 assembly
- Flappy ASMZ80 assembly
- Play a tuneZ80 assembly
- ChiptuneZ80 assembly
- ● 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 unchangedReads a byte into A from the port whose address has A in the high byte and
nnin the low byte.-
Reads a byte into
rfrom 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
nnin the low byte. -
Reads a byte into
rfrom 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 cyclesReads 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,
0to255or-128to127, written as a number, character constant or symbol. More r- An 8-bit register:
a,b,c,d,e,horl.
.org 0x8000
in a, (0x11) ; ask the console for a number
add a, a ; double it
out (0x11), a ; print the result
halt