CHCP Command Role in MS-DOS 6.22

This article provides an overview of the CHCP (Change Code Page) command in MS-DOS 6.22, detailing its primary function within system environment setups. It examines how the command enables dynamic switching between character encoding tables to support international languages and outlines the essential configuration files and device drivers required for it to function correctly.

The Primary Role of CHCP

The primary role of the CHCP command in MS-DOS 6.22 is to view or change the active system code page for devices that support code-page switching. A code page is an internal character set table that maps keyboard inputs, screen displays, and printer outputs to specific characters. By default, MS-DOS uses hardware code page 437 (United States). The CHCP command allows users and applications to dynamically switch to alternate code pages—such as code page 850 (Multilingual Latin I)—enabling localized characters, accents, and currency symbols to display and print accurately without rebooting the computer.

Command Usage and Syntax

The CHCP command operates with straightforward syntax:

  • Display Current Code Page: Entering CHCP without parameters displays the currently active code page number alongside the original hardware code page.
  • Change Active Code Page: Entering CHCP <nnn> (where <nnn> represents a three-digit code page identifier, such as CHCP 850) sets the active system code page across all configured devices simultaneously.

Required Environment Prerequisites

In MS-DOS 6.22, CHCP cannot change code pages on a bare setup; it requires underlying National Language Support (NLS) components to be configured during startup.

  1. CONFIG.SYS Configuration: The console display driver must be loaded with reserved code page buffers. This is typically done using: DEVICE=C:\DOS\DISPLAY.SYS CON=(EGA,437,2) This line specifies the display hardware, the default hardware code page, and the number of alternate prepared code pages allowed.

  2. AUTOEXEC.BAT Setup: The system must load the NLS coordinator and prepare the code page tables using MODE:

    • NLSFUNC must be executed to provide resident code-page switching capabilities.
    • MODE CON CP PREP=((850) C:\DOS\EGA.CPI) extracts the font glyphs from the Code Page Information (.CPI) file into memory.

Once these prerequisites are met, CHCP serves as the centralized interface to switch the display, keyboard mapping, and printer configurations to the target locale simultaneously, rather than requiring separate MODE commands for each individual peripheral.