# `stop`

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

Privileged

Category: System

Loads the status register from an immediate word and waits for an eligible interrupt.

Used in: [Interrupts and cycles](https://asm-editor.specy.app/learn/courses/m68k/talking-to-the-outside-world/interrupts-and-cycles.md) (M68K assembly)

## Flags

| Flag | Effect |
| --- | --- |
| X | loaded from the operand |
| N | loaded from the operand |
| Z | loaded from the operand |
| V | loaded from the operand |
| C | loaded from the operand |

## Forms

- `stop #imm`

## Operands

- [`#imm`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/immediate.md): A 16-bit status-register value, written after `#`, for example `#$2000`. It sets the interrupt mask and processor mode before the wait.

## Description

An interrupt is eligible if its level is above the new interrupt mask, or if it is level 7. The processor then runs the handler at that level’s autovector; the handler’s `rte` returns to the instruction after `stop`.

`stop #$2000` keeps supervisor mode and sets the mask to zero, allowing every interrupt level. A program can use it to wait for a timer or key without a polling loop. While the processor waits, Run stays active, the status line shows the wait, and Step executes nothing. `stop` requires supervisor mode and raises a privilege violation in user mode. See [interrupts](https://asm-editor.specy.app/documentation/m68k/exceptions/interrupts.md).

## Example

```m68k
* --- Wait for a timer three times ---
move.l #tick, $68 ; the level-2 autovector is at $68
move.b #32, d0
move.b #6, d1
move.b #$82, d2 ; $80 + 2: a timer at level 2
move.l #100, d3 ; every 100 ms
trap #15
wait:
stop #$2000 ; wait for an interrupt above level 0
cmp.l #3, d6
bne wait ; tick has run three times: 0.3 s
bra END

tick:
    addq.l #1, d6 ; count the ticks
    rte ; back to the instruction after the stop

END:
```
