| Home | | Developer Releases | | Stable Releases | | Documentation |

Technical README
DANG  - 0.99
Next Previous Contents

6. The Keyboard group of Modules

All of the Keyboard handling code is in the "keyboard" subdirectory.

Latest addition is SLANG.

6.1 base/keyboard/keymaps.c Information

These are definitions, giving which key is related to which scancode in raw keyboard mode. Basically, the code of 'x' on a US keyboard may be that of a 'Y' on a German keyboard. This way, all types of keyboard can be represented under DOSEMU. Also, the right ALT-key is often a function key in it's own right.

6.2 Remarks in base/keyboard/keymaps.c

The DEAD codes must refer to keys that don't exist on any language keyboard. I hope nobody has a smily face key :-) dead_key_table is a list of the dead keys supported. They must be placed on the correct key in the keymaps above. See key_map_es_latin1.


dos850_dead_map consists of the triple, {deadkey, letter, result}. It should be correct for all the code page 850 users (Western Europe). If you uses a different code page, please create a map! Jon Tombs jon@gtex02.us.es

6.3 base/keyboard/serv_xlat.c Information

This module contains the the translation part of the keyboard 'server', which translates keysyms into the form in which they can be sent do DOS.

The frontends will call one of the following functions to send keyboard events to DOS:

     putrawkey(t_rawkeycode code);
     putkey(Boolean make, t_keysym key)
     set_shiftstate(t_shiftstate s);

Interface to serv_backend.c is through write_queue(bios_key, shift, raw).

More information about this module is in doc/README.newkbd


Rainer Zimmermann <zimmerm@mathematik.uni-marburg.de>

6.4 Functions in base/keyboard/serv_xlat.c

These are the functions defined in base/keyboard/serv_xlat.c.


This function sends a raw keycode byte, e.g. read directly from the hardware, to DOS. It is both queued for the port60h emulation and processed for the BIOS keyboard buffer, using the national translation tables etc.

For DOS applications using int16h we will therefore not have to load KEYB.EXE, others (e.g. games) need their own drivers anyway.

This function is used if we are at the console and config.rawkeyboard=on.


This does all the work of sending a key event to DOS. scan - the keycode, one of the KEY_ constants from new-kbd.h make - TRUE for key press, FALSE for release ascii - the key's ascii value, or 0 for none.

Applications using int16h will always see the ASCII code passed here independently of the scancode, so no character translation needs/should be done. As DOS expects characters in IBM Extended ASCII, the keyboard clients may have to do ISO->IBM character translation or similar!

An emulated hardware scancode is also sent to port60h.

Note that you have to send both MAKE (press) and BREAK (release) events. If no BREAK codes are available (e.g. terminal mode), send them immediately after the MAKE codes. Also, shift keys should be sent (with ascii = 0).


This simply sets the keyboard server's shift state.

USE WITH CAUTION: this changes the keyboard flags without generating the appropriate shift key make/break codes that normally come along with such changes. This function is mostly intended for start-up shiftstate synchronisation.

Note also that you can't simply write to the shiftstate variable instead of using this function.

6.5 base/keyboard/serv_backend.c Information

This module handles interfacing to the DOS side both on int9/port60h level (if keybint=on), or on the bios buffer level. Keycodes are buffered in a queue, which, however, has limited depth, so it shouldn't be used for pasting.

More information about this module is in doc/README.newkbd


Rainer Zimmermann <zimmerm@mathematik.uni-marburg.de>

6.6 base/keyboard/serv_8042.c Information

This code provides truly rudimentary 8042 controller emulation. Not having any documentation on the 8042 makes it hard to improve. :)

6.7 base/keyboard/keyb_raw.c Information

6.8 Functions in base/keyboard/keyb_raw.c

These are the functions defined in base/keyboard/keyb_raw.c.


Initialize the keyboard for RAW mode.

6.9 base/keyboard/keyb_slang.c Information

6.10 Functions in base/keyboard/keyb_slang.c

These are the functions defined in base/keyboard/keyb_slang.c.


Code is called at start up to set up the terminal line for non-raw mode.

Next Previous Contents
The DOSEMU team