Display Standards Codexery

Mode 13h

Standard 256-color VGA mode with linear framebuffer.

Mode 13h

Mode 13h is the standard 256-color mode on MCGA and VGA graphics hardware introduced in 1987 with the IBM PS/2. It has a resolution of 320×200 pixels and provides programmers with a linear block of video memory where each byte represents one pixel, simplifying programming at the cost of access to other VGA hardware features. The mode is notable for its chunky framebuffer, which contrasts with the planar memory arrangement typical of VGA.

Introduced
1987
Hardware
MCGA and VGA
Resolution
320×200 pixels
Colors
256
Video memory used
64,000 bytes
Palette bits
18 bits (6 per RGB channel)
Bios mode number
13h

Lore & Background

Mode 13h uses a 'Chain 4' addressing mode where the lowest two bits of the 16-bit aperture address select the plane to write to or read from. This gives the programmer a simple access model and simultaneous access to all four planes, but limits addressable video memory to 64 KiB (4 × 16 KiB), leaving the upper 48 KiB of each plane unused. When selecting 320×200, the VGA internally performs scan-doubling to provide a 320×400 mode.

The mode uses a 256-color palette with 18 bits of color (6 per RGB channel), modified via low-level I/O port calls to DAC registers 3C8h and 3C9h. The screen buffer resides in segment 0xA000 from offset 0 to 63,999. Bytes after offset 64000 are not mapped to the screen and can be used to store palette data.

An alternative planar 256-color mode, collectively called Mode X, is available by disabling Chain 4 mode. A 320×400 256-color mode with chain-4-style simple addressing can also be achieved by manually writing VGA registers.

Reader's Guide

Mode 13h is significant as a straightforward way to access 256-color graphics on VGA and MCGA hardware, widely used in early PC games and demos. Its linear framebuffer made it easier to program than planar modes, though it sacrificed access to all video memory and other VGA features. The mode's 320×200 resolution, combined with non-square pixels on a 4:3 display, was a compromise for compatibility with MCGA's limited 64 KiB memory. The standard method to enter Mode 13h is via BIOS interrupt int 10h, which is not possible in 32-bit protected mode, requiring direct register writes or a driver. The palette data was often copied to memory after the screen data for saving, and mismatched palettes could cause color artifacts. Variants like Mode X offered square pixels and other enhancements by unchaining the planes, though these were not officially documented by IBM.

Did You Know?

More in Display Standards 1-24

Spotted an error? Know more?

Reader corrections go straight into our review queue. Suggest an edit · How this site is sourced

Comments

Loading…
Open in the interactive codex →