Keyboard layouts in ST-DOS The KEYB program can be used to change the keyboard layout from the BIOS default. Keymap files A keymap file is an ASCII text file that can be edited with a normal text editor. A keymap file has two types of lines: key-character-assignment lines and letter-diacritic-combination lines. The format of a key-character-assignment line is: [SCANCODE] [CHAR_NORMAL] [CHAR_CAPS] [CHAR_SHIFT] [CHAR_ALTGR] [CHAR_ALTCAPS] Each field is a 8-bit hexadecimal number that consists of two numerals between 0 and F. Meaning of the fields: SCANCODE is the keyboard scancode from the CPU's I/O port 0x60. CHAR_NORMAL is the "base" character that is normally inserted to the keyboard buffer. For letter keys it would normally be the lowercase letter. CHAR_CAPS is the uppercase version of the previous value. This normally does not exist for the numeral keys. CHAR_SHIFT is the character that is added to the keyboard buffer if the SHIFT key had also been held down while the key was pressed. This normally does not exist for letter keys. CHAR_ALTGR is the character that is added to the keyboard buffer if the ALTGR key had also been held down while the key was pressed. This is not used with most English keyboards. CHAR_ALTCAPS is the character that is added to the keyboard buffer if the ALTGR key was held down, and at the same time either CAPS LOCK was on or the SHIFT key was also held down, while the character key was pressed. For "dead keys" an additional field is used - a 16-bit hexadecimal number DEAD. This tells the keyboard handler that the character from this key must not be immediately added to the keyboard buffer. Instead it waits for the next keypress and combines its character with the diacritics from the previously pressed dead key. The format of a letter-diacritic-combination line is: DEAD [LETTER] [DIACRITIC] [RESULT] The first number, DEAD, tells the parser the type of this line. LETTER is the byte value of the base letter. DIACRITIC is the byte value of the diacritic that is added to the letter. RESULT is the byte value of the resulting character. A letter-diacritic-combination line always starts with the 16-bit number DEAD. The same 16-bit number can be found in the end of the key-character-assignment lines for dead keys. Examples: Key-character-assignment line for the [M] key: 32 6D 4D 00 E6 E6 Keycode: 32 (the M key in most keyboard layouts) Base character: 6D (ASCII value of the letter m) Uppercase character: 4D (ASCII value of the letter M) Shift character: 00 (the M key doesn't print a special character with SHIFT pressed) Alt Gr character: E6 (byte value of the greek letter mu, æ, in codepage 437) Alt caps character: E6 Key-character-assignment line for the [ï] key in the Finnish keymap: 0D EF EF 60 7C 7C DEAD Keycode: 0D Base character: EF (ASCII value of the character ï) Uppercase character: EF Shift character: 60 (ASCII value of the character `) Alt Gr character: 7C (ASCII value of the pipe character |) Alt caps character: 7C Letter-diacritic-combination line for the character ™: DEAD 4F FA 99 Base letter: 4F (ASCII value of O) Diacritic: FA (ASCII value of two dots in code page 850, does not exist in code page 437) Result: 99 (byte value of the letter ™)