# `inir`

[Z80 Documentation](https://asm-editor.specy.app/documentation/z80.md) › [Instructions](https://asm-editor.specy.app/documentation/z80/instruction.md)

Web page: https://asm-editor.specy.app/documentation/z80/instruction/inir

**Input, increment and repeat**

Category: Input/output

Repeats INI, reading port bytes into memory upward from HL until B is zero.

2 bytes · 21/16 cycles · 21 cycles each time it repeats, 16 the last time

## Flags

| Flag | Effect |
| --- | --- |
| S | undefined (do not rely on it) |
| Z | always 1 |
| H | undefined (do not rely on it) |
| P/V | undefined (do not rely on it) |
| N | undefined (do not rely on it) |
| C | undefined (do not rely on it) |

## Forms

- `inir` · Reads a byte from the port whose 16-bit address is in BC and stores it into the memory location pointed to by HL. Then increments HL and decrements B. Repeats this operation until B is zero. Interrupts can trigger while this instruction is processing.

## Example

```z80
        .org 0x8000
        ld hl, 0x9000
        ld b, 2
        ld c, 0xF0
        inir
        halt
```
