Deduped images
This commit is contained in:
parent
4eef8b2919
commit
9e52de9586
233 changed files with 128 additions and 128 deletions
|
|
@ -60,7 +60,7 @@ MOV DX,(VALUE2 SHL 8) OR VALUE1
|
|||
</PRE>
|
||||
<!-- END CODE SNIP //-->
|
||||
<P>which takes only three bytes and is faster, being a single instruction. (Note, though, that in 32-bit protected mode, there’s a size and performance penalty for 16-bit instructions such as the <B>MOV</B> above; see the first part of this book for details.) As shown, a macro is an ideal place to use this technique; the macro invocation can refer to two separate byte values, making matters easier for the programmer, while the macro itself can combine the values into a single word-sized constant.</P>
|
||||
<TABLE WIDTH="100%"><TD VALIGN="TOP" ALIGN="LEFT" WIDTH="5%"><IMG SRC="images/24-01i.jpg"><TD VALIGN="TOP" ALIGN="LEFT" WIDTH="95%"><SMALL><I>A minor optimization tip illustrated in the listing is the use of <B>INC AX</B> and <B>DEC AX</B> in the <B>DrawVerticalBox</B> subroutine when only AL actually needs to be modified. Word-sized register increment and decrement instructions (or dword-sized instructions in 32-bit protected mode) are only one byte long, while byte-size register increment and decrement instructions are two bytes long. Consequently, when size counts, it is worth using a whole 16-bit (or 32-bit) register instead of the low 8 bits of that register for <B>INC</B> and <B>DEC</B>—if you don’t need the upper portion of the register for any other purpose, or if you can be sure that the <B>INC</B> or <B>DEC</B> won’t affect the upper part of the register.</I></SMALL>
|
||||
<TABLE WIDTH="100%"><TD VALIGN="TOP" ALIGN="LEFT" WIDTH="5%"><IMG SRC="images/i.jpg"><TD VALIGN="TOP" ALIGN="LEFT" WIDTH="95%"><SMALL><I>A minor optimization tip illustrated in the listing is the use of <B>INC AX</B> and <B>DEC AX</B> in the <B>DrawVerticalBox</B> subroutine when only AL actually needs to be modified. Word-sized register increment and decrement instructions (or dword-sized instructions in 32-bit protected mode) are only one byte long, while byte-size register increment and decrement instructions are two bytes long. Consequently, when size counts, it is worth using a whole 16-bit (or 32-bit) register instead of the low 8 bits of that register for <B>INC</B> and <B>DEC</B>—if you don’t need the upper portion of the register for any other purpose, or if you can be sure that the <B>INC</B> or <B>DEC</B> won’t affect the upper part of the register.</I></SMALL>
|
||||
</TABLE>
|
||||
<P>The latches and ALUs are central to high-performance VGA code, since they allow programs to process across all four memory planes without a series of <B>OUT</B>s and read/write operations. It is not always easy to arrange a program to exploit this power, however, because the ALUs are far more limited than a CPU. In many instances, however, additional hardware in the VGA, including the bit mask, the set/reset features, and the barrel shifter, can assist the ALUs in controlling data, as we’ll see in the next few chapters.</P><P><BR></P>
|
||||
<CENTER>
|
||||
|
|
|
|||
Loading…
Reference in a new issue