As is indicated, the most typical use for the break instruction is during program debugging. …
When I saw you brought this up, this is along the lines of what I was thinking. I’ve done 6502 assembly on the Atari (through emulation). I use BRK just to stop execution of my assembly program, because I don’t think there’s any other way to do it, unless you want to JMP back into the OS somewhere.
There is an END instruction in the assemblers I’ve used, but that’s just a directive to the assembler to stop. It doesn’t insert any termination code in your program.
Though, BRK happens automatically if your termination point is the last byte in your program, since the memory after that is typically all zeros, and the CPU reads that as BRK.
This seems to be the preferred method of ending execution of your machine language program on the Atari. When I’ve used it, control returns back to whatever started my program’s execution (the assembler, or DOS). Though, it is interesting to learn that it’s actually used as a kind of interrupt, and that there are a bunch of things that need to be done to “read” what was actually intended with it.
I also assumed for a while that BRK was used by software debuggers as a means to step through each line of your assembly code as your program executes. Though, I’ve started to wonder if the debuggers I’ve used aren’t actually using a regularly invoked interrupt to do this. I got suspicious of this when I tried to use a VBI (vertical blank interrupt) in my assembly code, and the assembler quietly disallowed it (no warning, no error, no nothing. The vector redirect to my code was ignored, and I only got it to work by rebooting the machine without running the assembler). This finally gave me a clue as to why 8-bit programmers wanted a machine monitor. The emulator I use has a monitor function, and I’ve used it quite a bit!