Introduction to this tutorial.
VGA Basics
Setting the video mode, plotting a pixel, and mode 0x13 memory.
Primitive Shapes & Lines
Drawing lines, polygons, rectangles, and circles. Also, Bresenham's algorithm, fixed-point math and pre-computing tables.
Bitmaps & Palette Manipulation
The BMP file format, drawing bitmaps, and palette manipulation.
Mouse Support & Animation
Animation, mouse motion, and mouse button detection.
Double Buffering, Page Flipping, & Unchained Mode
Double buffering, page flipping, structure of unchained mode, and 256-color modes other than 320x200.
Links and Other Resources
Find out about other sites and where to get compilers.
Download source code, executables, or the entire tutorial.
FAQ and Troubleshooting
Read answers to Frequently Asked Questions and troubleshoot common VGA programming problems.

Quick Start

  1. Download the DOS emulator, DOSBox.
  2. Download the DOS C/C++ compiler, DJGPP 2.0.
  3. Start the tutorial. For help, see the Troubleshooting page.

About this tutorial

David Brackeen wrote this tutorial for a Technical Writing course in 1996. Although the subject of VGA programming is out of date, this tutorial is still useful for teaching computer graphics, programming old-school DOS games, and developing hobbyist operating systems.

Disclaimer from the author: this material is more than ten years old and is not my best work. Some of the text could be worded differently for clarity and accuracy. Also, the code samples are not high quality, and the diagrams are often muddy or confusing.

Good luck, and have fun!