Keyboard input
Posted: Mon Dec 15, 2008 6:08 pm
Hey guys, I'm working on getting keyboard input, having some trouble with it, and wondering if you could give me some advice with it.
Currently, I have the interrupts set up and they successfully recognize whenever a key is pressed or released. However, I'm having some troubles with interpreting the scan codes. I found a website http://www.barcodeman.com/altek/mule/scandoc.php with several charts listing scan codes corresponding to a 102-key keyboard.
I could manually create two character arrays, one for the ascii letters and one for the keyboard scancodes and then refer one to the other, but this seems like a lot of work, that should be avoidable.
I found code on OSdev http://wiki.osdev.org/Keyboard_Input listing the following code as a reference to the letters, but it gives me a compiler error:
char lowercase[256] = {0x1E:'a'};
char uppercase[256] = {0x1E:'A'};
How do the rest of you all handle keyboard inputs? Or do I just need to bite the bullet and hand-write out all the scan codes?
Currently, I have the interrupts set up and they successfully recognize whenever a key is pressed or released. However, I'm having some troubles with interpreting the scan codes. I found a website http://www.barcodeman.com/altek/mule/scandoc.php with several charts listing scan codes corresponding to a 102-key keyboard.
I could manually create two character arrays, one for the ascii letters and one for the keyboard scancodes and then refer one to the other, but this seems like a lot of work, that should be avoidable.
I found code on OSdev http://wiki.osdev.org/Keyboard_Input listing the following code as a reference to the letters, but it gives me a compiler error:
char lowercase[256] = {0x1E:'a'};
char uppercase[256] = {0x1E:'A'};
How do the rest of you all handle keyboard inputs? Or do I just need to bite the bullet and hand-write out all the scan codes?