Previous Table of Contents Next


Section 10
VIDEO GRAPHICS INTERFACE

INTRODUCTION

This section explains some basics about the different standard PC video systems. It discusses pixels, palettes, and some video BIOS calls.

PICTURE ELEMENTS

Pixel or Pel are standard references for a picture element. A pixel is the smallest programmable unit of a video display system picture. The number of bits used to define a pixel determines the number of possible colors you can select from when programming the pixel. If one bit is used for a pixel, you can select between two colors. If two bits are used for a pixel, you can select between four colors. If three bits are used for a pixel, you can select between eight colors. If four bits are used for a pixel, you can select between 16 colors, and so on. The coordinates of pixels are described by column and row with position column 0, row 0 being the leftmost column position of the topmost horizontal line. For a system of 640 columns by 200 rows, the last position on the bottom row is column 639, row 199.

VIDEO RAM FORMATS

In some systems, the bits of a specific pixel are all in a single byte. In other systems, the bits of a specific pixel are spread across as many different bytes as there are bits for a pixel. When the pixel bits are spread across many bytes, the video memory is normally divided into what are called memory planes. In some systems, each memory plane may be assigned to a specific color.

COLOR SELECTION AND PALETTES

In some systems, a specific bit pattern for a pixel always displays as a specific color. In other systems, a specific bit pattern for a pixel is used to index a specific palette register. Each palette register may be programmed by software to select between a variety of colors to display. With palette registers, the color of an object on the display can be changed, without redrawing the object image on the screen, by changing the palette registers used by the object image.

In a VGA system, a palette register is called a digital-to-analog converter register (DAC). There are 256 DACs that are 18 bits wide each. The 18 bits are divided into three color groups with six bits of data for each color. This allows for 64 levels of each color. The three primary colors are red, green, and blue.

When a programmer is trying to decide what color to use in the display for a program, it is often convenient to let the user select all character and color attributes to help resolve any inconsistencies among different systems.

MONOCHROME DISPLAY ADAPTER (MDA)

This video system has no high resolution graphics mode. The system displays 80 characters by 25 rows and requires two bytes of video RAM per character. One byte is used to select from 256 possible standard ASCII characters to display. The other byte selects the display attribute of the character.

COLOR GRAPHICS ADAPTER (CGA)

This video system supports character display modes and graphics display modes. The character display modes are 80 characters by 25 rows and 40 characters by 25 rows. The graphics display modes are 640 columns by 200 rows with two colors and 320 columns by 200 rows with four colors. The IBM PCJR has a graphics system that is similar to CGA but is located at a different address and provides more colors in the high resolution mode. Direct addressing of video RAM in older CGA systems can cause a hashing effect or a snow effect.

MULTICOLOR GRAPHICS ARRAY (MCGA)

This video system has the same basic modes of a CGA system but provides 256 colors in a 320 columns by 200 rows mode and two colors in a 640 columns by 480 rows mode. This system also uses color palette registers.

ENHANCED GRAPHICS ADAPTER (EGA)

This video system supports character display modes and graphics display modes. The character display modes are 80 characters by 25 rows, 40 characters by 25 rows, and 80 characters by 43 rows. This system provides between 2 to 16 colors in a 640 columns by 350 rows display. The more RAM on the EGA board, the more colors available to select from.

VIDEO GRAPHICS ARRAY (VGA)

This video system supports character display modes and graphics display modes. The character display modes are 80 characters by 25 rows, 40 characters by 25 rows, 80 characters by 43 rows, and 80 characters by 50 rows. The graphics modes provided include 320 columns by 200 rows with 256 colors and a 640 columns by 480 rows with two colors using color palette registers.

PROFESSIONAL GRAPHICS ADAPTER (PGA)

This video system provides a graphics mode of 640 columns by 480 rows with 256 colors out of a set of 12 bit palette registers. This system also provides some high level graphics functions.

OTHER GRAPHICS SYSTEMS

There is a variety of unique graphics for PCs. A very popular and standard system is the Hercules graphics adapter. This system provides 720 columns by 348 rows in a monochrome mode. Unique and enhanced graphics systems have been made available by many companies that release PC clones.

The INT 10H VIDEO FUNCTIONS

The system software interrupt 10H is used for video BIOS functions. This section discusses the `get CRT mode, set CRT mode, write pixel, and read pixel.

To set the CRT display mode, have AH set to 0 and AL set with CRT display mode code, then execute an interrupt 10H.

The following table has the code values in hex for the standard CRT graphics modes and the associated graphics resolution. These codes are used for get and set display mode functions.

04H 320 by 200, 4 color
05H 320 by 200, 4 color monochrome
06H 640 by 200, 2 color
0DH 320 by 200, 16 color
0EH 640 by 200, 16 color
0FH 640 by 350, 4 color
10H 640 by 350, 16 color
11H 640 by 480, 2 color
12H 640 by 480, 16 color
13H 320 by 200, 256 color


Previous Table of Contents Next