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:
- COUNTRY.SYS: Loaded using the
COUNTRYdirective, 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). - 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 (.CPIor 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:
- 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. - MODE PREPARE: The
MODEcommand reads the designated.CPIfiles and preloads character glyphs into the display buffers prepared byDISPLAY.SYS. A typical syntax isMODE CON CP PREP=((850 437) C:\DOS\EGA.CPI). - KEYB: The
KEYB.COMdriver replaces the default BIOS keyboard handler (INT 9h). It referencesKEYBOARD.SYSto 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. EnteringCHCP 850, for instance, instructsNLSFUNCto signalDISPLAY.SYSto display Latin I characters and updatesKEYBto produce those matching characters from keystrokes. - Interactive Keyboard Toggling: When
KEYBis active, users can pressCtrl+Alt+F1to toggle instantly back to the standard US keyboard layout and character set, orCtrl+Alt+F2to 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.