# `exx`

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

**Exchange register sets**

Category: Data movement

Swaps BC, DE and HL with BC', DE' and HL', the alternate register set.

1 byte · 4 cycles

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)

## Flags

| Flag | Effect |
| --- | --- |
| S | not changed |
| Z | not changed |
| H | not changed |
| P/V | not changed |
| N | not changed |
| C | not changed |

## Forms

- `exx` · Exchanges the 16-bit contents of BC, DE, and HL with BC', DE', and HL'.

## Example

```z80
        .org 0x8000
        ld bc, 0x0234
        ld de, 0x1000
        ld hl, 0x9000
        exx
        halt
```
