# `adc`

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

**Add with carry**

Category: Arithmetic

Adds a value and the carry flag C to A, or a register pair and C to HL.

Used in: [8-bit and 16-bit arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/arithmetic-logic-and-bits.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 | depends on the result |

## Forms

- `adc a, r` · 1 byte · 4 cycles · Adds `r` and the carry flag to A.
  - `adc a, b`
  - `adc a, c`
  - `adc a, d`
  - `adc a, e`
  - `adc a, h`
  - `adc a, l`
  - `adc a, a`

- `adc a, (hl)` · 1 byte · 7 cycles · Adds (HL) and the carry flag to A.

- `adc a, nn` · 2 bytes · 7 cycles · Adds `nn` and the carry flag to A.

- `adc a, (ix+dd)` · 3 bytes · 19 cycles · Adds the value pointed to by IX plus `dd` and the carry flag to A.
  - `adc a, (ix+dd)`
  - `adc a, (iy+dd)`

- `adc hl, rr` · 2 bytes · 15 cycles · Adds `rr` and the carry flag to HL.
  - `adc hl, bc`
  - `adc hl, de`
  - `adc hl, hl`
  - `adc hl, sp`

## 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.

- `adc r` · 1 byte · 4 cycles · Adds `r` and the carry flag to A.
  - `adc b` → `adc a, b`
  - `adc c` → `adc a, c`
  - `adc d` → `adc a, d`
  - `adc e` → `adc a, e`
  - `adc h` → `adc a, h`
  - `adc l` → `adc a, l`
  - `adc a` → `adc a, a`

- `adc (hl)` · 1 byte · 7 cycles · Adds (HL) and the carry flag to A.
  - `adc (hl)` → `adc a, (hl)`

- `adc nn` · 2 bytes · 7 cycles · Adds `nn` and the carry flag to A.
  - `adc nn` → `adc a, nn`

- `adc (ix+dd)` · 3 bytes · 19 cycles · Adds the value pointed to by IX plus `dd` and the carry flag to A.
  - `adc (ix+dd)` → `adc a, (ix+dd)`
  - `adc (iy+dd)` → `adc a, (iy+dd)`

## Undocumented

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

- `adc a, ixh/l` · 2 bytes · 8 cycles · Adds `ixh/l` and the carry flag to A.
  - `adc a, ixh`
  - `adc a, ixl`
  - `adc a, iyh`
  - `adc a, iyl`

## Pseudo-instructions · Undocumented

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.

- `adc ixh/l` · 2 bytes · 8 cycles · Adds `ixh/l` and the carry flag to A.
  - `adc ixh` → `adc a, ixh`
  - `adc ixl` → `adc a, ixl`
  - `adc iyh` → `adc a, iyh`
  - `adc iyl` → `adc a, 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`.
- [`nn`](https://asm-editor.specy.app/documentation/z80/registers/operand-nn.md): An 8-bit immediate value, `0` to `255` or `-128` to `127`, written as a number, character constant or symbol.
- [`(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`.
- [`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 a, 5
        ld b, 3
        adc a, b
        halt
```
