BASIC expects a return from OSBYTE 126, though it's the opposite way around to what I remembered, it's called by the error handler. There's a routine called between each statement that is something like:You'd have to be sure that BASIC was ready to accept a return from OSBYTE 126, and continue executing your program. If the interpreter isn't expecting the program to continue, it might not be in a stable state. I don't know nearly enough about BASIC to do this, but if anyone wants to implement it I would certainly be interested!
BIT &FF:BMI errEscape:RTS
.errEscape
BRK:EQUB 17:EQUS "Escape":BRK
...and the error handler does:
blah, blah
linepointer = errorpointer
LDA #126:JSR OSBYTE
LDX #&FF:TXS
JMP execute
So it gets fiddly. We need to stack some sort of 'RETURN', but we've lost the linepointer by the time OSBYTE 126 is called. And, on return from OSBYTE 126 the stack is reset, so any stacked code structures are lost. It probably needs to hook into BRKV, similar to the ON ERROR LOCAL extension.
Statistics: Posted by jgharston — Fri Jan 24, 2025 9:41 pm