# `addq`

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

**Add quick**

Category: Arithmetic

Adds an immediate value from 1 to 8 to the second operand.

Sizes .b .w .l, .w by default

Used in: [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), [Fill an array with the numbers from 1 to 10](https://asm-editor.specy.app/learn/courses/m68k/examples/counting-loop.md) (M68K assembly), [The largest element](https://asm-editor.specy.app/learn/courses/m68k/examples/max-of-an-array.md) (M68K assembly), [Length of a string](https://asm-editor.specy.app/learn/courses/m68k/examples/string-length.md) (M68K assembly), [Bit tests, shifts, masks and counting set bits](https://asm-editor.specy.app/learn/courses/m68k/examples/bit-tricks.md) (M68K assembly), [Bubble sort](https://asm-editor.specy.app/learn/courses/m68k/examples/bubble-sort.md) (M68K assembly), [Binary search](https://asm-editor.specy.app/learn/courses/m68k/examples/binary-search.md) (M68K assembly), [The snake game](https://asm-editor.specy.app/learn/courses/m68k/examples/snake.md) (M68K assembly), [Flappy ASM](https://asm-editor.specy.app/learn/courses/m68k/examples/flappy-asm.md) (M68K assembly)

## Flags

| Flag | Effect |
| --- | --- |
| X | depends on the result |
| N | depends on the result |
| Z | depends on the result |
| V | depends on the result |
| C | depends on the result |

## Forms

- `addq #imm, <ea>`
  - Destination: Dn, An, (An), (An)+, -(An), d(An), d(An,Xn), abs (alterable)

## Operands

- [`#imm`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/immediate.md): An immediate from `1` to `8`, for example `#1`.
- [`<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

The first operand value must be between 1 and 8. If the destination is an address register, it is always treated as a long, and the condition codes are not affected.

## Example

```m68k
move.l #0, d0
addq.l #8, d0
addq.l #1, d0
; addq.w #9, d0 ; error! immediate must be 1-8
```
