Interrupts and their handlers on the various QLs

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

Interrupts and their handlers on the various QLs

Post by Zarchos »

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/Archimedes ... +%28100%25
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Interrupts and their handlers on the various QLs

Post by NormanDunbar »

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?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Interrupts and their handlers on the various QLs

Post by tofro »

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: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Interrupts and their handlers on the various QLs

Post by dilwyn »

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


User avatar
Zarchos
Trump Card
Posts: 152
Joined: Mon May 08, 2017 11:49 am

Re: Interrupts and their handlers on the various QLs

Post by Zarchos »

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/Archimedes ... +%28100%25
User avatar
Peter
QL Wafer Drive
Posts: 1953
Joined: Sat Jan 22, 2011 8:47 am

Re: Interrupts and their handlers on the various QLs

Post by Peter »

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.


Post Reply