How MS-DOS 6.22 Manages Code Page Switching

MS-DOS 6.22 manages international keyboard support and character rendering through a subsystem called National Language Support (NLS). By coordinating configuration directives in CONFIG.SYS, memory-resident drivers loaded in AUTOEXEC.BAT, and dedicated utilities like MODE, KEYB, and CHCP, the operating system dynamically remaps keyboard inputs and screen display fonts between standard US-ASCII and regional character sets known as code pages.

The Foundation: CONFIG.SYS Configuration

Code page switching relies on low-level device drivers initialized during startup:

  1. COUNTRY.SYS: Loaded using the COUNTRY directive, this file defines regional conventions such as date, time, currency formats, and collating sequences (character sorting rules). It also establishes the system's default and alternate code page IDs (for example, Code Page 437 for standard US English, or Code Page 850 for Multilingual Latin I).
  2. DISPLAY.SYS: Installed via DEVICE=C:\DOS\DISPLAY.SYS, this driver enables EGA and VGA video adapters to load hardware-independent screen fonts from font collection files (.CPI or Code Page Information files). It specifies the video buffer capacity for holding alternate character sets simultaneously.

Initializing National Language Support: AUTOEXEC.BAT

Once system drivers are loaded, MS-DOS activates the runtime switching environment using specific command-line utilities:

  1. NLSFUNC: The National Language Support Function (NLSFUNC.EXE) is a terminate-and-stay-resident (TSR) program. It provides the background API hooks that allow MS-DOS to switch code pages globally across all supported devices.
  2. MODE PREPARE: The MODE command reads the designated .CPI files and preloads character glyphs into the display buffers prepared by DISPLAY.SYS. A typical syntax is MODE CON CP PREP=((850 437) C:\DOS\EGA.CPI).
  3. KEYB: The KEYB.COM driver replaces the default BIOS keyboard handler (INT 9h). It references KEYBOARD.SYS to map physical key scan codes to the corresponding ASCII characters of a specific national layout, while associating that layout with a primary and secondary code page.

Runtime Switching and Synchronization

After initialization, users and batch files can switch character sets on the fly without rebooting:

  • Global Switching with CHCP: The CHCP (Change Code Page) command simultaneously updates the active character set for the console display, the printer, and the keyboard driver. Entering CHCP 850, for instance, instructs NLSFUNC to signal DISPLAY.SYS to display Latin I characters and updates KEYB to produce those matching characters from keystrokes.
  • Interactive Keyboard Toggling: When KEYB is active, users can press Ctrl+Alt+F1 to toggle instantly back to the standard US keyboard layout and character set, or Ctrl+Alt+F2 to return to the configured international layout.

Through this multi-tiered architecture, MS-DOS 6.22 decouples hardware input and display rendering from hardcoded ROM routines, allowing dynamic localization across a wide range of hardware platforms.