Remove colour attributes from body and strip most of the font tags out

This commit is contained in:
James Gregory 2013-12-30 13:57:02 +11:00
commit c1f88ddb41
362 changed files with 1632 additions and 1706 deletions

View file

@ -24,7 +24,7 @@
<!--CHAPTER=29//-->
<!--PAGES=547-550//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//--></HEAD><BODY LINK=#0000FF ALINK=#000099 VLINK=#0000FF BGCOLOR=#FFFFFF>
<!--UNASSIGNED2//--></HEAD><body>
<CENTER>
<TABLE BORDER>
@ -53,7 +53,7 @@ DISPLAYED_SCREEN_SIZEequ(640/8)*480
<P>While Listings 29.1 and 29.2 are written in assembly, the principles they illustrate apply equally well to high-level languages. In fact, there&rsquo;s no need for any assembly at all when saving an EGA/VGA screen, as long as the high-level language you&rsquo;re using can perform direct port I/O to set up the adapter and can read and write display memory directly.</P>
<TABLE WIDTH="100%"><TD WIDTH="5%" VALIGN="TOP"><IMG SRC="images/i.jpg"><TD WIDTH="95%"><SMALL><I>One tip if you&rsquo;re saving and restoring the screen from a high-level language on an EGA, though: After you&rsquo;ve completed the save or restore operation, be sure to put any registers that you&rsquo;ve changed back to their default settings. Some high-level languages (and the BIOS as well) assume that various registers are left in a certain state, so on the EGA it&rsquo;s safest to leave the registers in their most likely state. On the VGA, of course, you can just read the registers out before you change them, then put them back the way you found them when you&rsquo;re done.</I></SMALL>
</TABLE>
<H3><A NAME="Heading4"></A><FONT COLOR="#000077">16 Colors out of 64</FONT></H3>
<H3><A NAME="Heading4"></A>16 Colors out of 64</H3>
<P>How does one produce the 64 colors from which the 16 colors displayed by the EGA can be chosen? The answer is simple enough: There&rsquo;s a BIOS function that lets you select the mapping of the 16 possible pixel values to the 64 possible colors. Let&rsquo;s lay out a bit of background before proceeding, however.
</P>
<P>The EGA sends pixel information to the monitor on 6 pins. This means that there are 2 to the 6th, or 64 possible colors that an EGA can generate. However, for compatibility with premonitors, in 200-scan-line modes Enhanced Color Displaymonitors ignore two of the signals. As a result, in CGA-compatible modes (modes 4, 5, 6, and the 200-scan-line versions of modes 0, 1, 2, and 3) you can select from only 16 colors (although the colors can still be remapped, as described below). If you&rsquo;re not hooked up to a monitor capable of displaying 350 scan lines (such as the old IBM Color Display), you can never select from more than 16 colors, since those monitors only accept four input signals. For now, we&rsquo;ll assume we&rsquo;re in one of the 350-scan line color modes, a group which includes mode 10H and the 350-scan-line versions of modes 0, 1, 2, and 3.</P>
@ -61,7 +61,7 @@ DISPLAYED_SCREEN_SIZEequ(640/8)*480
<P>Actually, though, the correspondence of pixel values to color is absolutely arbitrary, depending solely on how the colorportion of the EGA containing the palette registers is programmed. If you cared to have color 0 be bright red and color 1 be black, that could easily be arranged, as could a mapping in which all 16 colors were yellow. What&rsquo;s more, these mappings affect text-mode characters as readily as they do graphics-mode pixels, so you could map text attribute 0 to white and text attribute 15 to black to produce a black on white display, if you wished.</P>
<P>Each of the 16 palette registers stores the mapping of one of the 16 possible 4-bit pixel values from memory to one of 64 possible 6-bit pixel values to be sent to the monitor as video data, as shown in Figure 29.2. A 4-bit pixel value of 0 causes the 6-bit value stored in palette register 0 to be sent to the display as the color of that pixel, a pixel value of 1 causes the contents of palette register 1 to be sent to the display, and so on. Since there are only four input bits, it stands to reason that only 16 colors are available at any one time; since there are six output bits, however, those 16 colors can be mapped to any of 64 colors. The mapping for each of the 16 pixel values is controlled by the lower six bits of the corresponding palette register, as shown in Figure 29.3. Secondary red, green, and blue are less-intense versions of red, green, and blue, although their exact effects vary from monitor to monitor. The best way to figure out what the 64 colors look like on your monitor is to see them, and that&rsquo;s just what the program in Listing 29.3, which we&rsquo;ll discuss shortly, lets you do.</P>
<P><A NAME="Fig2"><!-- </A><A HREF="javascript:displayWindow('images/29-02.jpg',411,243 )"> --><IMG SRC="images/29-02.jpg"><BR><!-- </A>
<BR><A HREF="javascript:displayWindow('images/29-02.jpg',411,243)"> --><FONT COLOR="#000077"><B>Figure 29.2</B></FONT></A>&nbsp;&nbsp;<I>Color translation via the palette registers.</I>
<BR><A HREF="javascript:displayWindow('images/29-02.jpg',411,243)"> --><B>Figure 29.2</B></A>&nbsp;&nbsp;<I>Color translation via the palette registers.</I>
<P><BR></P>
<CENTER>
<TABLE BORDER>
@ -75,7 +75,7 @@ DISPLAYED_SCREEN_SIZEequ(640/8)*480
<hr width="90%" size="1" noshade>
<div align="center">
<font face="Verdana,sans-serif" size="1">Graphics Programming Black Book &copy; 2001 Michael Abrash</font>
Graphics Programming Black Book &copy; 2001 Michael Abrash
</div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->