home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / MS_ARCAD.ZIP / ARC2_1.CHP < prev    next >
Text File  |  1993-06-15  |  7KB  |  190 lines

  1. %
  2. #EF
  3. #T15,1,Chapter 2     Computer Video Systems     Pg. 1
  4. #HS,1,4,80,25,11,1
  5. #C4,R5
  6. ~Y~I
  7.  
  8.                                ~W~IOverview~Y~I
  9.  
  10.  
  11. Modern microcomputers come with |video subsystems| (or else the subsystem
  12. can be installed). There are a few basic parts to the video subsystem on
  13. your computer.
  14.  
  15. #WN
  16. #C4,R14
  17. The first is the most obvious, ~G~Ithe screen~Y~I. A computer |monitor| is a
  18. cathode ray tube (CRT) with one or more phosphorus coatings on the front.
  19. Phosphorus is a chemical that glows when energized. When we want to send
  20. an image to the screen, we spray electrons at the phosphorus to energize
  21. it. The energized phosphorus then starts glowing for a small portion of
  22. a second.
  23.  
  24. #WN
  25. %
  26. #EF
  27. #T15,1,Chapter 2     Computer Video Systems     Pg. 2
  28. #HS,1,4,80,25,11,1
  29. #C4,R5
  30. ~Y~I
  31. The coating is divided into discrete dots called |pixels|. The pixels are
  32. arranged into rows, called scan lines. On monochrome screens each pixel
  33. may be on or off. That is, it can be glowing or dark. Color systems have
  34. three (and possibly more) electron guns inside the CRT. By directing the
  35. beams at different portions of a pixel, each of which are colored
  36. differently, colors in various gradations can be produced.
  37.  
  38. #WN
  39. #BO,5,6,75,19,7,1,0,12,15,2
  40. Put more simply, each pixel on a color monitor is composed of at
  41. least three little dots. The dots are usually colored red, green,
  42. and blue. That's why such monitors are called RGB monitors - the
  43. RGB stands for red, green, and blue.
  44.  
  45. The dots are small enough so that our eyes can't separate them.
  46. By controlling the intensity of the red, blue, and green portions
  47. of each pixel, a wide variety of colors and shades can be produced
  48. on the screen. How many shades can be produced is determined by the
  49. number of different intensities a monitor will allow and how much
  50. memory your video adaptor has. On PCs, memory is the governing
  51. factor.
  52.  
  53.  
  54. #C4,R13
  55. ~KFor each pixel on the screen, there has to be at least one location in
  56. video memory. On monochrome systems, one bit in memory corresponds to one
  57. pixel on the screen. This is because a monochrome pixel may only have one
  58. of two possible values, ~C~Ion~Y~I or ~R~Ioff~Y~I. As it happens, a bit may also have one
  59. of two values, ~C~Ion~Y~I or ~R~Ioff~Y~I.~k
  60.  
  61. #WP
  62. %
  63. #EF
  64. #T15,1,Chapter 2     Computer Video Systems     Pg. 3
  65. #HS,1,4,80,25,11,1
  66. #C4,R5
  67. ~Y~I
  68. One the ~W~ICGA ~Y~Iadaptor, the very first adaptor for the IBM PC that was able
  69. to do color graphics, there are ~M~Itwo modes~Y~I. The first is called ~C~Itwo-color
  70. mode~Y~I, and it has a resolution of |640 x 200 pixels|. The second is
  71. ~G~Ifour-color mode~Y~I, and it has a resolution of 320 x 200 pixels.
  72.  
  73. #WN
  74. #C4,R11
  75. The ~C~Itwo-color mode~Y~I has each pixel mapped into a single bit. That is all
  76. that is needed to represent the two different color combinations, which
  77. are typically |black and white|. In ~G~Ifour-color mode~Y~I, the possible color
  78. combinations are mapped into two bits. With two bits, each of which can
  79. be set to one of two values, there are four possible values that each
  80. pixel can have, hence four colors can be displayed.
  81.  
  82. #WN
  83. #BO,5,8,75,15,7,1,0,7,15,2
  84. Because video RAM is grouped together into bytes of eight bits, one
  85. byte contains the information for four pixels. The CGA also has the
  86. added headache of using interleaved memory. Interleaved memory means
  87. that the pixel data for all the even numbered scan lines (rows of
  88. pixels) are kept in one place in memory, while the data for the odd
  89. numbered lines are kept in another.
  90.  
  91. #WN
  92. #EF
  93. #QT,T,arc2_1_1
  94.  
  95. #WP
  96. %
  97. #EF
  98. #T15,1,Chapter 2     Computer Video Systems     Pg. 4
  99. #HS,1,4,80,25,11,1
  100. #C4,R5
  101. ~Y~I
  102.  
  103. The ~R~IEGA~Y~I and ~M~IVGA~Y~I (an adaptor called |SuperVGA| exists as well)
  104. adaptors use a completely different scheme to map their pixels into memory.
  105. These adaptors use what are called bit planes. Standard EGA and VGA adaptors
  106. have four bit planes.
  107.  
  108. #WN
  109. #BO,5,10,75,13,7,1,0,2,15,2
  110. Since SVGA is a very non-standard (but popular) adaptor, it is
  111. possible that there are more than four bit planes in SVGA modes.
  112.  
  113. #C4,R12
  114. The four bits that store the pixel information are each kept in a separate
  115. bit plane, one bit to a bit plane. All of the bits that are associated with
  116. a particular pixel can be accessed in |parallel|. This organization not only
  117. decreases access time, it saves memory.
  118.  
  119. #WN
  120. #EF
  121. #QT,T,arc2_1_2
  122. #WP
  123. %
  124. #EF
  125. #T15,1,Chapter 2     Computer Video Systems     Pg. 5
  126. #HS,1,4,80,25,11,1
  127. #C4,R5
  128. ~Y~I
  129. The standard modes available for the ~C~IEGA~Y~I can display as many as ~C~I16 colors~Y~I at
  130. a time, with resolutions up to ~C~I640 x 350 pixels~Y~I. A standard ~R~IVGA~Y~I can display
  131. up to ~R~I256 colors ~Y~Iwith a resolution of ~R~I320 x 200 pixels~Y~I. ~SThe VGA also has a
  132. 16 color mode with a resolution of 640 x 480.~s
  133.  
  134. #WN
  135. SuperVGA systems vary both in the number of colors they can display and the
  136. screen resolution. However, it's not uncommon for them to be able to display
  137. ~W~I~F262,144 ~Y~I~Ncolors at a resolution of ~W~I1024 x 768 pixels~Y~I.
  138.  
  139. #WN
  140. #BO,5,10,75,13,7,1,0,2,15,2
  141. There are some SVGA adaptors that will display in excess on 4
  142. million colors at a resolution of 1280 x 1024.
  143.  
  144. #C4,R15
  145. There are also higher resolution adaptors available for PC-compatible
  146. computers. Currently, these adaptors are so much more expensive than VGA or
  147. SuperVGA that they are mostly purchased by professionals that use high
  148. resolution graphics as part of their job. Look for this to change, however.
  149. Since Windows 3.x supports 24-bit graphics, it's much easier now to produce
  150. programs for high end adaptors. I don't think it will be too long before
  151. extremely high resolution video systems push EGA and VGA completely off the
  152. market.
  153.  
  154. #WP
  155. %
  156. #EF
  157. #T15,1,Chapter 2     Computer Video Systems     Pg. 6
  158. #HS,1,4,80,25,11,1
  159. #C4,R5
  160. ~Y~I
  161. Any code written for EGA |won't run on a CGA|, and code written for the
  162. VGA may not run on an EGA adaptor. It is for this reason that I chose to
  163. write the software for this book using the Borland Graphics Interface
  164. (BGI). The BGI handles the particulars of dealing with the hardware so we
  165. don't have to. This enables us to write games that are portable across a
  166. wide variety of adaptors.
  167.  
  168. #WN
  169. #C4,R13
  170. The demonstration game included with this book is  written to run on EGA,
  171. VGA, and SVGA compatible adaptors. The use of CGA adaptors is presented in
  172. the next section. However, it is not demonstrated in this book. That's
  173. because CGA is dying out very quickly.
  174.  
  175. #WN
  176. #BO,5,6,75,19,7,1,0,13,15,2
  177. The another reason for not bothering with the CGA is that the EGA,
  178. the VGA, and the SVGA support a feature called paging. We will make
  179. limited use of this ability in Space Attackers.  A page is the
  180. amount of memory that it takes to display one screenful of graphics.
  181. That amount is different for each adaptor. A high resolution adaptor
  182. like the VGA requires much more memory per page than the CGA.
  183.  
  184. The number of pages available on EGA, VGA and SuperVGA adaptors
  185. varies from machine to machine. However, it's reasonable to expect
  186. that there are at least two pages that you can use, especially in
  187. medium and low resolution modes. For Space Attackers, that's all
  188. we'll need.
  189.  
  190. #X