Two scancodes?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Whodoo

Two scancodes?

Post 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?
Whodoo

Re:Two scancodes?

Post 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)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Two scancodes?

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Whodoo

Re:Two scancodes?

Post 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
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Two scancodes?

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Whodoo

Re:Two scancodes?

Post by Whodoo »

Who, didnt know that Alt gr = ctrl+Alt :) thank you man!
Post Reply