Page 1 of 1

Two scancodes?

Posted: Sat Jul 03, 2004 6:20 am
by Whodoo
In the scancode table here:
http://panda.cs.ndsu.nodak.edu/%7Eachap ... odes1.html

for some keys there are two scancodes? Like Right control:
R CTRL E0,1D
how come?

Re:Two scancodes?

Posted: Sat Jul 03, 2004 7:27 am
by Whodoo
And just one more thing :) Is it possible to print more "special characters" in Protected Mode... Cause such characters as ? ? ? ? and so on are replaced by other weird characters..any way to get around this or do I have to write my own routines for text displaying (now Im just setting the character in the videomemory)

Re:Two scancodes?

Posted: Sat Jul 03, 2004 10:25 am
by Brendan
Hi,
Whodoo wrote: In the scancode table here:
http://panda.cs.ndsu.nodak.edu/%7Eachap ... odes1.html

for some keys there are two scancodes? Like Right control:
R CTRL E0,1D
how come?
There's normal keypresses, extended keypresses and weird keypresses. For extended keypresses there's an escape code "0xE0" followed by the make (or break) code. The weird keypresses are "pause" and "print screen". The "print screen" make sequence is the same as "left shift" then "keypad *", and the break sequence is the reverse (even though it's a completely different key). The "pause" sequence is worse - it's almost the same as "right control" then "keypad 6" except for the different escape code and that the break is sent immediately after the make (not when the key is released). Your keyboard driver should handle all of this (the scan code table should be enough).

The reason for all of this is the same reason we still need to turn gateA20 on - "backward compatibility".

Also there are other codes that aren't related to a keypress (or release) - see Ralf Brown's IO Port List. Of these other codes it's good to respond to the BAT OK code (0xAA - Basic Assurance Test) by setting the typematic rate and keyboard LED's to what they should be. The BAT is sent by the keyboard at power-on or reset, and responding to it properly will allow the keyboard driver to work with manual switch boxes (used to connect several computers to the same keyboard, mouse, monitor) and allow the keyboard to be swapped without rebooting.
Whodoo wrote: And just one more thing :) Is it possible to print more "special characters" in Protected Mode... Cause such characters as ? ? ? ? and so on are replaced by other weird characters..any way to get around this or do I have to write my own routines for text displaying (now Im just setting the character in the videomemory)
Take a look at this:

http://www.evergreen.edu/biophysics/tec ... ext-pc.htm

The VGA card uses the characters in the DOS column....

Cheers,

Brendan

Re:Two scancodes?

Posted: Sat Jul 03, 2004 10:37 am
by Whodoo
Alright thanks.. but the right alt, Alt Gr..
the tables says
R ALT E0,38

but when I print the scancodes and press Alt Gr I get
29, 157, 224, 56

which is four numbers instead of two? I dont know if it matters that I do not use an english keyboard

Re:Two scancodes?

Posted: Sat Jul 03, 2004 11:34 am
by Brendan
Hi,
Whodoo wrote: Alright thanks.. but the right alt, Alt Gr..
the tables says
R ALT E0,38

but when I print the scancodes and press Alt Gr I get
29, 157, 224, 56
29 = 0x1D = Left control pressed
157 = 0x9D = Left control released
224, 56 = 0xE0, 0x38 = Right alt pressed
Whodoo wrote: which is four numbers instead of two? I dont know if it matters that I do not use an english keyboard
Using a non-US keyboard would make a difference (the scan code chart is for US keyboards). Take a look at:
http://www-306.ibm.com/software/globali ... ysical.jsp

Unfortunately it doesn't show scancodes..

Cheers,

Brendan

Re:Two scancodes?

Posted: Sat Jul 03, 2004 3:55 pm
by Whodoo
Who, didnt know that Alt gr = ctrl+Alt :) thank you man!