illegal

Take illegal instruction trap

Raises an illegal-instruction exception through vector 4 at $10.

Used in
XNZVC –––––
  • Leaves every flag unchanged

Forms

  • illegal

Programs can use it to mark code that must never execute.

The exception saves the address of illegal itself. A handler that resumes at the next instruction must add 2 to the saved address before rte. Without a handler, the program ends at illegal. See writing a handler.

* --- Step past an illegal instruction ---
move.l #skip, $10 ; vector 4 is at $10
moveq #1, d0
illegal ; skip runs
moveq #2, d0 ; and the program carries on here
bra END

skip:
    addq.l #2, 2(sp) ; the saved address is the illegal's own: step past it
    rte

END: