Recently, I saw this exchange on the FreeDOS mailing list about how to add keyboard support to FreeDOS using XKEYB:


How to create a new keyboard layout?

As asked in the subject line. I would like to make a Dvorak keyboard layout.

Also, how does one implement ASCII code? In other words, where is the data stored for it? Is it in the BIOS or CMOS or something like that? Another way of saying that is, how does the computer know how to display a particular letter of the alphabet?

-Eugene Wong


Aitor responds:
Check xKeyb (LATEST VERSION: 1.51). The driver is already done.You just have to write your own Dvorak.key file, and if you do so, and you submit it to me, I will include that in future releases of xKeyb. The format of the *.key files is not difficult to understand (check the included documentation, keyb_e.txt is in English). So you just have to type:
XKEYB DVORAK

and you would do it.

Each key has an assigned scan code (check http://www.ctyme.com/intr/rb-0045.htm). The scan-code is fixed for each keyboard layout (i.e. different for the old 8X keys, 10x keys and the new keyboards), but your MFII 102 keys keyboard and mine have same scan-codes for each key. When a key is pressed, INT 09h is triggered.

Now, for each scan-code, there's an associated ASCII code (or sequence), that corresponds to it. There's some default on the BIOS (through int 16h), so that the ASCII codes correspond to the letters you have printed in an US (I assume, I have rarely seen them) keyboard, and both scancode and ASCII are stored in the keyboard buffer.

KEYB (and xKEYB) basically catch the INT 9h, so that the for each different local layout, the correct symbols are passed as ASCII. For example, in a MFII 102 keyboard, the key with scancode 27h is near the 'Enter' key, and if you press it, default Int9h handler will store ; in the keyboard buffer, and you will probably have this symbol on that key. When I do XKEYB SP, then the new Int9h handler, using the instructions of SP.KEY, will store the character there, as this is the letter printed in the key having scancode 27h.

The *.KEY files contain that all.

Interesting. Please, if in the end you write a *.KEY file, let me know how well did it work to you. I don't have a clear picture wether the program is working correcly or not. Besides the fact (important) that the complete path to the *.KEY file should be given as parameter (and therefore, XKEYB KEY\SP.KEY is the correct form, if the KEY files are in .\KEY, I have cases (as myself) where it is working fine, whereas I have some others (Alain, and others) that are having problems with it.

So now for everybody: please, if you are using a non-US keyboard, could you please test XKEYB and let me know how well it works for you?

Important Notes:

1) the codes and numbers I have used could be wrong, as I was using my memory

2) Yes, I did some simplification in the explanation, but said the essential. I didn't mean to explain everything, so avoided to mention what was not essential for the discussion (e.g. break/make, keyboard status bytes,...)

3) I will correct that stupid thing of the complete path to KEY files in next release.

-Aitor


...and it sounds like Eugene has completed this, and submitted it back to Aitor? So perhaps we will see a dvorak definition in a future release, if all goes well.