# `inc`

[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/inc

**Increment**

Category: Arithmetic

Adds one to a register, register pair or the byte at (HL), leaving C unchanged.

Used in: [Registers, pairs and the shadow set](https://asm-editor.specy.app/learn/courses/z80/introduction/registers-pairs-and-the-shadow-set.md) (Z80 assembly), [The 64 KB address space](https://asm-editor.specy.app/learn/courses/z80/introduction/the-64-kb-address-space.md) (Z80 assembly), [org, db, dw and ds](https://asm-editor.specy.app/learn/courses/z80/introduction/org-db-dw-and-ds.md) (Z80 assembly), [Loops and djnz](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/loops-and-djnz.md) (Z80 assembly), [Arrays, strings and ix](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/arrays-strings-and-ix.md) (Z80 assembly), [The stack, push and pop](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/the-stack-push-and-pop.md) (Z80 assembly), [call, ret and passing values](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/call-ret-and-passing-values.md) (Z80 assembly), [Ports: in and out](https://asm-editor.specy.app/learn/courses/z80/talking-to-the-outside-world/ports-in-and-out.md) (Z80 assembly), [The screen, keyboard and mouse through ports](https://asm-editor.specy.app/learn/courses/z80/talking-to-the-outside-world/screen-keyboard-and-mouse.md) (Z80 assembly), [Fill an array with the numbers from 1 to 10](https://asm-editor.specy.app/learn/courses/z80/examples/counting-loop.md) (Z80 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| S | depends on the result |
| Z | depends on the result |
| H | depends on the result |
| P/V | holds the signed overflow |
| N | always 0 |
| C | not changed |

## Forms

- `inc r` · 1 byte · 4 cycles · Adds one to `r`.
  - `inc b`
  - `inc c`
  - `inc d`
  - `inc e`
  - `inc h`
  - `inc l`
  - `inc a`

- `inc (hl)` · 1 byte · 11 cycles · Adds one to (HL).

- `inc (ix+dd)` · 3 bytes · 23 cycles · Adds one to the memory location pointed to by IX plus `dd`.
  - `inc (ix+dd)`
  - `inc (iy+dd)`

- `inc rr` · 1 byte · 6 cycles · Flags: S: not changed, Z: not changed, H: not changed, P/V: not changed, N: not changed, C: not changed · Adds one to `rr`.
  - `inc bc`
  - `inc de`
  - `inc hl`
  - `inc sp`

- `inc ix` · 2 bytes · 10 cycles · Flags: S: not changed, Z: not changed, H: not changed, P/V: not changed, N: not changed, C: not changed · Adds one to IX.
  - `inc ix`
  - `inc iy`

## Undocumented

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

- `inc ixh/l` · 2 bytes · 8 cycles · Adds one to `ixh/l`.
  - `inc ixh`
  - `inc ixl`
  - `inc iyh`
  - `inc iyl`

## Operands

- `r`: An 8-bit register: `a`, `b`, `c`, `d`, `e`, `h` or `l`.
- [`(hl)`](https://asm-editor.specy.app/documentation/z80/registers/operand-hl.md): The byte in memory at the address stored in `hl`.
- [`(ix+dd)`](https://asm-editor.specy.app/documentation/z80/registers/operand-ix-dd.md): The byte in memory at `ix + dd`, where `dd` is a signed displacement from `-128` to `127`, for example `(ix+5)` or `(ix-3)`. `(iy+dd)` works the same way.
- `rr`: A register pair: `bc`, `de`, `hl` or `sp`.
- [`ix`](https://asm-editor.specy.app/documentation/z80/registers/register-ix.md): The `ix` index register. You can also use `iy`, with the same instruction size and timing.
- [`ixh/l`](https://asm-editor.specy.app/documentation/z80/registers/register-ixh.md): The high or low byte of `ix`: `ixh` or `ixl`. For `iy`, use `iyh` or `iyl`.

## Example

```z80
        .org 0x8000
        ld bc, 0x0234
        inc bc
        halt
```
