Setup International Keyboards in MS-DOS 6.22

The KEYB command in MS-DOS 6.22 is the essential system utility used to configure non-US keyboard layouts, character sets, and localized typing behaviors. By default, MS-DOS defaults to a standard United States QWERTY keyboard mapping; KEYB replaces this default BIOS keyboard handler with an expanded resident driver that maps hardware scan codes to country-specific characters, accents, and alternative layouts like AZERTY or QWERTZ. This guide covers how the KEYB utility works, its syntax, its role alongside code pages, and its configuration during the boot process.

Purpose and Functionality

When a user presses a key on a PC keyboard, the keyboard hardware sends a raw scan code to the system. In standard MS-DOS, the BIOS translates this code using a fixed US layout table. The KEYB utility acts as a Terminate-and-Stay-Resident (TSR) program that intercepts keyboard interrupt routines (INT 9 and INT 16h). It cross-references scan codes with the language-specific mapping tables provided in the KEYBOARD.SYS definition file, enabling the correct generation of dead keys, diacritics, and regional currency symbols.

Command Syntax and Key Parameters

The standard syntax for the KEYB command is:

KEYB [xx,[yyy],[d:][path]KEYBOARD.SYS] [/E] [/ID:nnn]
  • xx: The two-letter country code specifying the keyboard layout (e.g., gr for Germany, fr for France, uk for the United Kingdom, sp for Spain, or it for Italy).
  • yyy: The three-digit code page compatible with the selected language (e.g., 850 for Multilingual Latin 1 or 437 for standard US/European OEM).
  • [d:][path]KEYBOARD.SYS: The explicit file path to the layout definition file, typically C:\DOS\KEYBOARD.SYS.
  • /E: Informs DOS that an enhanced (101/102-key) keyboard is installed on an 8086/8088 PC.
  • /ID:nnn: Specifies a keyboard variant identifier for countries that have more than one standard layout, such as France (120 or 189) or Italy (141 or 142).

Integration with Code Pages

To produce the correct visual output for international inputs, KEYB must align with the active display code page. While KEYB governs input, utilities like DISPLAY.SYS and the MODE command govern how those characters render on screen.

For example, typing an umlaut or an accented letter with KEYB set to French or German requires a display font that contains those glyphs. Typically, this is achieved by preparing code page 850 in AUTOEXEC.BAT:

MODE CON CP PREP=((850) C:\DOS\EGA.CPI)
MODE CON CP SELECT=850
KEYB GR,850,C:\DOS\KEYBOARD.SYS

If the chosen code page does not match the layout specified in KEYB, MS-DOS generates a warning message alerting the user to an incompatible code page.

Automating KEYB at Boot

Users can invoke KEYB directly from the MS-DOS command prompt at any time, but it is typically automated to run during system initialization. It can be added to AUTOEXEC.BAT:

LH C:\DOS\KEYB.COM UK,850,C:\DOS\KEYBOARD.SYS

(The LH command loads the driver into upper memory blocks to conserve conventional base memory.)

Alternatively, it can be loaded directly from CONFIG.SYS using the INSTALL directive, which initializes the command before AUTOEXEC.BAT executes:

INSTALL=C:\DOS\KEYB.COM FR,850,C:\DOS\KEYBOARD.SYS

Layout Switching and Status Checks

Once loaded, KEYB allows users to toggle between the configured foreign layout and the default US layout on the fly using key combinations:

  • Ctrl + Alt + F1: Switches the keyboard handler to the default US layout.
  • Ctrl + Alt + F2: Switches back to the configured international layout.

Entering KEYB without any arguments displays the current active keyboard layout, its corresponding code page, and the active CON (console) code page.