Hi,
gabemaiberger wrote:I just finished a function for getting a key from the keyboard. How would I make a table to use via xlat so I can translate a keyboard scancode to an ascii code?
Sadly, scan codes are not sequentially numbered, which makes them a pain in the neck for things like table lookups. Therefore the first thing you'll need to do is convert the scan code into a "key code" (where your "key codes" are sequentially numbered).
The next thing you want is a bitmap, where each bit in the bitmap says if the key is being held down or not. You need this so that you can determine the difference between "A", "control+A", "shift+A", "control+shift+A", etc.
Once you've got that done you want some sort of file that describes a keyboard layout. This file should include a list of which keys are "special" (e.g. left control, right control, left shift, caps lock, number lock, etc) and how those special keys effect state (e.g. both shift keys might cause the same "shift" flag to be set if they're held down). In addition to describing special keys, the file should also include many "key code to character" tables for each possible state. For example, you'd have one table for "key alone", one table for "shift+key", one for "caps_lock + key", one for "caps_lock + shift + key", one for "numb_lock + control + alt + key", etc.
Once this is done you'd need to create lots of different "keyboard layout files" - one for each possible
keyboard layout. You also need something to tell the keyboard driver which keyboard layout is being used (which means having some sort of configuration variable/setting somewhere as this can't be auto-detected for PS/2 hardware).
Cheers,
Brendan