Sie sind auf Seite 1von 10

UNIT-IV

VDU Basics

Components of VDU Monitors (Display Screens)Refresh Rate Resolution Multi sync 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 or most computer
users, the two most important components of the computer system are the Video Display Unit (VDU)
and the keyboard. It has been observed that the decision of customers, who purchase software, is more
often than not strongly influenced by how the screens have been designed in the software. Jazzier the
screen, more appeal it carries for the users. Your monitor provides the link between you and your
computer. Although you can get rid of your printer, disk drives, etc. you cannot sacrifice the monitor.
Without it, you would be operating blind!

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.
Let us discuss each of these now.

Monitors (Display Screens)

In early days of PC not every monitor could support text, graphics and colors. But that is history now.
Today almost all monitors support text and graphics capabilities and produce colors. Today what is of
more significance regarding the monitor is its refresh rate and resolution. Let us now examine them.

Refresh Rate

How are the images, either text or graphics, produced on the screen? The microprocessor does not have
the ability to send signals necessary to produce the images on the screen. This task is performed by
graphics card circuitry. Either the microprocessor or the graphics processor present in the graphics card
writes the information to be displayed on the screen into the video memory. Once written, the graphics
card circuitry reads the digital information from video memory, converts it to analog signals and
transmits them to the electronic gun inside the monitor. The screen is coated with a material called
Phosphor Bronze. When the electron beam strikes the Phosphor-Bronze particles they glow. The
phosphor particles have a property that unless the electron beam again strikes them they would vanish.
To prevent this the graphics card circuitry repeatedly (80 to 100 times a second) reads information from
video memory and transfers it to the screen, making the images displayed on the screen clear and
steady. This process is called ‘refreshing the screen’, and the rate at which it is refreshed is called
‘refresh rate’. Low refresh rates cause the screen to flicker contributing to eye-strain. The higher the
refresh rate better it is for your eyes.
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. Frequently, one comes across confusing and conflicting
terminologies related with the monitor. This involves interlaced and non-interlaced monitors, multi sync
monitors, energy saving monitors, active matrix LCD display, etc. Let us now try to de-mystify this
jargon.

Multi sync 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 multi sync, multi frequency, multi scan 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.

Interlaced and Non-Interlaced Monitors

In non-interlaced (conventional) monitors the electron beam sweeps the screen in lines from top to
bottom one line after the other, completing the screen in one pass. In interlaced monitors too, the
electron beam sweeps the screen from top to bottom, but it does so in two passes, sweeping the odd
lines first and the even lines second. Non-interlaced monitors offer better and stable

displays when compared with interlaced ones, even though they are costlier. Most monitors today are
non-interlaced.

Energy Saving Monitors

Monitor is one of the most power-hungry computer components. Hence, putting off the monitor if it is
idle for a specific period of time can save energy. Many PC manufacturers are trying to meet
Environmental Protection Agency’s (EPA’s) Energy Store Requirements. Any PC-monitor that consumes
less than 70 watt scan use the Energy Star logo. There are different energy saving standards available for
monitors, By far the most popular amongst these is Video Electronic Standards Associations’ Display
Power Management Signal (VESA-DPMS) specifications.
Active Matrix LCD Display

Instead of using the CRT technology, the laptop computers make use of Liquid Crystal Diode (LCD)
displays. These displays have low glare flat screens and low power requirements (5 watts versus nearly
60 watts for an ordinary monitor). There are 3 LCD choices —passive-matrix monochrome, passive-
matrix color and active-matrix color. The differences between these types are beyond the scope of this
book.

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 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.

Graphics Card Standards

The first graphics card, introduced in August of 1981 by IBM, was Monochrome Display Adapter (MDA).
The monitors that used these cards were typically text-only, with green, amber or white text on a black
background. Color for IBM-compatible computers appeared on the scene with the 4-color Hercules
Graphics Card (HGC), followed by the 8-color Color Graphics Adapter (CGA) and 16-color Enhanced
Graphics Adapter (EGA).When IBM introduced the Video Graphics Array (VGA) in 1987, anew graphics
standard came into being. A VGA display could support up to 256 colors (out of a possible 2,62,144
colors) at resolutions up to 720 x 400 (resolution and its impact on the image is discussed in the next
section). Perhaps the most interesting difference between VGA and the preceding formats is that VGA
was analog, whereas displays had been digital up to that point. Why were displays moved from digital to
analog when most other electronic systems like compact disk players, newer VCRs and camcorders use
digital picture storage? The answer is color. A digital display generates different colors by using the red,
green and blue electron beams. In addition an intensity signal is used to display each color at one of the
two intensity levels. This gives rise to a capability to generate 16 colors (24).

An analog display works like digital displays that use RGB electron beams to construct various colors, but
each color in the analog system can be displayed at varying levels of intensity—64levels, in the case of
the VGA. This versatility provides 2,62,144 possible colors (643). In computer graphics the color is often
important than the resolution, because the human eye perceives the picture that has more colors as
being more realistic. Thus IBM moved display system into analog to enhance the color capabilities. 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 indifferent 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. In order to create some standard out of the chaos of SVGA, the Video
Electronics Standards Association (VESA) introduced a standard programming interface called the VESA
BIOS Extension. This provided programmers with one common interface to write for instead of trying to
tailor their programs to work with several different SVGA cards. All SVGA cards in use today comply with
the VESA standard.
Modern Graphics Cards

The graphics card in a modern PC can be connected either to the PCI slot (Peripheral Component
Interconnect expansion slot) or to the AGP (Accelerated Graphics Port) slot. The communication
between the PCI slot and the main processor takes place through a PCI bus. All the cards connected to
different PCI slots share the PCI bus. Unlike this the AGP bus is not shared and is dedicated to exclusive
graphics use. As a result, AGP offers a faster performance as compared to PCI.

The modern PC graphics card consists of six main components:(a)Graphics processor (b)Video
memory(c)Digital to Analog converter (DAC)(d)Display Connector (e)Bus Connector (f)Graphics BIOS Let
us discuss these components now.

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. The advent of graphical OS like Windows as well as advances in
Multimedia and 3D graphics has dramatically increased the a mount of information needing to be
displayed on the monitor. This has made it impractical for the main processor to handle all graphics
activities. Hence these activities have been now assigned to the dedicated processor present on the
graphics card. They have special command sets for graphics manipulation built right into the chip. This
graphics processor is optimized for performing graphics operations. The CPU sends a set of drawing
instructions that are interpreted by the graphics card’s proprietary driver and executed by the card’s on-
board graphics processor. This greatly reduces the main processor’s workload. Such a graphics processor
is often known as Graphics Accelerator.

Another variety of graphics processor called Coprocessor also exists. In this system the graphic cards
driver software sends graphics-related tasks directly to the Coprocessor, which proceeds to carry out
those tasks without any assistance from the main processor. The OS sends everything else to the main
processor.Thus both the processors work simultaneously resulting in better performance. These
Coprocessors are typically used in higher end graphics cards. Operations including bitmap transfers and
painting, window resizing and repositioning, line drawing, font scaling and polygon drawing can be
handled by the graphics processor at far greater speeds than the software running on the system’ main
processor.The graphics processor then writes the display data to the video memory (also called frame
buffer). As there’s less data to transfer, there’s less congestion on the bus.

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.
Digital to Analog Converter (DAC)

The information in the video memory frame buffer is an image of what appears on the screen, stored as
a digital bitmap. But while the video memory contains digital information its output medium, the
monitor, uses analogue signals. The analog signal requires more than just an on or off signal, as it’s used
to determine where, when and with what intensity the electron guns inside the monitor should be fired
as they scan across and down the front of the monitor. This is where the DAC comes in. The DAC takes
the input from the video.

Display Connector

Graphics cards use standard connectors. Most cards use the 15-pinfemale connector. The monitor cable
is plugged into this connector.

Computer (Bus) Connector

The graphics card connects to the PCI/AGP slot through this connector. Main processor communicates
with the graphics card through this connector. Today most of the graphics cards are connected to the
AGP slot.

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.

Video Display Modes

Just as an artist can choose from a variety of media when creating a picture (oils, etching, watercolors
etc.), so a programmer can choose from a variety of modes, or formats. Each mode provides a different
combination of display characteristics. These characteristics include:

(a) Whether text or graphics is to be displayed

(b) The amount of text to be displayed in one line

(c) The resolution

(d) The number of possible colors Each mode requires certain hardware (monitor and display adapter)
and programming approaches. Each and every mode will not be supported by a particular combination
of monitor and display adapter. There are several modes available. Figure 15.1lists the popular along
with the number of colors and resolution they offer.

ModeReaolution.ColorsBits/PixelRemark

5320 x 2004 212640 x 48016 413320 x 200256 8101h640 x 480256 8 Palette-index mode103h800 x
600256 8Palette-index mode104h1024 x 76816 4Palette-index mode105h1024 x 768256 8Palette-index
mode111h640 x 48065536 16Direct color mode112h640 x 4801677716 32Direct color mode114h800 x
60065536 16Direct color mode115h800 x 6001677716 32Direct color mode117h1024 x 76865536
16Direct color mode118h1024 x 7681677716 32Direct color mode11Ah1280 x 102465536 16Direct color
mode11Bh1280 x 10241677716 32Direct color mode3640 x 200162 bytes/charText mode
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. In mode 5 each pixel displayed on the screen occupies two bits in video memory. These two bits
can generate four values (00, 01, 10and 11) and hence a pixel can be drawn in four possible colors. In
modes 18 and 19 a pixel can be drawn in 16 and 256 colors respectively. How these colors are generated
is discussed in a later section in this chapter. 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 256characters. Either one or two character sets may be active giving these
adapters the capability to display up to 512 different 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.

Colors in Text Mode

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. The color byte contains three components—
the foreground color (color of the character itself),the background color (color of the area not covered
by the character) and the blinking component of the character. Figure15.2 shows the breakup of the
color byte.

Bits7 6543210Purpose

1Blue component of f/g color 1Green component of f/g color 1Red component of f/g color 1Intensity
component of f/g color 1Blue component of b/g color 1Green component of b/g color 1Red component
of b/g color 1Blinking component

Figure 15.2The 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 Intensity Red Green Blue


Black0000Blue0001Green0010Cyan0011Red0100Magenta0101Brown0110White0111Light
Black1000Light Blue1001Light Green1010Light Cyan1011Light Red1100Light Magenta1101Yellow1110

Intense White1111

Figure 15.3If 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 Graphics Mode

So far we have seen how to set color in text modes. Setting color in graphics modes is quite different. In
the graphics mode each pixel on the screen has a color associated with it. There are important
differences here as compared to setting color is text mode. First, the pixels cannot blink. Second, each
pixel is a discrete dot of color, there is no foreground and background; each pixel is simply one color or
another. The number of colors that each mode can support and the way each graphics card generates
these colors is drastically different. Here we would examine the color generation technique used by
VGA.

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 from
a color select register, resulting into a 8-bit value. This 8-bitvalue is used as the address of 1 of the 256
DAC (Digital to Analog Converter) registers. Each DAC register contains an 18-bitvalue 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 the2,62,144 values (2

18).The translation of a 4-bit color value into a 18-bit DAC register value is shown in Figure 15.4.

Figure 15.4In summary, we cannot speak of ‘color’ at any point in the color translation process until the
output stage of DAC. The 4-bit pixel

01110001Pixel Value0110000000010010011001111111Palette Register


011100000000000000000100000010000000110111000111111100111111011111111011111111DAC
Registers18-bit Color Value001101001110101101AnalogConversionCircuitR GB01Color SelectRegister

256

Let Us C
value in memory, the 6-bit value in the palette registers and the 8- bit value sent to the DAC are all
addresses, not colors. For example, a pixel with a 4-bit value of 0 is not black; it is address 0of the
palette register. If this palette register contains a value 3Fhthen this value is not the white color but a
value which would be combined with the 2 bits from the color select register to give a 8- bit value.
Suppose the 2-bit value is 0 then the 8-bit value would remain 3Fh. This value is also not the white color.
It is the address of the DAC register. It is the value stored in the DAC register 3Fhthat represents the
color. Suppose the value stored in the DAC register 0x3F is 63 then the pixel would be displayed in color
63.Thus, a pixel value of 0 in display memory can become color 63when displayed on the screen. In
short, it isn’t color until the DAC says it is color. 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 from2,62,144 colors In the 256-color mode, the 2-bits from the color select
register and6 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 (2

18

).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 mode scan be broadly categorized
into:(a)Palette-indexed modes(b)Direct color modes In the palette-indexed modes SVGA uses either 4
bits 8 bits to represent a pixel. We would discuss here the case when it uses 8 bits to represent a pixel
(the 4-bit model’s discussion would be similar). In the 8-bit model SVGA uses 256 palette registers. Using
the 8-bit pixel value it can access 256 palette registers. Each value in the palette register can further
access 256 DAC registers. Each DAC register is 24 bits long. Hence, in SVGA we can choose 256colors
simultaneously out of the possible 16,77,716 colors (2

24

). Note that the 8-bit pixel value is merely an

index into the palette registers and the palette register value is an index into the DAC registers. The
actual color value is the one in the DAC registers. In direct color modes there are no palette registers or
planes. These modes typically use either 16 bits or 32 bits to represent a pixel color. A 16-bit or 32-bit
value directly represents the pixel color. In these modes we get either 65536 (2

16
) or 16777216 (2

24

) colors ata time. The first category is often known as a ‘high color’ mode and the second is known as
‘true color’ mode. Why were the palettes abandoned? Two reasons. For one the video memory became
cheap and for another the advent of multimedia and 3Dgraphics demanded more colors to be displayed
simultaneously.

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) 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. This technique is often used
in writing menu-driven programs ,where a different menu is written on each page. As a result, to switch
over from one menu to another, all that we are required to do is to switch over to an appropriate page,
where the menu is already written and ready to be displayed. This is obviously a better procedure than
erasing the existing menu and writing a new menu .In graphics modes too, the display memory is split
into video pages. The maximum number of pages permitted depends on the bits required to store
information of one pixel and the amount of display memory available.

The DOS Perspective

While working under DOS the processor is made to work in Real mode. In this mode all the CPU registers
are reduced to 16-bit. As a result under DOS we cannot access memory blocks bigger than64 KB (216
bytes). This barrier has been overcome to an extent by using a segment :offset scheme (Refer Appendix
G for details of this scheme) that lets you access any byte within 1 MB memory.

Even with this scheme from any given address we can access only the next 64 KB chunk .Due to this
limitation, while working under DOS 2 blocks of memory—A block and B block, each of 64 KB—are
reserved for access to video memory. In fact, these blocks act as a window to the video memory.
Anytime we are to display anything on the screen we write to these blocks, which are mapped into the
video memory .Figure 15.5 shows the exact location of A and B blocks in 1 MB memory map. Note that
the first megabyte of memory is divided into 16 blocks of 64 KB each. These blocks are numbered from
0to 15. As said earlier, blocks A and B map into the video memory. Which out of these two blocks would
be used depends on the mode in which you are working (text/graphics).

FEDC Window to video memory B Window to video memory A1MB640KB


Writing to Video Memory in Text Mode

Windows doesn’t work under text mode so the discussion that follows is specific to MS-DOS. There are 3
ways of displaying characters on the screen.(a)Using standard library functions(b)Using ROM-BIOS or
DOS routines(c)Writing characters directly into video memory The last option works faster than the
other two, because, the standard library functions or ROM-BIOS/DOS routines ultimately write the
characters to be displayed into video memory. Obviously ,if we are able to write characters directly into
video memory we would be able to bypass the standard library functions as well as the ROM-BIOS/DOS
routines .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
address0xB8000. 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’ .Thus, if one character occupies
two bytes in B block, 80 characters of 0th row will be represented by first 160 bytes from
0xB8000onwards. Similarly, one screenful of characters would need 4000 bytes (80 x 25 x 2).

Question Answer

(a)What do you mean by refresh rate? Is it true that higher the refresh rate better is the image on the
screen?(b)What is the purpose of the graphics card? Where is it present in the computer?(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?(d)What colour byte would you use if a message is to be displayed on the screen
with brown background and yellow coloured characters?(e)When we change over from one mode to
another do the screen’s current contents remain intact?

[D]

Answer the following :(a)In the following program the

displaymenu( )

function is supposed to write a given menu on a given VDU page by directly writing it in VDU memory.
You are required to write the function displaymenu( )

(b)Write a general purpose function

writestring( )

which will display a message on the screen by writing it directly into VDU memory. The function should
be capable of displaying the message in the colour which is sent to it.(c)Write a program which
continuously keeps changing the capital letters present on the screen into small case letters and small
case letters present on the screen into capitals. You are not allowed to use

printf( )

putchar( )

puts( )

putch( )