Page 1 of 1

Break vector?

Posted: Thu Dec 03, 2020 2:04 pm
by ajb
Is there any equivalent of a break vector that I can hijack in QDOS? I can find no such animal in Pennell or Dickens. I'm after a way for an assembler program to jump to a restart location if a specific key is pressed. I'd rather not do a key row scan as that'd add a substantial overhead. The nearest thing I've been able to find is to test SV.ARBUF (last key pressed) for Esc (1B). That works but has the disadvantage, like a key row scan, of being a poll (and therefore limited to specific test positions) but it also smells like just the sort of thing that wouldn't be portable across all QL OSs. I already handle exceptions but can't see how they could be made to emulate a break vector and they'd just end up with a poll at a later stage; similarly with interrupt handling or polled linked lists.

Am I missing anything and, if not, is use of SV.ARBUF portable (as long as it's indexed via MT.INF)?

Alan

Re: Break vector?

Posted: Thu Dec 03, 2020 3:53 pm
by NormanDunbar
ajb wrote:is use of SV.ARBUF portable (as long as it's indexed via MT.INF)?
I've used this before myself with no problems, obviously it has to be an offset ($8A) from the base of the system variables. I have notes about it in my Pennel margins:

If the high byte is zero, then the low byte is the key code; unless ALT is pressed whereby the high byte is the key code and the low byte is 255.

I suspect this is still the case under SMSQ etc. EDIT: Tested with the following, it's still valid.

Code: Select all

1000 REMark Uses DJToolkit
1010 REMark Scans SV_ARBUF to read keypresses.
1020 :
1030 SV = SYSTEM_VARIABLES
1040 REPeat loop
1050    AT 0,0: PRINT PEEK_W(sv + $8A);"   ",
1060    PRINT "HI: "; PEEK(sv + $8A);"   ",
1070    PRINT "LO: "; PEEK(sv + $8A);"   "
1080 END REPeat loop

Cheers,
Norm.

Re: Break vector?

Posted: Thu Dec 03, 2020 5:20 pm
by ajb
Thanks Norm. That's useful extra (ALT) information.

Alan