Strip comments and inline ids onto h*

This commit is contained in:
James Gregory 2013-12-30 15:11:04 +11:00
commit 0f5f617adb
362 changed files with 2519 additions and 6694 deletions

View file

@ -10,16 +10,9 @@
<meta name="vspubdate" content="07/01/97" />
<meta name="vscategory" content="Web and Software Development: Game Development,Web and Software Development: Graphics and Multimedia Development" />
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Yogi Bear and Eurythmics Confront VGA Colors</title><!-- HEADER -->
<!-- Empty Reference Subhead -->
<!--ISBN=1576101746//-->
<!--TITLE=Michael Abrash's Graphics Programming Black Book Special Edition//-->
<!--AUTHOR=Michael Abrash//-->
<!--PUBLISHER=The Coriolis Group, Inc.//-->
<title>Michael Abrash's Graphics Programming Black Book Special Edition: Yogi Bear and Eurythmics Confront VGA Colors</title>
<meta name="chapter" content="33" />
<meta name="pages" content="623-628" />
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
</head>
<body>
@ -37,10 +30,10 @@
<p><br /></p>
<h2><a id="Heading1"></a>Chapter 33<br />
<h2 id="Heading1">Chapter 33<br />
Yogi Bear and Eurythmics Confront VGA Colors</h2>
<h3><a id="Heading2"></a>The Basics of VGA Color Generation</h3>
<h3 id="Heading2">The Basics of VGA Color Generation</h3>
<p>Kevin Mangis wants to know about the VGA&rsquo;s 4-bit to 8-bit to 18-bit color translation. Mansur Loloyan would like to find out how to generate a look-up table containing 256 colors and how to change the default color palette. And surely they are only the tip of the iceberg; hordes of screaming programmers from every corner of the planet are no doubt tearing the place up looking for a discussion of VGA color, and venting their frustration at my mailbox. <i>Let&rsquo;s have it</i>, they&rsquo;ve said, clearly and in considerable numbers. As Eurythmics might say, who is this humble writer to disagree?</p>
@ -52,23 +45,22 @@
<p>I would be remiss if I didn&rsquo;t point you in the direction of two more articles, these in the July 1990 issue of <i>Dr. Dobb&rsquo;s Journal</i>. &ldquo;Super VGA Programming,&rdquo; by Chris Howard, provides a good deal of useful information about SuperVGA chipsets, modes, and programming. &ldquo;Circles and the Digital Differential Analyzer,&rdquo; by Tim Paterson, is a good article about fast circle drawing, a topic we&rsquo;ll tackle soon. All in all, the dog days of 1990 were good times for graphics.</p>
<h3><a id="Heading3"></a>VGA Color Basics</h3>
<h3 id="Heading3">VGA Color Basics</h3>
<p>Briefly put, the VGA color translation circuitry takes in one 4- or 8-bit pixel value at a time and translates it into three 6-bit values, one each of red, green, and blue, that are converted to corresponding analog levels and sent to the monitor. Seems simple enough, doesn&rsquo;t it? Unfortunately, nothing is ever that simple on the VGA, and color translation is no exception.</p>
<h4 align="left"><a id="Heading4"></a>The Palette RAM</h4>
<h4 align="left" id="Heading4">The Palette RAM</h4>
<p>The color path in the VGA involves two stages, as shown in Figure 33.1. The first stage fetches a 4-bit pixel from display memory and feeds it into the EGA-compatible palette RAM (so called because it is functionally equivalent to the palette RAM color translation circuitry of the EGA), which translates it into a 6-bit value and sends it on to the DAC. The translation involves nothing more complex than the 4-bit value of a pixel being used as the address of one of the 16 palette RAM registers; a pixel value of 0 selects the contents of palette RAM register 0, a pixel value of 1 selects register 1, and so on. Each palette RAM register stores 6 bits, so each time a palette RAM register is selected by an incoming 4-bit pixel value, 6 bits of information are sent out by the palette RAM. (The operation of the palette RAM was described back in Chapter 29.)</p>
<p>The process is much the same in text mode, except that in text mode each 4-bit pixel value is generated based on the character&rsquo;s font pattern and attribute. In 256-color mode, which we&rsquo;ll get to eventually, the palette RAM is not a factor from the programmer&rsquo;s perspective and should be left alone.</p>
<h4 align="left"><a id="Heading5"></a>The DAC</h4>
<h4 align="left" id="Heading5">The DAC</h4>
<p>Once the EGA-compatible palette RAM has fulfilled its karma and performed 4-bit to 6-bit translation on a pixel, the resulting value is sent to the DAC (Digital/Analog Converter). The DAC performs an 8-bit to 18-bit conversion in much the same manner as the palette RAM, converts the 18-bit result to analog red, green, and blue signals (6 bits for each signal), and sends the three analog signals to the monitor. The DAC is a separate chip, external to the VGA chip, but it&rsquo;s an integral part of the VGA standard and is present on every VGA.</p>
<p><a id="Fig1"><!-- </A><A HREF="javascript:displayWindow('images/33-01.jpg',334,420 )"> --><img src="images/33-01.jpg" /><br />
<!-- </A>
<BR><A HREF="javascript:displayWindow('images/33-01.jpg',334,420)"> --><b>Figure 33.1</b></a>&nbsp;&nbsp;<i>The VGA color generation path.</i></p>
<p><a id="Fig1"><img src="images/33-01.jpg" /><br />
<b>Figure 33.1</b></a>&nbsp;&nbsp;<i>The VGA color generation path.</i></p>
<p>(I&rsquo;d like to take a moment to point out that you can&rsquo;t speak of &ldquo;color&rdquo; at any point in the color translation process until the output stage of the DAC. The 4-bit pixel values in memory, 6-bit values in the palette RAM, and 8-bit values sent to the DAC are all attributes, not colors, because they&rsquo;re subject to translation by a later stage. For example, a pixel with a 4-bit value of 0 isn&rsquo;t black, it&rsquo;s attribute 0. It will be translated to 3FH if palette RAM register 0 is set to 3FH, but that&rsquo;s not the color white, just another attribute. The value 3FH coming into the DAC isn&rsquo;t white either, and if the value stored in DAC register 63 is red=7, green=0, and blue=0, the actual <i>color</i> displayed for that pixel that was 0 in display memory will be dim red. It isn&rsquo;t color until the DAC says it&rsquo;s color.)</p>
@ -91,10 +83,6 @@
<div align="center">
Graphics Programming Black Book &copy; 2001 Michael Abrash
</div><!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->
<!-- BEGIN SUB FOOTER -->
<!-- END FOOTER -->
</div>
</body>
</html>