Phil Storrs PC Hardware book

The PC Video Systems

The original IBM PC computer required a Video Interface Card to be plugged into one of the BUS SLOTS on the computers System Board and a Video Display Monitor plugged into a Video Output connector, on the back of that Interface Card. The original IBM had two optional Video Interface (Adaptor) Cards:

Most modern DOS computers continue the tradition of requiring a Video Interface Card to be plugged into a Bus Slot on the System Board but some do have the Video Interface circuitry built into the System Board. This is not good practice as it means the Video System can't be upgraded to a more advanced standard if required. Over the years, since the introduction of the PC computer in 1981, other Video Interface standards have been introduced to increase the Resolution and the Number of colours that could be displayed on the screen.

Definition - The resolution of a Video System is measured by counting the number of Pixels (picture elements or dots) in an X direction (across the screen) and in a Y direction (down the screen) and expressing these figures as X by Y.

The next Video Standard was EGA and this was followed by VGA. VGA has evolved through many variations of Super VGA to a point now where a confusing array of combinations of Resolution and number of colours exists.

What is on the Video Interface Card ?

The video card contains three main functional blocks.
  1. The Video RAM
  2. The VGA Chip or Chipset (this used to be referred to as the CRTC)
  3. The Character ROM.

The Video RAM

The Video Interface has a Video RAM on the Interface Card and this is addressed in the Conventional Memory region in the area A0000 to BFFFF hex, a total allocation of 128 K. The lower resolution and lower number of colour Video Modes use only a small portion of this area and the simple Video Interfaces like the MDA use only 4 K bytes and the CGA uses 16 K bytes. Modern Super VGA Video Modes require at least one Meg byte of Video RAM and this is switched in and out of the 128K space allocated to the Video RAM, as required. Higher resolution and more colours each require more Video RAM. The highest video resolutions and numbers of colours available today may require as much as six Meg of Video RAM.

The Video RAM holds the data that is used to generate the display on the Video Display Screen. The Video Interface circuit scans the Video RAM regularly and generates the image on the screen. This scanning process must go on and on as the Phosphor on the Video Display Screen only has a short persistence, and the image will fade away.

The actual data stored in the Video RAM depends on the Video Mode in use. A video image can be generated on the screen in two ways.

The Video RAM is located on the Video Interface Card. The DATA for the Video RAM is provided by the Operating System and/or the Application Software and is written into the Video RAM either by using Interrupt Services provided by the operating system (INT 10 for example), or directly by the application. It is bad practice for applications to bypass the service routines and to write directly to the Video RAM, but it is often done to make operation of the Video System faster.

What is stored in the Video RAM In Character Mode
In this mode, each character position on the screen requires two bytes of data in the Video RAM. One byte for the ASCII code for the character, and one byte for the Attribute data that determines the characters colour. The dot structure for each character, in the Character Set, is stored in a CHARACTER ROM. The ASCII Data in the Video RAM is used to Address the Character ROM to provide the dot structure data for each character.

Cathode Ray Tube Controller or CRTC

In the older Video Interface Standards, This process is controlled by a chip called the Cathode Ray Tube Controller or CRTC. The CRTC controls the functions of the Video Interface, accessing the Video RAM, and the Character ROM, and generating the Horizontal and Vertical Scan Synchronising pulses. In modern Video Interfaces the VGA Chip takes the place of the CRTC.

The CGA Video Adaptor Card

The simplest Video System used with DOS type computers is the Colour Graphics Adaptor, the CGA Video Card, and it provides two alternative Character Modes.

The lower resolution mode was provided so the CGA card could be used with an American domestic colour Television set. The first CGA cards had an NTSC video output connector for this purpose. No attempt was made to provide a PAL video output suitable for Australian TV sets as the Horizontal and Vertical Scan Frequencies of the American system are quite different to those required by our television system.

The CGA characters are made up from an eight by eight matrix. The Character ROM has eight bytes of dot structure data for each character in the character set. Each byte consists of eight bits and each bit in turn determines if a dot is turned on or turned off.

In Graphics Mode the raw Dot Structure Data (the bit map) for every part of the Video Display Screen must be stored in the Video RAM. No Character ROM is used in this mode, every bit of pixel data must be written into the Video RAM. Graphics Modes require far more Video RAM than do Character Modes.

The CGA Video Interface provides a maximum graphics resolution of 640 dots by 200 dots. At maximum resolution in Character Mode there are 80 characters across the screen, and 25 rows of characters down the screen. As each character is made form an 8 by 8 matrix, this is equivalent to a resolution of 640 by 200.

The Video Monitor

A basic Monochrome monitor (used with an MDA Video Card) consists of the following blocks.

This monitor has two Video Input Signals and two Synchronisation Signal inputs, supplied via a DB9S connector with these connections.

The Saw Tooth Drive Wave forms produced by the deflection circuits deflect the electron beams across and down the screen providing a scan Raster. The CRT has a Deflection Yoke assembly around it's neck and this provides magnetic deflection of the electron beam.

The electron beam is switched ON and OFF to provide dots of light ( Pixel's ) on the screen. The Horizontal Scan Rate is a high frequency ( 15,750 Hz to about 68 KHz ) and the Vertical Scan Rate is a low frequency ( 50 Hz to 90 Hz ). The scan rates for each type of Video Standard are different and the scan rates that a particular monitor can operate over is limited.

Most Video Display Monitors can only be used with one type of Video Interface. The most popular Video Standard available at present is Super VGA, but many variations for Super VGA are available. Only the most expensive Super VGA monitors can operate over the full range of scan frequencies used by the various resolutions of VGA.

How is colour produced ? A colour display tube has three electron guns. These Electron Guns illuminate Red, Green and Blue phosphors on the face of the Cathode Ray Tube. A colour Video Display Monitor will have at least three Video Input signals and three Video Amplifier Circuits. The video signals control the electron beams,turning then on and off and controlling the brightness of the individual colour phosphors. If all three colours are at maximum brightness the resulting colour is white. Each dot of light on the screen is made up of three different colour dots.

An RGB Colour Monitor, used with a CGA Video Interface, will be similar to the Mono Monitor described above but will have three Video Amplifiers, one each for the Red Green and Blue electron guns. This monitor also uses a DB9S connector and the pin-out is as follows.

The CGA Video System uses four Video Signals, Red, Green, Blue and Intensity and the maximum number of colours it can produce is 16, four binary inputs will produce 24 combinations.

The Scan Frequencies for the CGA Video Standard

Although the CGA Video System is now quite obsolete, we will use it in explaining the basics of the Video System and how the Horizontal and Vertical Scan Frequencies are arrived at. First we should look at the differences between the domestic Television systems in the USA and Australia, this is a clue to why we have not been able to use our Television sets as Computer Monitors for PC Computers.

The CGA Frequencies and the timing of the Signals

The domestic Television system obtains double the line resolution by using a technique called interlacing. It takes two vertical scans to build up one image, the second scan draws lines between the scan lines produced by the first scan.

The characters take shape

Character Modes
In CGA Character Modes the characters are constructed from an 8 by 8 matrix. The raw data for each character is stored in the Character ROM, located on the Video Interface. This ROM is addressed by the ASCII data in the Video RAM and is not available on the computers bus, within the addressable memory space. The Video RAM holds an ASCII Code and an Attribute Byte for each character position on the screen. In 80 by 25 mode, the Video RAM requires 4000 locations, 2000 bytes for the ACSII Codes and 2000 bytes for the Attribute Bytes associated with each character. The ASCII Bytes and Attribute Bytes are stored in alternate locations in the Video RAM.

The eight bits of the Attribute Byte are organised in a way that they control both the Foreground and Background colours. The least significant four bits are used for the Foreground Colours, giving a maximum of 16 Foreground Colours. The next three bits are used for the Background Colours, giving a maximum of Eight Background Colours. The most significant bit (bit 7) causes the character to blink.

A Zero bit in an attribute byte position means the attribute that bit controls is off and a One means it is on. The Attribute value for a White character is 07 hex, this converts to 00000111 2. This means the Red Green and Blue Electron Guns are on, and combining Red, Green and Blue gives White. An attribute of 8F hex will produce a Blinking bright white character. ( 8F hex = 10001111 2 )

Remember, CGA uses four Video Signals, one each for Red, Green and Blue and and Intensity. This means CGA can produce a maximum of 16 colours. Due to limitations imposed by the size of the available Video RAM, 16 colours is only available in Character Modes, not in Graphics Modes.

The Attribute Byte
BIT USED FOR
0 Foreground - BLUE
1 Foreground - GREEN
2 Foreground - RED
3 Foreground - INTENSITY
4 Background - BLUE
5 Background - GREEN
6 Background - RED
7 BLINKING
Foreground colours
0000 Black 1000 Grey
0001 Blue 1001 Light Blue
0010 Green 1010 Light Green
0011 Cyan 1011 Light Cyan
0100 Red 1100 Light Red
0101 Magenta 1101 Light Magenta
0110 Brown 1110 Yellow
0111 White 1111 "Bright" White
Background colours
000 Black 100 Red
001 Blue 101 Magenta
010 Green 110 Brown
011 Cyan 111 Grey

How about EGA and VGA in Character Mode.
When an EGA or VGA card is working in Character modes it is working in a similar way to the old CGA Video Interface, the only real difference is the number of dots used to make up each character and this depends on the Video System in use. The matrix size can be 8 by 14, 8 by 16, 9 by 14 or 8 by 16. When a DOS computer is booted it usually starts off in Video Mode Two (40 column by 25 rows of text) and then goes to Mode Three (80 column by 25 rows of text) by the time the DOS prompt is displayed.

Character Modes are quite efficient in that each character position on the screen only requires two bytes of data in the Video RAM to represent a character on the screen. They are also inflexible because they are limited to only displaying the characters available in the Character Set built into the Character ROM on the Video Interface.

Graphics Modes
In Graphics Modes, the Video RAM holds the Dot Structure Data for the display, and the number of bits required to represent each pixel depends on the maximum number of colours provided by the Video Mode in use. Two colours only require one bit per pixel, sixteen colours require four bits per pixel but 16.7 million would require 24 bits per pixel (three bytes per pixel).

The CGA Video System had only 16 Kbytes of Video RAM and so at it's highest resolution, 640 by 200, the CGA Video System could only display graphics in two colours, one bit per pixel. A 640 by 200 resolution display requires 128,000 pixels. Divide 128,000 by eight to get back to bytes and we see we need 16K Bytes of Video RAM. At a resolution of 320 by 200, CGA provided four colours.

In it's simplest form VGA has two Graphics Modes, 640 by 480 pixels in 16 colours and 320 by 200 pixels by 256 colours. The official VESA standard for Super VGA were set many years ago when most VGA Video Interfaces had only 256 K or 512 Kbytes of Video RAM, and is 800 by 600 pixels in 16 colours. Today Super VGA Video Systems are run in at least 256 colours, and more often in 64,000 or 16.7 million colour modes.

These figures are arrived at by multiplying the total number of pixels by the number of bytes required to produce that number of colours. 640 times 480 equals 326,400 pixels times 0.5 (4 bits needed for 16 colours and 4 bits is half a byte) equals 153,600 bytes of Video RAM required.

Amount of Video RAM required for some resolution and colour combinations.
Resolution and colours Bits
required
Amount of video RAM
640 by 480 by 16 colours 4 154 K (256 K)
640 by 480 by 256 colours 8 308 K (512 K)
640 by 480 by 65,536 colours 16 615 K (1 Meg)
640 by 480 by 16.7 Million 24 922 K (1 Meg)
800 by 600 by 16 colours 4 240 K (256 K)
800 by 600 by 256 colours 8 480 K (512 K)

Interlaced Scanning

Interlacing can be used with VGA Video Systems to provide higher resolution with a cheaper monitor. The higher resolution would normally require a higher Horizontal Scan Frequency but monitors with higher Horizontal Scan Frequencies cost more. Interlacing is a technique used with domestic Television systems to increase the apparent resolution by generating the display with two consecutive scans. The second scan produces lines between the first scan. The only problem is some people can see the flicker generated by interlacing and this can be quite fatiguing for some people.

Where in the Memory Map is the Video RAM ?

When DOS was first designed, 128 Kbytes of memory space was allowed to the Video RAM and this was allocated just above the 640 Kbytes of User RAM, from A0000 hex to BFFFF hex. The two original Video Interface Standards (MDA ad CGA) were assigned space in this are so as not to clash with one another, so they could coexist in the same computer. The Hercules Corporation improved the MDA Video Standard to include graphics capability, and the Hercules Video Standard then took over from IBM's original MDA standard. The Hercules Video Card (HGC) is often referred to as the MGA (Mono Graphics Card) or HGC (Hercules Graphics Card).

When more than 128 Kbytes of Video RAM is required by the Video System, the RAM must be switched in and out of the 128 Kbyte of memory addresses allocated to the Video RAM.

The Keyboard and the Video System

As you have already learned, the Keyboard Service Routine takes the keystroke date from the Keyboard Interface, processes it, and puts two byte codes that represent the keystrokes into the Keyboard Buffer Area of RAM memory.

Up to this point the characters have not been displayed on the screen. There is no direct link between the Keyboard Service Routine and the Video System.

The Operating System or Application, then reads the two byte codes from the Keyboard Buffer Area in memory, and processes them. The Operating System or Application then sends data to the Video System, usually via the Video Service Routine, to display the character if required.

There is no need to display the characters as they are typed but it does provide the user with important feedback. The Operating System or Application can, and often does, write directly to the Video RAM but this is not good practice.

Summary

In text mode, the Video Service Routine generates an ASCII Code and an Attribute byte for each character to be displayed, and writes them to the Video RAM. The CRTC chip (the VGA chip in modern Video Systems) then scans the Video RAM and generates the Video Display on the display screen .

In graphics mode the process is much more complicated, the Video Service Routine must generate a pixel image of the character, including its colour information, and write this to the Video RAM.

PC Video Monitors PC Video standards Back to the opening index Book three index