# VGA/SVGA Video Programming--Standard VGA Chipset Reference
Pure VGA/SVGA hardware programming (registers, identification, and otherlow-level stuff.)
Author: Joshua Neal
Keywords: VGA SVGA hardware video programming

Home Intro General Registers Index Back

Hardware Level VGA and SVGA Video Programming Information Page
VGA Chipset Reference

- Introduction -- introduction to the VGA reference
- General Programming Information -- details of the functional operation of the VGA hardware.
- Input/Output Register Information -- details on the VGA registers themselves
- Indices -- convenient listings of fields and their locations alphabetically and by function

Introduction
This section is intended to be a reference to the common functionality of the original IBM VGA and compatible adapters. If you are writing directly to hardware then this is the lowest common denominator of nearly all video cards in use today. Nearly all programs requiring the performance of low-level hardware access resort to this baseline capacity, so this information is still valuable to programmers. In addition most of the VGA functions apply to SVGA cards when operating in SVGA modes, so it is best to know how to use them even when programming more advanced hardware.
Most VGA references I have seen document the VGA by describing its operation in the various BIOS modes. However, because BIOS was designed for use in MS-DOS real mode applications, its functionality is limited in other environments. This document is structured in a way that explains the VGA hardware and its operation independent of the VGA BIOS modes, which will allow for better understanding of the capabilities of the VGA hardware.
This reference has grown out of my own notes and experimentation while learning to program the VGA hardware. During this process I have identified errors in various references that I have used and have attempted to document the VGA hardware's actual behavior as best as possible. If in your experience you find any of this information to be inaccurate, or even if you find this information to be misleading or inaccurate, please let me know!
One of the reasons I started this reference was that I was using existing references and found myself wishing for a hypertext reference as almost every register is affected by the operation of another, and was constantly flipping pages. Here I simply use links for the register references, such as Offset Register, rather than stating something like: Offset Register (CRTC: Offset = 13h, bits 7-0). While the second method is more informative, using them for every reference to the register makes the text somewhat bogged down. HTML allows simply clicking on the register name and all of the details are provided. Another is that no single reference had all of the information I was looking for, and that I had penciled many corrections and clarifications into the references themselves. This makes it difficult to switch to a newer version of a book when another edition comes out -- I still use my heavily annotated second edition of Ferarro's book, rather than the more up-to-date third edition.

General Programming Information
This section is intended to provide functional information on various aspects of the VGA. If you are looking simply for VGA register descriptions look in the next section. The VGA hardware is complex and can be confusing to program. Rather than attempt to document the VGA better than existing references by using more words to describe the registers, this section breaks down the functionality of the VGA into specific categories of similar functions or by detailing procedures for performing certain operations.

- Accessing the VGA Display Memory -- details on the memory interface between the CPU and VGA frame buffer.
- Sequencer Operation -- details on how the VGA hardware rasterizes the display buffer

- Text-mode

- VGA Text Mode Operation -- details concerning text mode operation, including attributes and fonts.
- Manipulating the Text-mode Cursor -- details controlling the appearance and location of the cursor.

- Special Effects Hardware -- details on hardware support for windowing, paging, smooth scrolling and panning, and split-screen operation.

- Attribute Controller Operation -- details on the conversion of sequenced display data into DAC input. (WIP)
- DAC Operation -- details controlling the conversion of palette data into analog signals.
- Display Generation -- details on formatting of the produced video signal for output to the display.

Input/Output Register Information
This section is intended to provide a detailed reference of the VGA's internal registers. It attempts to combine information from a variety of sources, including the references listed in the reference section of the home page; however, rather than attempting to condense this information into one reference, leaving out significant detail, I have attempted to expand upon the information available and provide an accurate, detailed reference that should be useful to any programmer of the VGA and SVGA. Only those registers that are present and functional on the VGA are given, so if you are seeking information specific to the CGA, EGA, MCGA, or MGA adapters try the Other References section on the home page.
In some cases I have changed the name of the register, not to protect the innocent but simply to make it clearer to understand. One clarification is the use of "Enable" and "Disable". A the function of a field with the name ending with "Enable" is enabled when it is 1, and likewise a field with a name ending in Disable is disabled when it is 1. Another case is when two fields have similar or identical names, I have added more description to the name to differentiate them.
It can be difficult to understand how to manipulate the VGA registers as many registers have been packed into a small number of I/O ports and accessing them can be non-intuituve, especially the Attribute Controller Registers, so I have provided a tutorial for doing this.

- Accessing the VGA Registers -- methods of manipulating the VGA registers

In order to facilitate understanding of the registers, one should view them as groups of similar registers, based upon how they are accessed, as the VGA uses indexed registers to access most parameters. This also roughly places them in groups of similar functionality; however, in many cases the fields do not fit neatly into their category. In certain cases I have utilized quotes from the IBM VGA Programmer's Reference, this information is given in "italic." This is meant to be a temporary placeholder until a better description can be written, it may not be applicable to a standard VGA implementation. Presented to roughly based upon their place in the graphics pipeline between the CPU and the video outputs are the:

- Graphics Registers -- control the way the CPU accesses video RAM.
- Sequencer Registers -- control how video data is sent to the DAC.
- Attribute Controller Registers -- selects the 16 color and 64 color palettes used for EGA/CGA compatibility.
- CRT Controller Registers -- control how the video is output to the display.
- Color Registers -- selects the 256 color palette from the maximum possible colors.
- External Registers -- miscellaneous registers used to control video operation.

Indices
In order to locate a particular register quickly, the following indexes are provided. The first is a listing of all of the register fields of the VGA hardware. This is especially useful for fields that are split among multiple registers, or for finding the location of a field that are packed in with other fields in one register. The second is indexed by function groups each pertaining to a particular part of the VGA hardware. This makes understanding and programming the VGA hardware easier by listing the fields by subsystem, as the VGA's fields are grouped in a somewhat haphazard fashion. The third is intended for matching a read or write to a particular I/O port address to the section where it is described.

- VGA Field Index -- An alphabetical listing of all fields and links to their location.
- VGA Functional Index -- A listing of all fields and links to their location grouped by function.
- VGA I/O Port Index -- A listing of VGA I/O ports in numerical order.

Notice: All trademarks used or referred to on this page are the property of their respective owners.
All pages are Copyright © 1997, 1998, J. D. Neal, except where noted. Permission for utilization and distribution is subject to the terms of the FreeVGA Project Copyright License.