pjw wrote:In SMSQ/E just: poke !!$e4,%10000
Theres a similar poke for Qdos, IIRC.
Of course, it applies system wide, not to any particular SBASIC, which is what I thought you were asking.
Check out the systems variables. There are some more keys there concerning break.
sys_klock would be an interesting copy protection scheme, but not really what I was looking for: a way to not accidentally break into only an EX'd SBASIC so that it behaves like a compiled program running as any other job. The ideal situation is to have break passed as ERR_NC into then WHEN ERRor handling only when it's being EXecuted and not run interactively. From looking at the mention of ERR_NC in the WHEN ERRor documentation one should think that was always the intent.
Looking at the implementation however that situation never happens, as sb_break(a6) checks are preceding any other handlers and always give up processing without any further consideration:
from in dev8_smsq_sbas_execute.asm(57):
Code: Select all
tst.b sb_break(a6) ; break?
bpl.s sbx_rtd0 ; ... yes, give up
move.w sb_wherr(a6),sb_nline(a6) ; when?
ble.s sbx_rtd0 ; ... no
move.b #1,sb_nstmt(a6)
st sb_wheiu(a6) ; when now in use
bra sb_execute ; ... use it
sbx_rtd0
tst.l d0
sbx_rts
rts
However, it appears that a small change there can remedy this situation without any runtime penalty: An additional check to hand over the break condition to sbx_wherr only if the job is running without it own command channel 0 seems a sensible approach as EX'd _bas files only get #0 opened under error conditions (and closed again if needed). This gives an WHEN ERRor handler the chance to check for ERR_NC and handle or ignore and continue as needed. That way, it also doesn't get in the way of interactive work in the interpreter:
Proposed change:
Code: Select all
tst.b sb_break(a6) ; break?
bpl.s sbx_brk0 ; ... yes, handle break
sbx_wherr
move.w sb_wherr(a6),sb_nline(a6) ; when?
ble.s sbx_rtd0 ; ... no
move.b #1,sb_nstmt(a6)
st sb_wheiu(a6) ; when now in use
bra sb_execute ; ... use it
sbx_rtd0
tst.l d0
sbx_rts
rts
sbx_brk0
move.l d0,d3 ; remember error code
jsr sb_chan0 ; check if channel 0 exists
beq.s sbc_brkcnt ; ...yes, normal break handling
move.l d3,d0 ; restore error code
bra.s sbx_wherr ; hand off to when error
sbc_brkcnt
move.l d3,d0 ; restore error code
bra.s sbx_rtd0 ; and give up
Not perhaps the most elegant code but I now have a local SMSQ build that behaves as I would expect it.
Incidentally: what is the protocol for contributing back into SMSQ/E mainline development? I would like to avoid having to maintain my private fork for this if others perhaps find it useful as well and would want to contribute upstream. Is there any way of doing this?
O