Break vector?

Anything QL Software or Programming Related.
Post Reply
User avatar
ajb
ROM Dongle
Posts: 49
Joined: Sat Oct 19, 2019 6:14 am
Location: W.Yorks

Break vector?

Post 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
Last edited by ajb on Thu Dec 03, 2020 7:02 pm, edited 1 time in total.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Break vector?

Post 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.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
ajb
ROM Dongle
Posts: 49
Joined: Sat Oct 19, 2019 6:14 am
Location: W.Yorks

Re: Break vector?

Post by ajb »

Thanks Norm. That's useful extra (ALT) information.

Alan


Post Reply