stop

Privileged

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

Used in
XNZVC ●●●●●
  • ● set from the result

Forms

  • stop

Operands

#imm
A 16-bit status-register value, written after #, for example #$2000. It sets the interrupt mask and processor mode before the wait. More

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.

* --- 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: