home *** CD-ROM | disk | FTP | other *** search
- %
- #EF
- #T15,1,Chapter 2 Computer Video Systems Pg. 1
- #HS,1,4,80,25,11,1
- #C4,R5
- ~Y~I
-
- ~W~IOverview~Y~I
-
-
- Modern microcomputers come with |video subsystems| (or else the subsystem
- can be installed). There are a few basic parts to the video subsystem on
- your computer.
-
- #WN
- #C4,R14
- The first is the most obvious, ~G~Ithe screen~Y~I. A computer |monitor| is a
- cathode ray tube (CRT) with one or more phosphorus coatings on the front.
- Phosphorus is a chemical that glows when energized. When we want to send
- an image to the screen, we spray electrons at the phosphorus to energize
- it. The energized phosphorus then starts glowing for a small portion of
- a second.
-
- #WN
- %
- #EF
- #T15,1,Chapter 2 Computer Video Systems Pg. 2
- #HS,1,4,80,25,11,1
- #C4,R5
- ~Y~I
- The coating is divided into discrete dots called |pixels|. The pixels are
- arranged into rows, called scan lines. On monochrome screens each pixel
- may be on or off. That is, it can be glowing or dark. Color systems have
- three (and possibly more) electron guns inside the CRT. By directing the
- beams at different portions of a pixel, each of which are colored
- differently, colors in various gradations can be produced.
-
- #WN
- #BO,5,6,75,19,7,1,0,12,15,2
- Put more simply, each pixel on a color monitor is composed of at
- least three little dots. The dots are usually colored red, green,
- and blue. That's why such monitors are called RGB monitors - the
- RGB stands for red, green, and blue.
-
- The dots are small enough so that our eyes can't separate them.
- By controlling the intensity of the red, blue, and green portions
- of each pixel, a wide variety of colors and shades can be produced
- on the screen. How many shades can be produced is determined by the
- number of different intensities a monitor will allow and how much
- memory your video adaptor has. On PCs, memory is the governing
- factor.
-
-
- #C4,R13
- ~KFor each pixel on the screen, there has to be at least one location in
- video memory. On monochrome systems, one bit in memory corresponds to one
- pixel on the screen. This is because a monochrome pixel may only have one
- of two possible values, ~C~Ion~Y~I or ~R~Ioff~Y~I. As it happens, a bit may also have one
- of two values, ~C~Ion~Y~I or ~R~Ioff~Y~I.~k
-
- #WP
- %
- #EF
- #T15,1,Chapter 2 Computer Video Systems Pg. 3
- #HS,1,4,80,25,11,1
- #C4,R5
- ~Y~I
- One the ~W~ICGA ~Y~Iadaptor, the very first adaptor for the IBM PC that was able
- to do color graphics, there are ~M~Itwo modes~Y~I. The first is called ~C~Itwo-color
- mode~Y~I, and it has a resolution of |640 x 200 pixels|. The second is
- ~G~Ifour-color mode~Y~I, and it has a resolution of 320 x 200 pixels.
-
- #WN
- #C4,R11
- The ~C~Itwo-color mode~Y~I has each pixel mapped into a single bit. That is all
- that is needed to represent the two different color combinations, which
- are typically |black and white|. In ~G~Ifour-color mode~Y~I, the possible color
- combinations are mapped into two bits. With two bits, each of which can
- be set to one of two values, there are four possible values that each
- pixel can have, hence four colors can be displayed.
-
- #WN
- #BO,5,8,75,15,7,1,0,7,15,2
- Because video RAM is grouped together into bytes of eight bits, one
- byte contains the information for four pixels. The CGA also has the
- added headache of using interleaved memory. Interleaved memory means
- that the pixel data for all the even numbered scan lines (rows of
- pixels) are kept in one place in memory, while the data for the odd
- numbered lines are kept in another.
-
- #WN
- #EF
- #QT,T,arc2_1_1
-
- #WP
- %
- #EF
- #T15,1,Chapter 2 Computer Video Systems Pg. 4
- #HS,1,4,80,25,11,1
- #C4,R5
- ~Y~I
-
- The ~R~IEGA~Y~I and ~M~IVGA~Y~I (an adaptor called |SuperVGA| exists as well)
- adaptors use a completely different scheme to map their pixels into memory.
- These adaptors use what are called bit planes. Standard EGA and VGA adaptors
- have four bit planes.
-
- #WN
- #BO,5,10,75,13,7,1,0,2,15,2
- Since SVGA is a very non-standard (but popular) adaptor, it is
- possible that there are more than four bit planes in SVGA modes.
-
- #C4,R12
- The four bits that store the pixel information are each kept in a separate
- bit plane, one bit to a bit plane. All of the bits that are associated with
- a particular pixel can be accessed in |parallel|. This organization not only
- decreases access time, it saves memory.
-
- #WN
- #EF
- #QT,T,arc2_1_2
- #WP
- %
- #EF
- #T15,1,Chapter 2 Computer Video Systems Pg. 5
- #HS,1,4,80,25,11,1
- #C4,R5
- ~Y~I
- The standard modes available for the ~C~IEGA~Y~I can display as many as ~C~I16 colors~Y~I at
- a time, with resolutions up to ~C~I640 x 350 pixels~Y~I. A standard ~R~IVGA~Y~I can display
- up to ~R~I256 colors ~Y~Iwith a resolution of ~R~I320 x 200 pixels~Y~I. ~SThe VGA also has a
- 16 color mode with a resolution of 640 x 480.~s
-
- #WN
- SuperVGA systems vary both in the number of colors they can display and the
- screen resolution. However, it's not uncommon for them to be able to display
- ~W~I~F262,144 ~Y~I~Ncolors at a resolution of ~W~I1024 x 768 pixels~Y~I.
-
- #WN
- #BO,5,10,75,13,7,1,0,2,15,2
- There are some SVGA adaptors that will display in excess on 4
- million colors at a resolution of 1280 x 1024.
-
- #C4,R15
- There are also higher resolution adaptors available for PC-compatible
- computers. Currently, these adaptors are so much more expensive than VGA or
- SuperVGA that they are mostly purchased by professionals that use high
- resolution graphics as part of their job. Look for this to change, however.
- Since Windows 3.x supports 24-bit graphics, it's much easier now to produce
- programs for high end adaptors. I don't think it will be too long before
- extremely high resolution video systems push EGA and VGA completely off the
- market.
-
- #WP
- %
- #EF
- #T15,1,Chapter 2 Computer Video Systems Pg. 6
- #HS,1,4,80,25,11,1
- #C4,R5
- ~Y~I
- Any code written for EGA |won't run on a CGA|, and code written for the
- VGA may not run on an EGA adaptor. It is for this reason that I chose to
- write the software for this book using the Borland Graphics Interface
- (BGI). The BGI handles the particulars of dealing with the hardware so we
- don't have to. This enables us to write games that are portable across a
- wide variety of adaptors.
-
- #WN
- #C4,R13
- The demonstration game included with this book is written to run on EGA,
- VGA, and SVGA compatible adaptors. The use of CGA adaptors is presented in
- the next section. However, it is not demonstrated in this book. That's
- because CGA is dying out very quickly.
-
- #WN
- #BO,5,6,75,19,7,1,0,13,15,2
- The another reason for not bothering with the CGA is that the EGA,
- the VGA, and the SVGA support a feature called paging. We will make
- limited use of this ability in Space Attackers. A page is the
- amount of memory that it takes to display one screenful of graphics.
- That amount is different for each adaptor. A high resolution adaptor
- like the VGA requires much more memory per page than the CGA.
-
- The number of pages available on EGA, VGA and SuperVGA adaptors
- varies from machine to machine. However, it's reasonable to expect
- that there are at least two pages that you can use, especially in
- medium and low resolution modes. For Space Attackers, that's all
- we'll need.
-
- #X