# Hardware code page

In computing, a hardware code page (HWCP) refers to a code page supported natively by a hardware device such as a display adapter or printer. The glyphs to present the characters are stored in the alphanumeric character generator's resident read-only memory (like ROM or flash) and are thus not user-changeable. They are available for use by the system without having to load any font definitions into the device first. Startup messages issued by a PC's System BIOS or displayed by an operating system before initializing its own code page switching logic and font management and before switching to graphics mode are displayed in a computer's default hardware code page.

## Code page assignments

In North American IBM-compatible PCs, the hardware code page of the display adapter is typically code page 437. However, various portable machines as well as (Eastern) European, Arabic, Middle Eastern and Asian PCs used a number of other code pages as their hardware code page, including code page 100 ("Hebrew"), 151 ("Nafitha Arabic"), 667 ("Mazovia"), 737 ("Greek"), 850 ("Multilingual"), encodings like "Roman-8", "Kamenický", "KOI-8", "MIK", and others. Most display adapters support a single 8-bit hardware code page only. The bitmaps were often stored in an EPROM in a DIP socket. At most, the hardware code page to be activated was user-selectable via jumpers, configuration EEPROMs or CMOS setup. However, some of the display adapters designed for Eastern European, Arabic and Hebrew PCs supported multiple software-switchable hardware code pages, also named font pages, selectable via I/O ports or additional BIOS functions.
In contrast to this, printers frequently support several user-switchable character sets, often including various variants of the 7-bit ISO/IEC 646 character sets such as code page 367 ("ISO/IEC 646-US / ASCII"), sometimes also a couple of 8-bit code pages like code page 437, 850, 851, 852, 853, 855, 857, 860, 861, 863, 865, and 866. Printers for the Eastern European or Middle Eastern markets sometimes support other locale-specific hardware code pages to choose from. They can be selected via DIP switches or configuration menus on the printer, or via specific escape sequences.

## Support in operating systems

When operating systems initialize their code page switching logic, they need to know but have no means to determine the previously active hardware code page by themselves. Therefore, for code page switching to work correctly, the hardware code page needs to be specified.
Under DOS and Windows 9x this is accomplished by specifying the hardware code page as a parameter (hwcp) to the device drivers DISPLAY.SYS and PRINTER.SYS in CONFIG.SYS:
    DEVICE=…\DISPLAY.SYS CON=(type,hwcp,n|(n,m))
    DEVICE=…\PRINTER.SYS PRN=(type,hwcp,n)
If multiple hardware code pages are supported in OEM issues, the first hardware code page (hwcp1) in the list specifies the default hardware code page:
    DEVICE=…\DISPLAY.SYS CON=(type,(hwcp1,hwcp2,…),n|(n,m))
    DEVICE=…\PRINTER.SYS PRN=(type,(hwcp1,hwcp2,…),n)
If no hardware code page(s) are specified, these drivers default either to a dummy code page number 999 or assume the hardware code page to be equal to the primary code page (the first code page listed in COUNTRY.SYS files for a particular country with the country code either specified in the CONFIG.SYS COUNTRY directive or assumed to be the operating system's internal default, usually 1 (US) in Western issues of DOS). In many English-speaking countries, the primary code page is either 437 (f.e. in the US) or 850 (f.e. in the UK, Ireland and Canada), so that, without specifying a different code page, the system would often assume one of these to be the corresponding device's default hardware code page as well.
If a hardware code page does not match one of those with official code page assignments, an arbitrary number from the range 57344–61439 (E000h–EFFFh) for user-definable code pages or 65280–65533 (FF00h–FFFDh) for private use code pages could be specified per IBM CDRA to give the operating system a non-conflictive "handle" to select that code page.
Arabic and Hebrew MS-DOS do not use DISPLAY.SYS and PRINTER.SYS, but provide similar facilities using ARABIC.COM, HEBREW.COM, and SK_HGC.COM.

## OEM code pages

Hardware code pages are also OEM code pages. The designation "OEM", for "original equipment manufacturer", indicates that the character set could be changed by the manufacturer to meet different markets.
However, OEM code pages do not necessarily reside in ROM, but include so called prepared code pages, (aka downloadable character sets or downloadable fonts), character sets loaded as raster fonts into the font RAM of suitable display adapters (like Sirius 1/Victor 9000, NEC APC, HP 100LX/200LX/700LX, Persyst's BoB Color Adapter, Hercules' HGC+, InColor and Network Plus with RAMFONT, and IBM's MCGA, EGA, VGA, etc.) and printers as well. Hence, the group of OEM code pages is a superset of hardware code pages.