Interrupts and their handlers on the various QLs

Anything QL Software or Programming Related.
User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Interrupts and their handlers on the various QLs

Postby Zarchos » Thu Nov 23, 2017 11:07 am

Hi friends.

Is there somewhere some articles on how interrupts work on the QL ?
The various interrupts (like keyboard key handling, but also programmed, which I would call software).

How does it work ?
What about the handlers, how do they service an interrupt ?
Is it possible to queue your own code after what the various operating systems do ?
Completely replace the handlers by your own code ?
Put your very own code as 1st in the list to service, and then leave the standard unmodified handlers do their job ?

I'd like to know more about how it works on the various QLs, with their various operating systems.
Are there fast interrupts and 'slow, normal interrupts' ?
Can one kind of interrupt interrupt the interrupt code being executed or is the job done after the 1st one is completed ?
What about re entrancy ?

Thanks in advance.
Xavier.


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes75009/search?query=Acorn+Archimedes+Shadow+Of+The+Beast+%28100%25
User avatar
NormanDunbar
Super Gold Card
Posts: 522
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Interrupts and their handlers on the various QLs

Postby NormanDunbar » Thu Nov 23, 2017 1:54 pm

This might help: http://www.dilwyn.me.uk/docs/manuals/QD ... 20v4.3.pdf - search for interrupts.

Cheers,
Norm.


Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?
If at first you don't succeed, don't take up skydiving!
If you think your job is pointless, remember, there's a man in Germany who fits indicators on BMWs.
User avatar
tofro
QL Wafer Drive
Posts: 1423
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Interrupts and their handlers on the various QLs

Postby tofro » Thu Nov 23, 2017 2:01 pm

The QL is not really an interrupt-driven computer, at least not in a classical sense.

The most significant (and, in a standard QL - basically only, at least if you look into the ones relevant for games) interrupt source is a 50/60Hz interrupt that is handled by the system as a trigger to frequently poll all the hardware.

The polling routines are linked into the OS's polling loop which is then frequently called on a timer interrupt.

Because (at least on a standard QL) the vectors are located in ROM, you cannot directly link into them - But there is a system routine that allows you to link your routine into the
  • polling loop which is the "fast interrupt handler" that serves only hardware, at least normally, and the
  • Scheduler loop which is kind of a "slow interrupt handler" that also powers the multitasking. This is where any application timer code should go.
As the polling loop is highly time-critical, only very short and time-critical routines should be linked in, longer and less time-critical routines should go into the scheduler loop. In case the polling loop gets overloaded, you might start to miss hardware events. Both are triggered from the VBI and enter any new entry at the beginning of the list.

You can switch off the scheduler loop (and thus, multi-tasking) entirely by running in supervisor mode.

The polling concept entirely removes most problems of interrupt re-entrancy.

This is the basic QL concept, which is, at least largely, followed by any QL derivates. The sound system on more modern system acts a bit differently.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
dilwyn
Mr QL
Posts: 1362
Joined: Wed Dec 01, 2010 10:39 pm
Location: Wales
Contact:

Re: Interrupts and their handlers on the various QLs

Postby dilwyn » Thu Nov 23, 2017 3:17 pm

There's an article and finished extension called KeyBeep on the Utilities page on my website http://www.dilwyn.me.uk/utils/index.html which includes assembler source showing how to write a routine to use the scheduler loop for (in this case) a relatively trivial application to switch off and on beep sounds when you press a key on the QL keyboard. The beep duration and pitch can be set along with different values for when caps lock is off or on if you wish.

I think it was written as a Quanta article some years ago and I had completely forgotten about it until this subject came up, I can't even remember if it was ever published! Hopefully it'll be of some use to someone...


Dilwyn
All things QL: see www.dilwyn.me.uk
User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Re: Interrupts and their handlers on the various QLs

Postby Zarchos » Thu Nov 23, 2017 3:36 pm

Thanks to all of you for your help.
Will read that tonight.


Owner of various QLs including accelerated beasts, and also a happy Q68 owner ;)
Now porting SOTB to the Archies, to then port it to the Q68.
https://www.youtube.com/user/Archimedes75009/search?query=Acorn+Archimedes+Shadow+Of+The+Beast+%28100%25
User avatar
Peter
Super Gold Card
Posts: 672
Joined: Sat Jan 22, 2011 8:47 am

Re: Interrupts and their handlers on the various QLs

Postby Peter » Thu Nov 23, 2017 8:02 pm

Two relatively wellknown deviations from the "polling philosopy" described by Tobias are the QIMI mouse driver and the serial port driver, which have higher, asynchronous interrupt rates. But priority is the same as the frame interrupt, so they won't interrupt each other.



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 2 guests