bkpt

Breakpoint 68010

Marks a breakpoint for a hardware debugger.

68010 and 68020 only: select opt p=68010 before any code or data

XNZVC –––––
  • Changes no flag

Forms

  • bkpt

Operands

#imm
A breakpoint number from 0 to 7, which a hardware debugger would read. More

In this editor, no hardware debugger is attached, so bkpt raises an illegal-instruction exception through vector 4 at $10. The number from 0 to 7 identifies the breakpoint to hardware; it does not select an editor breakpoint.

The exception saves the address of bkpt itself. A handler that resumes after it must add 2 to the saved address before rte. Without a handler, the program ends at bkpt. See writing a handler. To pause during debugging here, set a breakpoint beside the line numbers.

opt p=68010
* --- No debugger is attached, so vector 4 takes the breakpoint ---
move.l #met, $10 ; vector 4 is at $10
moveq #1, d0
bkpt #3 ; met runs
moveq #2, d0 ; and the program carries on here
bra END

met:
    addq.l #1, d7 ; count the breakpoints met
    addq.l #2, 2(sp) ; the saved address is the bkpt's own: step past it
    rte

END: