How MS-DOS 6.22 Handles International Keyboards

MS-DOS 6.22 processes international keyboard layouts by intercepting low-level hardware scan codes before standard BIOS translation occurs. By replacing the default interrupt handler using the KEYB.COM utility and layout tables from KEYBOARD.SYS, the operating system translates raw keyboard scan codes into localized character sets, handling state shifts, dead keys, and specific code page mappings directly in memory.

The Hardware Interrupt and Default BIOS Behavior

When a user presses or releases a key on an IBM-compatible PC, the keyboard controller generates an interrupt request (IRQ 1), firing INT 9h. The default system BIOS reads the raw 8-bit scan code (a "make" code on press or a "break" code on release) from I/O port 60h. In a baseline system without localization, the BIOS maps this hardware scan code directly to an ASCII value based on a standard US QWERTY layout, storing the scan code and ASCII pair in the BIOS keyboard buffer read by INT 16h.

The Role of KEYB.COM and KEYBOARD.SYS

MS-DOS 6.22 overrides this default translation using the KEYB.COM terminate-and-stay-resident (TSR) program. Loaded either via AUTOEXEC.BAT or from the command line (e.g., KEYB GR,,C:\DOS\KEYBOARD.SYS), KEYB.COM hooks into INT 9h and INT 16h.

Instead of letting the BIOS process the scan code, KEYB.COM acts as a driver layer that references mapping tables found within binary definition files like KEYBOARD.SYS. These files contain sub-mapping tables for designated country codes, physical keyboard types (such as standard 84-key or enhanced 101/102-key keyboards), and target display code pages.

Translating Scan Codes into International Characters

When INT 9h triggers, KEYB.COM intercepts the incoming scan code and evaluates it through several stages:

  1. Shift State Tracking: The driver monitors modifier keys, tracking Left Shift, Right Shift, Control, and the international AltGr key (interpreted as the right-side Alt key, or a synthetic Ctrl + Alt combination).
  2. Scan Code Substitution: The driver searches its active layout table for the matching scan code under the current modifier state. For instance, scan code 15h (key Z on a US keyboard) maps to Y on a German QWERTZ layout.
  3. Dead Key Logic: For layouts containing diacritics (such as acute, grave, or circumflex accents), the driver maintains an internal state machine. When a dead key scan code is received, KEYB.COM stores the accent internally without outputting a character to the buffer. If the subsequent scan code corresponds to an accentable vowel, the combined accented character is output; if not, the driver outputs the accent followed by the unaccented character.
  4. Code Page Resolution: Characters are generated to match the active DOS code page (such as CP 437 for US/multilingual legacy or CP 850 for Western Europe). The layout table provides the specific extended ASCII index corresponding to that character in the loaded code page.

Buffer Injection and Application Hand-off

Once KEYB.COM resolves the scan code and the correct code-page-specific ASCII byte, it bypasses or augments the standard BIOS translation. The translated ASCII character and the original (or remapped) scan code are placed into the circular 16-byte BIOS keyboard buffer at memory address 0040:001Eh. Standard DOS applications and MS-DOS INT 21h API calls then retrieve the translated characters cleanly without needing to manage international layout intricacies themselves.