Deduped images

This commit is contained in:
James Gregory 2013-12-30 12:25:34 +11:00
commit 9e52de9586
233 changed files with 128 additions and 128 deletions

View file

@ -37,7 +37,7 @@
</CENTER>
<P><BR></P>
<TABLE WIDTH="100%">
<TD WIDTH="5%" VALIGN="TOP"><IMG SRC="images/29-01i.jpg"><TD WIDTH="95%"><SMALL><I>While these requirements are no problem if you&#146;re simply calling a subroutine in order to save an image from your program, they pose a considerable problem if you&#146;re designing a hot-key operated TSR that can capture a screen image at any time. With the EGA specifically, there&#146;s never any way to tell what state the registers are currently in, since the registers aren&#146;t readable. (More on this issue later in this chapter.) As a result, any TSR that sets the Bit Mask to 0FFH, the Data Rotate register to 0, and so on runs the risk of interfering with the drawing code of the program that&#146;s already running.</I></SMALL>
<TD WIDTH="5%" VALIGN="TOP"><IMG SRC="images/i.jpg"><TD WIDTH="95%"><SMALL><I>While these requirements are no problem if you&#146;re simply calling a subroutine in order to save an image from your program, they pose a considerable problem if you&#146;re designing a hot-key operated TSR that can capture a screen image at any time. With the EGA specifically, there&#146;s never any way to tell what state the registers are currently in, since the registers aren&#146;t readable. (More on this issue later in this chapter.) As a result, any TSR that sets the Bit Mask to 0FFH, the Data Rotate register to 0, and so on runs the risk of interfering with the drawing code of the program that&#146;s already running.</I></SMALL>
</TABLE>
<P>What&#146;s the solution? Frankly, the solution is to get VGA-specific. A TSR designed for the VGA can simply read out and save the state of the registers of interest, program those registers as needed, save the screen image, and restore the original settings. From a programmer&#146;s perspective, readable registers are certainly near the top of the list of things to like about the VGA! The remaining installed base of EGAs is steadily dwindling, and you may be able to ignore it as a market today, as you couldn&#146;t even a year or two ago.
</P>
@ -51,7 +51,7 @@ DISPLAYED_SCREEN_SIZEequ(640/8)*480
</P>
<P>Finally, be aware that the screen capture and restore programs in Listings 29.1 and 29.2 are only appropriate for EGA/VGA modes 0DH, 0EH, 0FH, 010H, and 012H, since they assume a fourconfiguration of EGA/VGA memory. In all text modes and in CGA graphics modes, and in VGA modes 11H and 13H as well, display memory can simply be written to disk and read back as a linear block of memory, just like a normal array.</P>
<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&#146;s no need for any assembly at all when saving an EGA/VGA screen, as long as the high-level language you&#146;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/29-02i.jpg"><TD WIDTH="95%"><SMALL><I>One tip if you&#146;re saving and restoring the screen from a high-level language on an EGA, though: After you&#146;ve completed the save or restore operation, be sure to put any registers that you&#146;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&#146;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&#146;re done.</I></SMALL>
<TABLE WIDTH="100%"><TD WIDTH="5%" VALIGN="TOP"><IMG SRC="images/i.jpg"><TD WIDTH="95%"><SMALL><I>One tip if you&#146;re saving and restoring the screen from a high-level language on an EGA, though: After you&#146;ve completed the save or restore operation, be sure to put any registers that you&#146;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&#146;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&#146;re done.</I></SMALL>
</TABLE>
<H3><A NAME="Heading4"></A><FONT COLOR="#000077">16 Colors out of 64</FONT></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&#146;s a BIOS function that lets you select the mapping of the 16 possible pixel values to the 64 possible colors. Let&#146;s lay out a bit of background before proceeding, however.