keyboard.sys internal structure wanted

Skip to first unread message

Petr Soucek

Dec 29, 2001, 9:23:53 AM12/29/01

I'd like to change some key mappings and dead keys in MS-DOS, and I need
internal structure of keyboard.sys keyboard definition file.

Does anybody know anything about it? I saw that the definition is the
same for MS-DOS 6.22, 7.0 and 7.1, so any help will be useful.

Best Regards,

Petr Soucek

Matthias Paul

Dec 30, 2001, 12:36:08 PM12/30/01

In fact, the format is basically the same in MS-DOS 3.3 - 8.0, PC DOS
3.3 - 2000, including Russian, Lithuanian, Chinese and Japanese issues,
as well as in Windows NT, 2000, and XP (not sure about OS/2 right now).
There are minor differences and incompatibilities, but the general
format has not changed over the years.

In the attempt to achieve maximum "plug-in" compatibility with possibly
existing 3rd party keyboard layouts using the KEYBOARD.SYS format, we
tried to add support for that file format in our advanced keyboard
driver and console extension FreeKEYB some years ago.

As you might have found out already, it is relatively easy to decode the
outer KEYBOARD.SYS format, but it愀 getting much more difficult and
confusing when you reach the actual data containers. Some of the data
entries contain normal tables, which you might be able to patch for
your purposes. However, most entries contain "executable code" interpreted
by some kind of P-code interpreter at *runtime*, including conditional
branches and the like. This is why the KEYB driver has such a huge
memory footprint compared to table-driven keyboard drivers which can
be done in 3 - 4 Kb getting the same level of functionality except
for the interpreter. You won愒 have much luck to patch KEYBOARD.SYS
files much beyond replacing Numpad dot and comma or other easy changes
like this. The only thing you could do is developing new KEYBOARD.SYS
files from scratch using a macro assembler...

Once we had finished decoding the KEYBOARD.SYS format, we decided not
to follow that route in our project; the format is simply too complex
for its actual purpose. It might have been good in the first place to
reduce development and support costs for the original DOS keyboard
driver, but IMHO it is far from being a *technically* optimal solution
to the problem in the DOS environment, where every byte counts.
(In contrast to KEYB, our FreeKEYB driver internally uses table-driven
keyboard layout definitions based on a special 16-bit codepage tailored
for keyboard driver specific needs, and the loader will dynamically
optimize the resident data areas and code sections at byte level to
remove any redundancy from the driver depending on the given hardware/
software/driver configuration and locale.)

If Ralf Brown gets around to incorporate the stuff I submitted, the
KEYBOARD.SYS format should become documented in the next issue of
RBIL (it愀 not in RBIL61).

Feel free to contact me privately for a current beta issue of FreeKEYB,
and Axel C. Frinke and I might consider to add your suggestions to the
Czech layout if they fit in nicely with FreeKEYB愀 general feature
design philosophy.

Hope it helps,



<>; <>;

Reply all
Reply to author
0 new messages