# `moveq`

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

**Move quick**

Category: Data movement

Moves a byte immediate from -128 through 255 into a data register, sign extended to long.

Size .l

Used in: [trap #15 and its tasks](https://asm-editor.specy.app/learn/courses/m68k/talking-to-the-outside-world/trap-15-and-its-tasks.md) (M68K assembly), [Exceptions and the vector table](https://asm-editor.specy.app/learn/courses/m68k/talking-to-the-outside-world/exceptions-and-the-vector-table.md) (M68K assembly), [Interrupts and cycles](https://asm-editor.specy.app/learn/courses/m68k/talking-to-the-outside-world/interrupts-and-cycles.md) (M68K assembly), [Binary search](https://asm-editor.specy.app/learn/courses/m68k/examples/binary-search.md) (M68K assembly), [A 2D array](https://asm-editor.specy.app/learn/courses/m68k/examples/two-dimensional-array.md) (M68K assembly), [Flappy ASM](https://asm-editor.specy.app/learn/courses/m68k/examples/flappy-asm.md) (M68K assembly), [Play a WAV and a MIDI file](https://asm-editor.specy.app/learn/courses/m68k/examples/play-sound-files.md) (M68K assembly), [Sampled sound](https://asm-editor.specy.app/learn/courses/m68k/examples/sampled-sound.md) (M68K assembly)

## Flags

| Flag | Effect |
| --- | --- |
| X | not changed |
| N | depends on the result |
| Z | depends on the result |
| V | always 0 |
| C | always 0 |

## Forms

- `moveq #imm, Dn`

## Operands

- [`#imm`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/immediate.md): An 8-bit immediate, `-128` to `255`, sign-extended to 32 bits, for example `#-1` or `#$7F`. Values `128` to `255` represent `-128` to `-1`.
- [`Dn`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/direct.md): A data register, `d0` to `d7`.

## Description

Values 128 through 255 are the unsigned spellings of -128 through -1.

## Example

```m68k
moveq #100, d0
moveq #-1, d1
moveq #255, d2 ; the encoded byte is $ff, so d2 becomes -1
moveq #-128, d3
; moveq #256, d4 ; error! the encoded value must be -128..255
```
