Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
14
57-04.md
14
57-04.md
|
|
@ -7,13 +7,13 @@ draws across each destination scan line, near the end of the listing.
|
|||
One optimization is elimination of the call to the set-pixel routine
|
||||
used to draw each pixel in Listing 57.1. Function calls are expensive
|
||||
operations, to be avoided when performance matters. Also, although Mode
|
||||
X (the undocumented 320x240 256-color VGA mode X-Sharp runs in) doesn’t
|
||||
X (the undocumented 320x240 256-color VGA mode X-Sharp runs in) doesn't
|
||||
lend itself well to pixel-oriented operations like line drawing or
|
||||
texture mapping, the inner loop has been set up to minimize Mode X’s
|
||||
texture mapping, the inner loop has been set up to minimize Mode X's
|
||||
overhead. A rotating plane mask is maintained in AL, with DX pointing to
|
||||
the Map Mask register; thus, only a rotate and an **OUT** are required
|
||||
to select the plane to which to write, cycling from plane 0 through
|
||||
plane 3 and wrapping back to 0. Better yet, because we know that we’re
|
||||
plane 3 and wrapping back to 0. Better yet, because we know that we're
|
||||
simply stepping horizontally across the destination scan line, we can
|
||||
use a clever optimization to both step the destination and reduce the
|
||||
overhead of maintaining the mask. Two copies of the current plane mask
|
||||
|
|
@ -42,7 +42,7 @@ efficient in Listing 57.1, consisting of only two adds and the macro
|
|||
take four instructions apiece, and the macro hides not only conversion
|
||||
from fixed-point to integer, but also a time-consuming multiplication.
|
||||
Incremental approaches are excellent at avoiding multiplication, because
|
||||
cumulative additions can often replace multiplication. That’s the case
|
||||
cumulative additions can often replace multiplication. That's the case
|
||||
with stepping through the source texture in Listing 57.2; ten
|
||||
instructions, with a maximum of two branches, replace all the texture
|
||||
calculations of Listing 57.1. Listing 57.2 simply detects when the
|
||||
|
|
@ -55,14 +55,14 @@ worth the trouble? Indeed it is. Listing 57.2 is more than twice as fast
|
|||
as Listing 57.1, and the difference is very noticeable when large,
|
||||
texture-mapped areas are animated. Whether more than doubling
|
||||
performance is significant is a matter of opinion, I suppose, but
|
||||
imagine that you’re in William Gibson’s *Neuromancer*, trying to crack a
|
||||
imagine that you're in William Gibson's *Neuromancer*, trying to crack a
|
||||
corporate database. Which texture-mapping routine would you rather have
|
||||
interfacing you to Cyberspace?
|
||||
|
||||
I’m always interested in getting your feedback on and hearing about
|
||||
I'm always interested in getting your feedback on and hearing about
|
||||
potential improvements to X-Sharp. Contact me through the publisher.
|
||||
There is no truth to the rumor that I can be reached under the alias
|
||||
“sheep-shearer,” at least not for another 9,999 sheep.
|
||||
"sheep-shearer," at least not for another 9,999 sheep.
|
||||
|
||||
------------------------ --------------------------------- --------------------
|
||||
[Previous](57-03.html) [Table of Contents](index.html) [Next](58-01.html)
|
||||
|
|
|
|||
Loading…
Reference in a new issue