On 17 Mar 2003 at 14:50, James Hunkins wrote:

> 
> Can anyone do a quick algorithm explanation of how the QL handles 
> multiple keystrokes?  I am trying to track some issues in a rather 
> obscure case where I am running QPC under Virtual PC (Windows 98 
> version) on a Mac OS X system (I did say obscure - but it eliminates 
> another computer from my backpack!).

Have a look at the following files:

SMSQ_q40_kbd_int_asm
This show how a key byte is gotten by the interrupt server whenever a 
keypress occurs.


The keypress is then passed on to the routine in
smsq_kbd_ibm_at102cvt_asm

This essentially works as follows
the kb_intop word is checked and acted on. This variable determines 
what the behaviour of the keyboard handling routine should be, 
depending on the PREVIOUS keyboard byte that was handled - since 
a keypress/release  may generate several bytes coming in from the 
keyboard.
So, depending on what came before, different key handling routines 
are called, and each sets the kb_intop word again.

If the key is just a "normal" key, it is put into the keyboard queue.

> In addition to a quick algorithmic summary, here are a few specific 
> questions.  The interest is not in the SuperBasic side but in how the 
> actual OS (SMSQ/E) itself handles it.  Any interrupt dependencies would 
> also be good to know about.
> 
> 1) how do you tell if a key is held down?
because you haven't got a code that tells that is has gone up
(this code should be $f0, as far as I can tell)

> 2) how do you tell if multiple keys are being pushed
>          - simultaneously
>          - held down together
>From looking at the routine (a bit superficially)
I don't think that there is much difference in keys being pushed down 
simultaneaously and held down together. I PRESUME you will just get 
a stream of bytes telling you that the keys are down, without getting 
one telling you that a key went up.
> 3) how do you know when they are released (individual or as a group)
As far as I can dtermine from the code, when a key goes up, you get 
the byte $f0 from the keyboard, followed by the byte determining what 
the key is that just went up.
So the routine in smsq_kbd_ibm_at102cvt_asm, upon receiving the 
$f0, set the intop variable to show that the next byte in should be trated 
as meaning that this key went up.

> Thanks for the help,

I hope this did help.
You could also have a look at the file "kbd_tab.doc", a word file that 
came with the sources.


Wolfgang



Reply via email to