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
48
47-07.html
48
47-07.html
|
|
@ -74,35 +74,35 @@ RightClipPlaneMask db 00fh,001h,003h,007h
|
|||
.code
|
||||
public _FillRectangleX
|
||||
_FillRectangleX proc near
|
||||
push bp ;preserve caller’s stack frame
|
||||
push bp ;preserve caller’s stack frame
|
||||
mov bp,sp ;point to local stack frame
|
||||
push si ;preserve caller’s register variables
|
||||
push si ;preserve caller’s register variables
|
||||
push di
|
||||
|
||||
cld
|
||||
mov ax,SCREEN_WIDTH
|
||||
mul [bp+StartY] ;offset in page of top rectangle scan line
|
||||
mov di,[bp+StartX]
|
||||
mul [bp+StartY] ;offset in page of top rectangle scan line
|
||||
mov di,[bp+StartX]
|
||||
shr di,1 ;X/4 = offset of first rectangle pixel in scan
|
||||
shr di,1 ; line
|
||||
add di,ax ;offset of first rectangle pixel in page
|
||||
add di,[bp+PageBase] ;offset of first rectangle pixel in
|
||||
add di,[bp+PageBase] ;offset of first rectangle pixel in
|
||||
; display memory
|
||||
mov ax,SCREEN_SEG ;point ES:DI to the first rectangle
|
||||
mov es,ax ; pixel’s address
|
||||
mov es,ax ; pixel’s address
|
||||
mov dx,SC_INDEX ;set the Sequence Controller Index to
|
||||
mov al,MAP_MASK ; point to the Map Mask register
|
||||
out dx,al
|
||||
inc dx ;point DX to the SC Data register
|
||||
mov si,[bp+StartX]
|
||||
mov si,[bp+StartX]
|
||||
and si,0003h ;look up left edge plane mask
|
||||
mov bh,LeftClipPlaneMask[si]; to clip & put in BH
|
||||
mov si,[bp+EndX]
|
||||
mov si,[bp+EndX]
|
||||
and si,0003h ;look up right edge plane
|
||||
mov bl,RightClipPlaneMask[si]; mask to clip & put in BL
|
||||
|
||||
mov cx,[bp+EndX] ;calculate # of addresses across rect
|
||||
mov si,[bp+StartX]
|
||||
mov cx,[bp+EndX] ;calculate # of addresses across rect
|
||||
mov si,[bp+StartX]
|
||||
cmp cx,si
|
||||
jle FillDone ;skip if 0 or negative width
|
||||
dec cx
|
||||
|
|
@ -110,15 +110,15 @@ _FillRectangleX proc near
|
|||
sub cx,si
|
||||
shr cx,1
|
||||
shr cx,1 ;# of addresses across rectangle to fill - 1
|
||||
jnz MasksSet ;there’s more than one byte to draw
|
||||
and bh,bl ;there’s only one byte, so combine the left-
|
||||
jnz MasksSet ;there’s more than one byte to draw
|
||||
and bh,bl ;there’s only one byte, so combine the left-
|
||||
; and right-edge clip masks
|
||||
MasksSet:
|
||||
mov si,[bp+EndY]
|
||||
sub si,[bp+StartY] ;BX = height of rectangle
|
||||
mov si,[bp+EndY]
|
||||
sub si,[bp+StartY] ;BX = height of rectangle
|
||||
jle FillDone ;skip if 0 or negative height
|
||||
mov ah,byte ptr [bp+Color] ;color with which to fill
|
||||
mov bp,SCREEN_WIDTH ;stack frame isn’t needed any more
|
||||
mov ah,byte ptr [bp+Color] ;color with which to fill
|
||||
mov bp,SCREEN_WIDTH ;stack frame isn’t needed any more
|
||||
sub bp,cx ;distance from end of one scan line to start
|
||||
dec bp ; of next
|
||||
FillRowsLoop:
|
||||
|
|
@ -128,7 +128,7 @@ FillRowsLoop:
|
|||
mov al,ah ;put color in AL
|
||||
stosb ;draw the left edge
|
||||
dec cx ;count off left edge byte
|
||||
js FillLoopBottom ;that’s the only byte
|
||||
js FillLoopBottom ;that’s the only byte
|
||||
jz DoRightEdge ;there are only two bytes
|
||||
mov al,00fh ;middle addresses are drawn 4 pixels at a pop
|
||||
out dx,al ;set the middle pixel mask to no clip
|
||||
|
|
@ -146,17 +146,17 @@ FillLoopBottom:
|
|||
dec si ;count down scan lines
|
||||
jnz FillRowsLoop
|
||||
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
|
||||
_FillRectangleX endp
|
||||
end
|
||||
</PRE>
|
||||
<!-- END CODE //-->
|
||||
<P>Just so you can see Mode X in action, Listing 47.7 is a sample program that selects Mode X and draws a number of rectangles. Listing 47.7 links to any of the rectangle fill routines I’ve presented.
|
||||
<P>Just so you can see Mode X in action, Listing 47.7 is a sample program that selects Mode X and draws a number of rectangles. Listing 47.7 links to any of the rectangle fill routines I’ve presented.
|
||||
</P>
|
||||
<P>And now, I hope, you’re beginning to see why I’m so fond of Mode X. In the next chapter, we’ll continue with Mode X by exploring the wonders that the latches and parallel plane hardware can work on scrolls, copies, blits, and pattern fills.</P>
|
||||
<P>And now, I hope, you’re beginning to see why I’m so fond of Mode X. In the next chapter, we’ll continue with Mode X by exploring the wonders that the latches and parallel plane hardware can work on scrolls, copies, blits, and pattern fills.</P>
|
||||
<P><B>LISTING 47.7 L47-7.C</B></P>
|
||||
<!-- CODE //-->
|
||||
<PRE>
|
||||
|
|
@ -175,9 +175,9 @@ void main() {
|
|||
|
||||
Set320x240Mode();
|
||||
FillRectangleX(0,0,320,240,0,0); /* clear the screen to black */
|
||||
for (j = 1; j < 220; j += 21) {
|
||||
for (i = 1; i < 300; i += 21) {
|
||||
FillRectangleX(i, j, i+20, j+20, 0, ((j/21*15)+i/21) & 0xFF);
|
||||
for (j = 1; j < 220; j += 21) {
|
||||
for (i = 1; i < 300; i += 21) {
|
||||
FillRectangleX(i, j, i+20, j+20, 0, ((j/21*15)+i/21) & 0xFF);
|
||||
}
|
||||
}
|
||||
getch();
|
||||
|
|
|
|||
Loading…
Reference in a new issue