# `exg`

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

Web page: https://asm-editor.specy.app/documentation/m68k/instruction/exg

**Exchange registers**

Category: Data movement

Exchanges the full long contents of two registers.

Size .l

## Flags

| Flag | Effect |
| --- | --- |
| X | not changed |
| N | not changed |
| Z | not changed |
| V | not changed |
| C | not changed |

## Forms

- `exg Rn, Rn`
  - Operand 1: Dn, An
  - Operand 2: Dn, An

## Operands

- [`Rn`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/direct.md): A data or address register, `d0` to `d7` or `a0` to `a7`.

## Example

```m68k
* --- Data registers ---
move.l #$AAAA, d0
move.l #$BBBB, d1
exg d0, d1

* --- Data and address register ---
move.l #$1234, d2
move.l #$5678, a0
exg d2, a0
```
