VDU Basics
VDU Basics
Components of VDU
Monitors (Display Screens)
Refresh Rate
Resolution
Multisync Monitor
FST Monitor
Interlaced and Non-Interlaced Monitors
Energy Saving Monitors
Active Matrix LCD Display
Graphics Circuitry
Graphics Card Standards
Modern Graphics Cards
Graphics Processor
Video Memory
Digital to Analog Converter (DAC)
Display Connector
Computer (Bus) Connector
Graphics BIOS
Video Display Modes
Text or Graphics
Colors in Text Mode
Colors in Graphics Mode
Colors in VGA
Colors in SVGA
Video Pages
The DOS Perspective
Writing to Video Memory in Text Mode
Exercise
495
240 Let Us C
Components of VDU
The video system consists of two basic components:
(a) A monitor on which we actually see the images either in text
or in graphics.
(b) Video or graphics circuitry usually fitted on a card but
sometimes found on the motherboard itself.
Refresh Rate
How are the images, either text or graphics, produced on the
screen? The microprocessor does not have the ability to send
Chapter 15: VDU Basics 241
signals necessary to produce the images on the screen. This task is
performed by graphics card circuitry.
Resolution
Text or graphics on the screen are built up from tiny dots called
picture elements or ‘pixels’. The display resolution is defined by
the number of rows (called scan lines) from top to bottom, and
number of pixels from left to right on each scan line. In general,
higher the resolution, more pleasing is the display. Higher
resolution means a sharper, clearer picture, with less pronounced
‘staircase’ effect on lines drawn diagonally and better looking text
characters. On the other hand, higher resolution also means more
memory requirement for the display.
Multisync Monitor
Some monitors have a fixed refresh rate, whereas, others may
support a range of frequencies. This multiple frequency support
provides built-in compatibility with future video standards. A
monitor that supports many video standards is called a multiple-
frequency monitor. Different vendors call multiple-frequency
monitor by different names, including multisync, multifrequency,
multiscan and asynchronous monitors.
FST Monitor
The traditional screen is curved, meaning that it bulges outwards
from the middle of the screen. This design is consistent with the
vast majority of cathode ray tube designs, including your
television set. FST stands for flat square tube. The flat screen
results in reduced glare and a higher quality, more accurate image.
The disadvantage is that the technology required to produce flat-
screen displays is more expensive, resulting in higher prices for
the monitors.
Graphics Circuitry
Apart from the monitor another major component of the VDU is
the graphics circuitry. It is responsible for converting the digital
information that the computer produces into something human
244 Let Us C
beings can see. Most desktops use analog display monitors, hence
the graphics card convert digital information to analog information
for display on the monitor. On laptops the data remains digital
because the laptop displays are digital. The graphics circuitry is
either placed on a card that is plugged into an expansion slot.
Alternately, it can also be built right inside the mother board. The
graphics cards have evolved over the years. It might be interesting
to follow this evolution.
Over the years, VGA gave way to Super Video Graphics Array
(SVGA). SVGA cards were based on VGA, but each card
manufacturer added resolutions and increased color depth in
different ways. Thus SVGA refers to a group of video cards, all
with roughly the same capabilities. It does not refer to a specific
card, like the VGA technically does.
Graphics Processor
Early graphics cards merely used to have video memory and
circuitry to convert digital data to analog display. The job of
writing digital data into video memory used to be done by the
main processor. As a result, the main processor used to spent lot of
time in performing complex graphics operations. These cards are
hardly used any more.
Video Memory
The memory that holds the video image is called video memory. It
is also referred to as the frame buffer. Anything drawn on the
screen is made up of individual dots. These dots are called pixels
and each pixel has a color. The memory is used to hold the color of
each pixel. Today’s graphics cards typically have 4 MB or 8 MB of
video memory. The amount of video memory installed on the
graphics card has a direct bearing on the number of colors and the
resolution that it can support.
Display Connector
Graphics cards use standard connectors. Most cards use the 15-pin
female connector. The monitor cable is plugged into this
connector.
Graphics BIOS
Graphics cards have a small ROM chip containing basic
information that tells the other components of the card how to
function in relation to each other. The BIOS also performs
diagnostic tests on the card’s memory and input/output (I/O) to
ensure that everything is functioning correctly.
Figure 15.1
Text or Graphics
250 Let Us C
All modes are fundamentally of two types, text or graphics. Some
modes display only text, some support more colors, whereas some
are made only for graphics. As seen earlier, the graphics card
continuously dumps the contents of the video memory on the
screen. The amount of memory required for representing a
character on screen in text mode and a pixel in graphics mode
varies from mode to mode. Figure 15.1 shows the amount of
memory required do display a fundamental element in each mode.
As seen from Figure 15.1, text mode needs two bytes in video
memory to represent one character on screen. Of these two bytes
the first byte contains the ASCII value of the character being
displayed, whereas the second byte is the attribute byte. The
attribute byte controls the color in which the character is being
displayed.
How does the character actually get displayed on the screen? The
ASCII value present in video memory must be translated into a
character and drawn on the screen. A character generator program
does this drawing. On older display adapters like MA and CGA,
the character generator used to be located in ROM (Read Only
Memory). VGA and SVGA do not have a character generator
ROM. Instead, character generator data is loaded into display
RAM. This feature makes it easy for custom character sets to be
loaded. Multiple character sets may reside in RAM
simultaneously. A set of BIOS services is available for easy
loading of character sets. Each character set can contain 256
characters. Either one or two character sets may be active giving
these adapters the capability to display up to 512 different
Chapter 15: VDU Basics 251
characters on the screen simultaneously. When two character sets
are active, a bit in each character attribute byte selects which
character set will be used for that character. Using a ROM-BIOS
service we can select the active character set. Each character in the
standard character set in VGA is 9 pixels wide and 16 pixels tall.
Custom character set can also be loaded using BIOS video services
(refer appendix B).
The graphics modes can also display characters, but they are
produced quite differently. The graphics modes can only store
information bit-by-bit and characters are no exception... they must
be drawn one bit at a time. The big advantage of this method is
that one can design characters of desired style, shape and size.
Bits
7 6 5 4 3 2 1 0 Purpose
1 Blue component of f/g color
1 Green component of f/g color
1 Red component of f/g color
1 Intensity component of f/g color
1 Blue component of b/g color
1 Green component of b/g color
1 Red component of b/g color
1 Blinking component
252 Let Us C
Figure 15.2
The first four bits can produce 16 different colors, whereas the
Red, Green and Blue components of background colors can
produce 8 different colors. Figure 15.3 shows, which bit setting,
will produce what color.
Color Components
Black 0 0 0 0
Blue 0 0 0 1
Green 0 0 1 0
Cyan 0 0 1 1
Red 0 1 0 0
Magenta 0 1 0 1
Brown 0 1 1 0
White 0 1 1 1
Light Black 1 0 0 0
Light Blue 1 0 0 1
Light Green 1 0 1 0
Light Cyan 1 0 1 1
Light Red 1 1 0 0
Light Magenta 1 1 0 1
Yellow 1 1 1 0
Chapter 15: VDU Basics 253
Intense White 1 1 1 1
Figure 15.3
If the bit settings of the color byte are, say, 00010100, then the
character produced would be of red color on a blue background.
Similarly, 10001110 would produce a yellow character on a black
background, and the character would blink on the screen.
Colors in VGA
VGA’s video memory is organized in four planes—red, green, blue
and intensity. Each plane provides one bit of data for each pixel.
Thus any pixel is represented by a 4-bit value, each plane
contributing one bit of this 4-bit value. The 4-bit pixel value is
from the display memory is used as the address of 1 of the 16
palette registers. For example, a pixel value of 0000 selects the
palette register 0, a pixel value of 0001 selects register 1, a pixel
value of 0010 selects register 2, and so on.
Each palette register is 6 bits long. Once the palette register has
been chosen the 6-bit value in it is combined with a 2-bit value
254 Let Us C
from a color select register, resulting into a 8-bit value. This 8-bit
value is used as the address of 1 of the 256 DAC (Digital to
Analog Converter) registers. Each DAC register contains an 18-bit
value that represents the color. The 18-bit value is organized as 6-
bit red, green and blue color components. This value is sent to the
analog conversion circuitry, which converts it into three
proportional analog signals and sends them to the monitor. Since
each DAC register is 18-bit long, a pixel can have any of the
2,62,144 values (218).
0 1 1 1 0 0 0 1
18-bit Color Value
01110001 001101 001110 101101
R
Analog
G
Conversion
Circuit B
11111100
11111101
11111110
11111111
Figure 15.4
VGA supports several graphics modes. The two popular ones are
—640 x 480, 16-color mode and a 320 x 200, 256-color mode.
How come only 16 or 256 colors can be availed at a time from
2,62,144 colors?
In the 256-color mode, the 2-bits from the color select register and
6 bits from the palette register are combined to form a 8-bit value.
This 8-bit value can give rise to 256 different combinations. Each
combination references a particular DAC register, which holds the
actual 18-bit color value. As a result, we can use 256 out of the
possible 2,62,144 color values (218).
In the 16-color mode, the color select register bits always have a
value 0. Hence, in this mode only the first 64 DAC registers get
used. And since there are only 16 palette registers that can be used
to refer to these DAC registers, in this mode we can use any 16 out
of the 2,62,144 colors.
Chapter 15: VDU Basics 257
Colors in SVGA
There are several modes that are specific to SVGA. These modes
can be broadly categorized into:
(a) Palette-indexed modes
(b) Direct color modes
Video Pages
In text mode each character displayed on the screen takes 2 bytes
in video memory. As a result a total of 2000 characters (25 x 80)
258 Let Us C
would require 4000 bytes, or roughly 4 KB. As size of video
memory is bigger than 4 KB, if only the first 4 KB of video
memory is used then the rest would remain unutilized. To avoid
this the display memory can be split into several chunks of 4 KB
each. These chunks of memory are called video pages. Thus, there
are four video pages in mode 3, numbered from 0 to 3. At any
given time, contents of one page are displayed on the screen.
Information can be written into the displayed page or any of the
other pages. Using this technique we can build a screen on an
invisible page while another page is being displayed, then switch
to the new page when appropriate time comes. Switching screen
images this way makes them appear to regenerate instantaneously.
F
E
D
C
Window to video memory B
Window to video memory A
1MB
640KB
260 Let Us C
Figure 15.5
We know that above the 640 KB RAM, there are 2 blocks (block A
and Block B) of 64 KB each. While working in text mode all text
displayed on the screen is written to the B block starting at address
0xB8000. Each character present on the screen uses 2 bytes in B
block. The first byte contains the ASCII value of the character,
whereas the next byte contains the color of the character. For
example, if ‘A’ is displayed in 0th row, 0th column on the screen,
then address 0xB8000 contains the ASCII value of ‘A’, whereas
the immediately adjacent address contains the color of ‘A’.
/* Screenful of 'A's */
main( )
{
int i ;
char far *vidmem = 0xB8000000 ;
c = 10 ;
for ( i = 0 ; i <= 10 ; i++ )
{
write2vdu ( message[i], 77, 10, c ) ;
c++ ;
}
}
Exercise
Chapter 15: VDU Basics 263
[A] State True or False:
(a) High refresh rates cause the screen to flicker contributing to
eye-strain.
(b) The microprocessor does not have the ability to send signals
necessary to produce the images on the screen.
(c) Text or graphics on the screen are built up from tiny dots
called picture elements or ‘pixels’.
(d) The flat screen results in reduced glare and a higher quality,
more accurate image.
(e) Interlaced monitors offer better and stable displays as
compared with non-interlaced monitors.
(f) The graphics card in a modern PC can be connected either to
the PCI slot or to the AGP slot.
(g) In text mode for each character on screen there are two bytes
in video memory, one containing the ASCII value of the
character and other containing its color.
(h) The amount of memory that is required for representing a
character on screen in text mode and a pixel in graphics mode
is always same.
(i) VGA’s video memory is organized in four planes and each
plane provides one bit of data for each pixel.
(j) In VGA since each DAC register is 18-bit long, a pixel can
have any of the 2,62,144 values (218).
(k) In SVGA graphics mode, each DAC register is 24 bits long.
(l) While accessing video memory under DOS, A block is used
for the text mode and B block is used for the Graphics mode.
(c) The monitors that sweeps the screen in lines from top to
bottom one line after the other in one pass are known as
(1) Non-interlaced monitors
(2) Interlaced monitors
(3) FST monitors
(4) All the above
(c) Why is it that in text mode there is only one font available,
whereas in graphics mode characters can be displayed in a
variety of fonts?
char *filemenu[ ] = {
"Rename file",
"Copy file",
"Delete file",
"Display file"
};
char *dirmenu[ ] = {
"Make directory",
"Change directory",
"Remove directory"
"List directory"
};
266 Let Us C
main( )
{
int row = 5, col = 20, vdupage, num ;