Replace invalid characters with HTML entities

— with —
’ with ’
+ with +
× with x
ç with ç
“ with “
” with ”
‘ with ‘
• with •
– with -
µ with µ
† with †
Fix C++
θ with θ
Yen symbol instead of times
Fix broken apos
Bullet again
E-circumflex
This commit is contained in:
James Gregory 2013-12-30 12:50:32 +11:00
commit 500e7f5654
353 changed files with 5091 additions and 5091 deletions

View file

@ -36,12 +36,12 @@
</TABLE>
</CENTER>
<P><BR></P>
<P>Listing 48.3 has an important limitation: It does not guarantee proper handling when the source and destination overlap, as in the case of a downward scroll, for example. Listing 48.3 performs top-to-bottom, left-to-right copying. Downward scrolls require bottom-to-top copying; likewise, rightward horizontal scrolls require right-to-left copying. As it happens, my intended use for Listing 48.3 is to copy images between off-screen memory and on-screen memory, and to save areas under pop-up menus and the like, so I don&#146;t really need overlap handling&#151;and I do really need to keep the complexity of this discussion down. However, you will surely want to add overlap handling if you plan to perform arbitrary scrolling and copying in display memory.
<P>Listing 48.3 has an important limitation: It does not guarantee proper handling when the source and destination overlap, as in the case of a downward scroll, for example. Listing 48.3 performs top-to-bottom, left-to-right copying. Downward scrolls require bottom-to-top copying; likewise, rightward horizontal scrolls require right-to-left copying. As it happens, my intended use for Listing 48.3 is to copy images between off-screen memory and on-screen memory, and to save areas under pop-up menus and the like, so I don&rsquo;t really need overlap handling&mdash;and I do really need to keep the complexity of this discussion down. However, you will surely want to add overlap handling if you plan to perform arbitrary scrolling and copying in display memory.
</P>
<P>Now that we have a fast way to copy images around in display memory, we can draw icons and other images as much as four times faster than in mode 13H, depending on the speed of the VGA&#146;s display memory. (In case you&#146;re worried about the nibble-alignment limitation on fast copies, don&#146;t be; I&#146;ll address that fully in due time, but the secret is to store all four possible rotations in off-screen memory, then select the correct one for each copy.) However, before our fast display memory-to-display memory copy routine can do us any good, we must have a way to get pixel patterns from system memory into display memory, so that they can then be copied with the fast copy routine.</P>
<P>Now that we have a fast way to copy images around in display memory, we can draw icons and other images as much as four times faster than in mode 13H, depending on the speed of the VGA&rsquo;s display memory. (In case you&rsquo;re worried about the nibble-alignment limitation on fast copies, don&rsquo;t be; I&rsquo;ll address that fully in due time, but the secret is to store all four possible rotations in off-screen memory, then select the correct one for each copy.) However, before our fast display memory-to-display memory copy routine can do us any good, we must have a way to get pixel patterns from system memory into display memory, so that they can then be copied with the fast copy routine.</P>
<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Copying to Display Memory</FONT></H4>
<P>The final piece of the puzzle is the system memory to display-memory-copy-routine shown in Listing 48.4. This routine assumes that pixels are stored in system memory in exactly the order in which they will ultimately appear on the screen; that is, in the same linear order that mode 13H uses. It would be more efficient to store all the pixels for one plane first, then all the pixels for the next plane, and so on for all four planes, because many <B>OUT</B>s could be avoided, but that would make images rather hard to create. And, while it is true that the speed of drawing images is, in general, often a critical performance factor, the speed of copying images from system memory to display memory is not particularly critical in Mode X. Important images can be stored in off-screen memory and copied to the screen via the latches much faster than even the speediest system memory-to-display memory copy routine could manage.</P>
<P>I&#146;m not going to present a routine to perform Mode X copies from display memory to system memory, but such a routine would be a straightforward inverse of Listing 48.4.</P>
<P>I&rsquo;m not going to present a routine to perform Mode X copies from display memory to system memory, but such a routine would be a straightforward inverse of Listing 48.4.</P>
<P><B>LISTING 48.4 L48-4.ASM</B></P>
<!-- CODE //-->
<PRE>
@ -90,10 +90,10 @@ STACK_FRAME_SIZE equ 4
.code
public _CopySystemToScreenX
_CopySystemToScreenX proc near
push bp ;preserve caller&#146;s stack frame
push bp ;preserve caller&rsquo;s stack frame
mov bp,sp ;point to local stack frame
sub sp,STACK_FRAME_SIZE ;allocate space for local vars
push si ;preserve caller&#146;s register variables
push si ;preserve caller&rsquo;s register variables
push di
cld
@ -117,10 +117,10 @@ _CopySystemToScreenX proc near
add di,ax ;offset of first dest rect pixel in page
add di,[bp+DestPageBase] ;offset of first dest rect pixel
; in display memory
and cl,011b ;CL = first dest pixel&#146;s plane
and cl,011b ;CL = first dest pixel&rsquo;s plane
mov al,11h ;upper nibble comes into play when
; plane wraps from 3 back to 0
shl al,cl ;set the bit for the first dest pixel&#146;s
shl al,cl ;set the bit for the first dest pixel&rsquo;s
mov [bp+LeftMask],al ; plane in each nibble to 1
mov cx,[bp+SourceEndX] ;calculate # of pixels across
@ -142,7 +142,7 @@ CopyRowsLoop:
CopyScanLineLoop:
out dx,al ;set the plane for this pixel
movsb ;copy the pixel to the screen
rol al,1 ;set mask for next pixel&#146;s plane
rol al,1 ;set mask for next pixel&rsquo;s plane
cmc ;advance destination address only when
sbb di,0 ; wrapping from plane 3 to plane 0
; (else undo INC DI done by MOVSB)
@ -156,18 +156,18 @@ CopyScanLineLoop:
dec bx ;count down scan lines
jnz CopyRowsLoop
CopyDone:
pop di ;restore caller&#146;s register variables
pop di ;restore caller&rsquo;s register variables
pop si
mov sp,bp ;discard storage for local variables
pop bp ;restore caller&#146;s stack frame
pop bp ;restore caller&rsquo;s stack frame
ret
_CopySystemToScreenX endp
end
</PRE>
<!-- END CODE //-->
<H3><A NAME="Heading6"></A><FONT COLOR="#000077">Who Was that Masked Image Copier?</FONT></H3>
<P>At this point, it&#146;s getting to be time for us to take all the Mode X tools we&#146;ve developed, together with one more tool&#151;masked image copying&#151;and the remaining unexplored feature of Mode X, page flipping, and build an animation application. I hope that when we&#146;re done, you&#146;ll agree with me that Mode X is <I>the</I> way to animate on the PC.</P>
<P>In truth, though, it matters less whether or not <I>you</I> think that Mode X is the best way to animate than whether or not your users think it&#146;s the best way based on results; end users care only about results, not how you produced them. For my writing, you folks are the end users&#151;and notice how remarkably little you care about how this book gets written and produced. You care that it turned up in the bookstore, and you care about the contents, but you sure as heck don&#146;t care about how it got that far from a bin of tree pulp. When you&#146;re a creator, the process matters. When you&#146;re a buyer, results are everything. All important. <I>Sine qua non.</I> The whole enchilada.</P>
<P>At this point, it&rsquo;s getting to be time for us to take all the Mode X tools we&rsquo;ve developed, together with one more tool&mdash;masked image copying&mdash;and the remaining unexplored feature of Mode X, page flipping, and build an animation application. I hope that when we&rsquo;re done, you&rsquo;ll agree with me that Mode X is <I>the</I> way to animate on the PC.</P>
<P>In truth, though, it matters less whether or not <I>you</I> think that Mode X is the best way to animate than whether or not your users think it&rsquo;s the best way based on results; end users care only about results, not how you produced them. For my writing, you folks are the end users&mdash;and notice how remarkably little you care about how this book gets written and produced. You care that it turned up in the bookstore, and you care about the contents, but you sure as heck don&rsquo;t care about how it got that far from a bin of tree pulp. When you&rsquo;re a creator, the process matters. When you&rsquo;re a buyer, results are everything. All important. <I>Sine qua non.</I> The whole enchilada.</P>
<P>If you catch my drift.</P><P><BR></P>
<CENTER>
<TABLE BORDER>