Mnemonics

INIR

Input and Output Group
Expansion:
INput and Increment Repeat
Usage:
dec {r}

Reads input from the port address found in memory at pointer C register i.e. (C) and saves the result to the address pointer (HL). It then increments HL while decrements B register. This then repeats until B is zero. Please see INI for more information.

Z80.CPU instructions
Instruction Description Opcode
INIR INput and Increment Repeat EDB2

Example

; Example ld bc, $00FE ; load BC with the address of port 254 ($FE) and the counter in B ld hl, $4000 ; load HL with the starting address of the memory block ld b, $10 ; load B with the number of bytes to read (16 bytes in this example) inir ; input a byte from port C ($FE), store it at (HL), increment HL, decrement B ; after inir, HL will be increment by the number of bytes read, ; and the memory block at $4000 will contain the data from the I/O port

See also