# `bkpt`

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

**Breakpoint** · 68010

Category: System

Marks a breakpoint for a hardware debugger.

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

## Flags

| Flag | Effect |
| --- | --- |
| X | not changed |
| N | not changed |
| Z | not changed |
| V | not changed |
| C | not changed |

## Forms

- `bkpt #imm`

## Operands

- [`#imm`](https://asm-editor.specy.app/documentation/m68k/addressing-mode/immediate.md): A breakpoint number from `0` to `7`, which a hardware debugger would read.

## Description

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](https://asm-editor.specy.app/documentation/m68k/exceptions/handlers.md). To pause during debugging here, set a breakpoint beside the line numbers.

## Example

```m68k
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:
```
