I'm not a Windows user so am unable directly to comment, but is SDL or
some other cross-platform library possibly contributing to the
confusion?

Here in Mac world the caps lock key is a special case. It sends a key
down when caps lock is engaged and a key up when caps lock is
disengaged. That was originally because original Mac keyboards had a
caps lock key with a little latch, like a pen with a button, so that
you pressed it once and it stayed down, you pressed it again and it
popped back up, and I guess it continues because Apple don't consider
it sufficiently worrisome to be worth the mild breakage.

Slightly boring history lesson of a minority platform aside, when last
I checked SDL handled this problem by emulating Mac behaviour on all
platforms. It looks like in ye olde ASCD you used Allegro. I doubt
those guys had any particular strategy for handling this, and even if
they did they probably got it wrong, then squabbled over maintaining
DOS support ten years after the fact.

So, anyway: is there any possibility that either you and other authors
are seeing differing results because some are using cross-platform
libraries that attempt to reconcile Mac and PC behaviour?

On 8 April 2012 12:43, Aleš Keprt <a...@keprt.cz> wrote:
> Hi Sam users!
>
> I encountered a weird caps lock behaviour, and I'd like you to test it too
> and let me know whether you encounter the same problems or not. On my
> computer all emulators I tested have got problem with caps lock - it simply
> doesn't work as expected. So I made changes to keyboard handling routine in
> ASCD 0.98 to let it work. And now this new version is the only emulator
> where caps lock works correctly on my computer, but Simon Owen wrote me that
> on his computer it is different and ASCD 0.98 doesn't work correctly like
> other emulators.
>
> Please can you test it? If you compare ASCD 0.98 with SimCoupe, you should
> clearly see difference in caps lock behaviour in Sam Basic. You can also
> test older ASCD 0.98 WIP which uses the old (i.e. standard) caps lock
> routine and will probably be similar to SimCoupe.
>
> Download here:
> http://www.keprt.cz/progs/ascd/ascd098.zip
> http://www.keprt.cz/progs/ascd/ascd098wip3.zip
>
> -------------------------------------------
>
> Technical information follows:
>
> Normally each key sends KEYDOWN when you press it, then it waits 250 ms
> (this can be set in Windows) and then sends another KEYDOWN's as long as you
> hold down the key. The speed of autorepeat can be set in Windows as well,
> normally it sends 30 KEYDOWN's per second on my computer (which is the
> highest speed possible on a standard PC keyboard). Finally it always sends a
> single KEYUP when you release the key.
>
> Caps lock sends initial KEYDOWN normally, then waits 250 ms (i.e. still
> everything normal), but when you hold down the key longer, it starts to send
> weirdly KEYUP - KEYDOWN - KEYUP - KEYDOWN... etc. at 30 events per second
> (i.e. 15x KEYUP and 15x KEYDOWN). When you release the key, the final event
> sent is based on the state of the green caps lock led on the keyboard. So
> you
> can never know if the final event will be KEYDOWN or KEYUP.
>
> I use Windows 7 with plain standard PS2 keyboard driver, at least I think. I
> will definitely go and test it on other computers (I have a few old ones at
> home).
>
> -----------------------------------------
> Mgr. Aleš Keprt, Ph.D.
> private: a...@keprt.cz, www.keprt.cz
> office: Moravian College / Moravská vysoká škola Olomouc, ales.ke...@mvso.cz

Reply via email to