Keyboard Scan Code Fun
Kye
Posts: 2,200
Hey all,
I recently finished my vga engine and now I'm working on writing ps2 mouse and keyboard drivers. I've completed the mouse driver so far and it works perfectly, but now I'm trying to make a ps2 keyboard driver and I'm runninng into a few design problems.
First of all, I don't know which scan code set to use... I know there are three sets, but which one should I count on being implemented and actually useable as some keyboards may not support all three...
I would like to use scan code set 3 because it is the simplest, with a one byte make code and·two byte break codes per key.
However, I'm not sure if every keyboard will support set three. I know every keyboard will support set two, but set two has a few outliers like the print screen and pause break keys in addition to the altered shift and numberlock keys which can make the code very convoluted for nothing.
I not sure about set one however and how easy it would be to use. I know set one is what the computer sees internally after the scan code conversion from the keyboard controller, but I don't know if it will be easier to use.
So, if anyone has a reconmendation for which set to use please help.
Also, the way I want my driver to deliver information is simply in a truth false table that will show the state of every key on the keyboard using a 104 entry buffer. I'm not sure how to arrange the values in a buffer like this though. Should I try to put the characters that overlap with the ASCII character set in the same place or should I make it into a listing of the key groups?
Thank you for your help!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I recently finished my vga engine and now I'm working on writing ps2 mouse and keyboard drivers. I've completed the mouse driver so far and it works perfectly, but now I'm trying to make a ps2 keyboard driver and I'm runninng into a few design problems.
First of all, I don't know which scan code set to use... I know there are three sets, but which one should I count on being implemented and actually useable as some keyboards may not support all three...
I would like to use scan code set 3 because it is the simplest, with a one byte make code and·two byte break codes per key.
However, I'm not sure if every keyboard will support set three. I know every keyboard will support set two, but set two has a few outliers like the print screen and pause break keys in addition to the altered shift and numberlock keys which can make the code very convoluted for nothing.
I not sure about set one however and how easy it would be to use. I know set one is what the computer sees internally after the scan code conversion from the keyboard controller, but I don't know if it will be easier to use.
So, if anyone has a reconmendation for which set to use please help.
Also, the way I want my driver to deliver information is simply in a truth false table that will show the state of every key on the keyboard using a 104 entry buffer. I'm not sure how to arrange the values in a buffer like this though. Should I try to put the characters that overlap with the ASCII character set in the same place or should I make it into a listing of the key groups?
Thank you for your help!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Comments
Set 3 sounds like the one that the ancient IBM PC/XT used,
since I recall it as not having the extra nonsense with long
codes for some of the keys. I have no idea why there are
3 different sets, all of which are neither obviously
standard or logical, except for the evil conspiracy
known as planned obsolescence. Any other explanation?
I have, and also find it easiest to make from scratch,
a keyboard that outputs either ASCII or Row/Column code,
but no one is selling those since the 1980's.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,