Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
42
47-03.md
42
47-03.md
|
|
@ -3,18 +3,18 @@
|
|||
------------------------ --------------------------------- --------------------
|
||||
|
||||
After setting up mode 13H, Listing 47.1 alters the vertical counts and
|
||||
timings to select 480 visible scan lines. (There’s no need to alter any
|
||||
timings to select 480 visible scan lines. (There's no need to alter any
|
||||
horizontal values, because mode 13H and Mode X both have 320-pixel
|
||||
horizontal resolutions.) The Maximum Scan Line register is programmed to
|
||||
double scan each line (that is, repeat each scan line twice), however,
|
||||
so we get an effective vertical resolution of 240 scan lines. It is, in
|
||||
fact, possible to get 400 or 480 independent scan lines in 256-color
|
||||
mode, as discussed in Chapter 31 and 32; however, 400-scan-line modes
|
||||
lack square pixels and can’t support simultaneous off-screen memory and
|
||||
lack square pixels and can't support simultaneous off-screen memory and
|
||||
page flipping. Furthermore, 480-scan-line modes lack page flipping
|
||||
altogether, due to memory constraints.
|
||||
|
||||
At the same time, Listing 47.1 programs the VGA’s bitmap to a planar
|
||||
At the same time, Listing 47.1 programs the VGA's bitmap to a planar
|
||||
organization that is similar to that used by the 16-color modes, and
|
||||
utterly different from the linear bitmap of mode 13H. The bizarre bitmap
|
||||
organization of Mode X is shown in Figure 47.1. The first pixel (the
|
||||
|
|
@ -42,11 +42,11 @@ written, and likewise for the read pixel code shown in Listing 47.3.
|
|||
Calculating and mapping in a plane once for each pixel written is
|
||||
scarcely a recipe for performance.
|
||||
|
||||
That’s all right, though, because most graphics software spends little
|
||||
time drawing individual pixels. I’ve provided the write and read pixel
|
||||
routines as basic primitives, and so you’ll understand how the bitmap is
|
||||
That's all right, though, because most graphics software spends little
|
||||
time drawing individual pixels. I've provided the write and read pixel
|
||||
routines as basic primitives, and so you'll understand how the bitmap is
|
||||
organized, but the building blocks of high-performance graphics software
|
||||
are fills, copies, and bitblts, and it’s there that Mode X shines.
|
||||
are fills, copies, and bitblts, and it's there that Mode X shines.
|
||||
|
||||
\
|
||||
**Figure 47.1** *Mode X display memory organization.*
|
||||
|
|
@ -78,30 +78,30 @@ are fills, copies, and bitblts, and it’s there that Mode X shines.
|
|||
.code
|
||||
public _WritePixelX
|
||||
_WritePixelX proc near
|
||||
push bp ;preserve caller’s stack frame
|
||||
push bp ;preserve caller's stack frame
|
||||
mov bp,sp ;point to local stack frame
|
||||
|
||||
mov ax,SCREEN_WIDTH
|
||||
mul [bp+Y] ;offset of pixel’s scan line in page
|
||||
mul [bp+Y] ;offset of pixel's scan line in page
|
||||
mov bx,[bp+X]
|
||||
shr bx,1
|
||||
shr bx,1 ;X/4 = offset of pixel in scan line
|
||||
add bx,ax ;offset of pixel in page
|
||||
add bx,[bp+PageBase] ;offset of pixel in display memory
|
||||
mov ax,SCREEN_SEG
|
||||
mov es,ax ;point ES:BX to the pixel’s address
|
||||
mov es,ax ;point ES:BX to the pixel's address
|
||||
|
||||
mov cl,byte ptr [bp+X]
|
||||
and cl,011b ;CL = pixel’s plane
|
||||
and cl,011b ;CL = pixel's plane
|
||||
mov ax,0100h + MAP_MASK ;AL = index in SC of Map Mask reg
|
||||
shl ah,cl ;set only the bit for the pixel’s plane to 1
|
||||
shl ah,cl ;set only the bit for the pixel's plane to 1
|
||||
mov dx,SC_INDEX ;set the Map Mask to enable only the
|
||||
out dx,ax ; pixel’s plane
|
||||
out dx,ax ; pixel's plane
|
||||
|
||||
mov al,byte ptr [bp+Color]
|
||||
mov es:[bx],al ;draw the pixel in the desired color
|
||||
|
||||
pop bp ;restore caller’s stack frame
|
||||
pop bp ;restore caller's stack frame
|
||||
ret
|
||||
_WritePixelX endp
|
||||
end
|
||||
|
|
@ -131,29 +131,29 @@ are fills, copies, and bitblts, and it’s there that Mode X shines.
|
|||
.code
|
||||
public _ReadPixelX
|
||||
_ReadPixelX proc near
|
||||
push bp ;preserve caller’s stack frame
|
||||
push bp ;preserve caller's stack frame
|
||||
mov bp,sp ;point to local stack frame
|
||||
|
||||
mov ax,SCREEN_WIDTH
|
||||
mul [bp+Y] ;offset of pixel’s scan line in page
|
||||
mul [bp+Y] ;offset of pixel's scan line in page
|
||||
mov bx,[bp+X]
|
||||
shr bx,1
|
||||
shr bx,1 ;X/4 = offset of pixel in scan line
|
||||
add bx,ax ;offset of pixel in page
|
||||
add bx,[bp+PageBase] ;offset of pixel in display memory
|
||||
mov ax,SCREEN_SEG
|
||||
mov es,ax ;point ES:BX to the pixel’s address
|
||||
mov es,ax ;point ES:BX to the pixel's address
|
||||
|
||||
mov ah,byte ptr [bp+X]
|
||||
and ah,011b ;AH = pixel’s plane
|
||||
and ah,011b ;AH = pixel's plane
|
||||
mov al,READ_MAP ;AL = index in GC of the Read Map reg
|
||||
mov dx,GC_INDEX ;set the Read Map to read the pixel’s
|
||||
mov dx,GC_INDEX ;set the Read Map to read the pixel's
|
||||
out dx,ax ; plane
|
||||
|
||||
mov al,es:[bx] ;read the pixel’s color
|
||||
mov al,es:[bx] ;read the pixel's color
|
||||
sub ah,ah ;convert it to an unsigned int
|
||||
|
||||
pop bp ;restore caller’s stack frame
|
||||
pop bp ;restore caller's stack frame
|
||||
ret
|
||||
_ReadPixelX endp
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue