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:
parent
9e52de9586
commit
500e7f5654
353 changed files with 5091 additions and 5091 deletions
34
41-03.html
34
41-03.html
|
|
@ -39,12 +39,12 @@
|
|||
<P><B>LISTING 41.3 L41-3.ASM</B></P>
|
||||
<!-- CODE //-->
|
||||
<PRE>
|
||||
; Draws all pixels in list of horizontal lines passed in, in mode 13h, VGA’s
|
||||
; Draws all pixels in list of horizontal lines passed in, in mode 13h, VGA’s
|
||||
; 320x200 256-color mode. Uses REP STOS to fill each line.
|
||||
; ******************************************************************
|
||||
; NOTE: is able to reverse the X coords for a scan line, if necessary, to make
|
||||
; XStart < XEnd. Expects whichever edge is rightmost on any scan line to be in
|
||||
; +1 format; that is, XEnd is 1 greater than rightmost pixel to draw. If
|
||||
; +1 format; that is, XEnd is 1 greater than rightmost pixel to draw. If
|
||||
; XStart == XEnd, nothing is drawn on that scan line.
|
||||
; ******************************************************************
|
||||
; C near-callable as:
|
||||
|
|
@ -75,31 +75,31 @@ Parms ends
|
|||
public _DrawHorizontalLineList
|
||||
align 2
|
||||
_DrawHorizontalLineList proc
|
||||
push bp ;preserve caller’s stack frame
|
||||
push bp ;preserve caller’s stack frame
|
||||
mov bp,sp ;point to our stack frame
|
||||
push si ;preserve caller’s register variables
|
||||
push si ;preserve caller’s register variables
|
||||
push di
|
||||
cld ;make string instructions inc pointers
|
||||
|
||||
mov ax,SCREEN_SEGMENT
|
||||
mov es,ax ;point ES to display memory for REP STOS
|
||||
|
||||
mov si,[bp+HLineListPtr] ;point to the line list
|
||||
mov si,[bp+HLineListPtr] ;point to the line list
|
||||
mov ax,SCREEN_WIDTH ;point to the start of the first scan
|
||||
mul [si+YStart] ; line in which to draw
|
||||
mul [si+YStart] ; line in which to draw
|
||||
mov dx,ax ;ES:DX points to first scan line to draw
|
||||
mov bx,[si+HLinePtr] ;point to the XStart/XEnd descriptor
|
||||
mov bx,[si+HLinePtr] ;point to the XStart/XEnd descriptor
|
||||
; for the first (top) horizontal line
|
||||
mov si,[si+Lngth] ;# of scan lines to draw
|
||||
mov si,[si+Lngth] ;# of scan lines to draw
|
||||
and si,si ;are there any lines to draw?
|
||||
jz FillDone ;no, so we’re done
|
||||
mov al,byte ptr [bp+Color] ;color with which to fill
|
||||
jz FillDone ;no, so we’re done
|
||||
mov al,byte ptr [bp+Color] ;color with which to fill
|
||||
mov ah,al ;duplicate color for STOSW
|
||||
FillLoop:
|
||||
mov di,[bx+XStart] ;left edge of fill on this line
|
||||
mov cx,[bx+XEnd] ;right edge of fill
|
||||
mov di,[bx+XStart] ;left edge of fill on this line
|
||||
mov cx,[bx+XEnd] ;right edge of fill
|
||||
cmp di,cx ;is XStart > XEnd?
|
||||
jle NoSwap ;no, we’re all set
|
||||
jle NoSwap ;no, we’re all set
|
||||
xchg di,cx ;yes, so swap edges
|
||||
NoSwap:
|
||||
sub cx,di ;width of fill on this line
|
||||
|
|
@ -114,7 +114,7 @@ NoSwap:
|
|||
MainFill:
|
||||
shr cx,1 ;# of words in fill
|
||||
rep stosw ;fill as many words as possible
|
||||
adc cx,cx ;1 if there’s an odd trailing byte to
|
||||
adc cx,cx ;1 if there’s an odd trailing byte to
|
||||
; do, 0 otherwise
|
||||
rep stosb ;fill any odd trailing byte
|
||||
LineFillDone:
|
||||
|
|
@ -123,15 +123,15 @@ LineFillDone:
|
|||
dec si ;count off lines to fill
|
||||
jnz FillLoop
|
||||
FillDone:
|
||||
pop di ;restore caller’s register variables
|
||||
pop di ;restore caller’s register variables
|
||||
pop si
|
||||
pop bp ;restore caller’s stack frame
|
||||
pop bp ;restore caller’s stack frame
|
||||
ret
|
||||
_DrawHorizontalLineList endp
|
||||
end
|
||||
</PRE>
|
||||
<!-- END CODE //-->
|
||||
<P>Listing 41.4 is almost identical to Listing 40.1 from Chapter 40. I’ve modified Listing 40.1 to employ the vertical-monotone detection test we’ve been talking about and use the fast vertical-monotone drawing code whenever possible; that’s what Listing 41.4 is. Note well that Listing 40.5 from Chapter 40 is also required in order for this code to link. Listing 41.5 is an appropriately updated version of the POLYGON.H header file.
|
||||
<P>Listing 41.4 is almost identical to Listing 40.1 from Chapter 40. I’ve modified Listing 40.1 to employ the vertical-monotone detection test we’ve been talking about and use the fast vertical-monotone drawing code whenever possible; that’s what Listing 41.4 is. Note well that Listing 40.5 from Chapter 40 is also required in order for this code to link. Listing 41.5 is an appropriately updated version of the POLYGON.H header file.
|
||||
</P><P><BR></P>
|
||||
<CENTER>
|
||||
<TABLE BORDER>
|
||||
|
|
|
|||
Loading…
Reference in a new issue