# `moves`

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

**Move address space** · Privileged · 68010

Category: System

Moves a byte, word or long between a register and memory in a selected address space.

Sizes .b .w .l, .w by default · 68010 and 68020 only: select `opt p=68010` before any code or data

## Flags

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

## Forms

- `moves Rn, <ea>`
  - Source: Dn, An
  - Destination: (An), (An)+, -(An), d(An), d(An,Xn), abs (memory alterable)
- `moves <ea>, Rn`
  - Source: (An), (An)+, -(An), d(An), d(An,Xn), abs (memory alterable)
  - Destination: 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`.
- [`<ea>`](https://asm-editor.specy.app/documentation/m68k/addressing-mode.md): An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With `opt p=68020`, an allowed `d(An,Xn)` or `d(PC,Xn)` mode also permits the corresponding 68020 indexed and memory indirect forms. See [68020 addressing](https://asm-editor.specy.app/documentation/m68k/addressing-mode/68020.md).

## Description

On the 68010 and 68020, each memory access has a three-bit function code: `moves` reads using `sfc` and writes using `dfc`, which [movec](https://asm-editor.specy.app/documentation/m68k/instruction/movec.md) sets. An operating system can use this to access a user program’s separate address space.

The editor has a single address space, so `moves` accesses the same bytes as `move` for every `sfc` or `dfc` value. One operand must be a data or address register and the other writable memory. A byte or word loaded into an address register is sign-extended to long. A data-register destination keeps the bits above the selected size unchanged. The flags are unchanged. `moves` requires supervisor mode and raises a privilege violation in user mode.

## Example

```m68k
opt p=68010
* --- Reach the memory of user data from supervisor code ---
moveq #1, d0 ; function code 1: user data
movec d0, sfc ; moves reads from user data
movec d0, dfc ; and writes to user data
lea buffer, a0
move.w #$1234, d1
moves.w d1, (a0) ; write the word
moves.w (a0), d2 ; read it back: d2 = $1234
bra END

buffer:
    ds.w 1

END:
```
