|
Just to expand on that, the Beeb OS doesn't expect to resume the code which follows BRK instructions, so your BRK handler should end by JMPing to a fixed location afterwards, in the same spirit as ON ERROR GOTO in BASIC.
To avoid bad stack shenanigans, I'd suggest that the best trick is to remember the current stack pointer (TSX / STX storedsp), point the BRKV at your own handler (remembering its old contents) and call OSFILE.
Your BRK handler should print the error message (addresses &FD/&FE point at the error number followed by the zero-terminated error message), then exit by restoring the stack pointer you saved earlier and jumping to your error recovery code.
|