Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
26
27-02.md
26
27-02.md
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#### Copying Chunky Bitmaps to VGA Memory Using Write Mode 2 {#Heading5}
|
||||
|
||||
Let’s take a look at two examples of write mode 2 in action. Listing
|
||||
Let's take a look at two examples of write mode 2 in action. Listing
|
||||
27.1 presents a program that uses write mode 2 to copy a graphics image
|
||||
in chunky format to the VGA. In chunky format adjacent bits in a single
|
||||
byte make up each pixel: mode 4 of the CGA, EGA, and VGA is a
|
||||
|
|
@ -25,7 +25,7 @@ discussed in Chapter 25, the bit mask makes it possible to narrow the
|
|||
effect of the CPU write down to a single pixel.
|
||||
|
||||
Given the above, conversion of a chunky 4-bit-per-pixel bitmap to the
|
||||
VGA’s planar format in write mode 2 is trivial. First, the Bit Mask
|
||||
VGA's planar format in write mode 2 is trivial. First, the Bit Mask
|
||||
register is set to allow only the VGA display memory bits corresponding
|
||||
to the leftmost chunky pixel of the two stored in the first chunky
|
||||
bitmap byte to be modified. Next, the destination byte in display memory
|
||||
|
|
@ -45,14 +45,14 @@ image.
|
|||
**LISTING 27.1 L27-1.ASM**
|
||||
|
||||
; Program to illustrate one use of write mode 2 of the VGA and EGA by
|
||||
; animating the image of an “A” drawn by copying it from a chunky
|
||||
; animating the image of an "A" drawn by copying it from a chunky
|
||||
; bit-map in system memory to a planar bit-map in VGA or EGA memory.
|
||||
;
|
||||
; Assemble with MASM or TASM
|
||||
;
|
||||
; By Michael Abrash
|
||||
;
|
||||
Stack segment para stack ‘STACK’
|
||||
Stack segment para stack ‘STACK'
|
||||
db 512 dup(0)
|
||||
Stack ends
|
||||
|
||||
|
|
@ -64,15 +64,15 @@ image.
|
|||
GRAPHICS_MODE equ 5 ;index of Graphics Mode reg
|
||||
BIT_MASKequ 8 ;index of Bit Mask reg
|
||||
|
||||
Data segment para common ‘DATA’
|
||||
Data segment para common ‘DATA'
|
||||
;
|
||||
; Current location of “A” as it is animated across the screen.
|
||||
; Current location of "A" as it is animated across the screen.
|
||||
;
|
||||
CurrentX dw ?
|
||||
CurrentY dw ?
|
||||
RemainingLength dw ?
|
||||
;
|
||||
; Chunky bit-map image of a yellow “A” on a bright blue background
|
||||
; Chunky bit-map image of a yellow "A" on a bright blue background
|
||||
;
|
||||
AImage label byte
|
||||
dw 13, 13 ;width, height in pixels
|
||||
|
|
@ -91,7 +91,7 @@ image.
|
|||
db 000h, 000h, 000h, 000h, 000h, 000h, 000h
|
||||
Data ends
|
||||
|
||||
Code segment para public ‘CODE’
|
||||
Code segment para public ‘CODE'
|
||||
assume cs:Code, ds:Data
|
||||
Start proc near
|
||||
mov ax,Data
|
||||
|
|
@ -105,7 +105,7 @@ image.
|
|||
mov [CurrentY],200
|
||||
mov [RemainingLength],600 ;move 600 times
|
||||
;
|
||||
; Animate, repeating RemainingLength times. It’s unnecessary to erase
|
||||
; Animate, repeating RemainingLength times. It's unnecessary to erase
|
||||
; the old image, since the one pixel of blank fringe around the image
|
||||
; erases the part of the old image not overlapped by the new image.
|
||||
;
|
||||
|
|
@ -113,10 +113,10 @@ image.
|
|||
mov bx,[CurrentX]
|
||||
mov cx,[CurrentY]
|
||||
mov si,offset AImage
|
||||
call DrawFromChunkyBitmap ;draw the “A” image
|
||||
call DrawFromChunkyBitmap ;draw the "A" image
|
||||
inc [CurrentX] ;move one pixel to the right
|
||||
|
||||
mov cx,0 ;delay so we don’t move the
|
||||
mov cx,0 ;delay so we don't move the
|
||||
DelayLoop: ; image too fast; adjust as
|
||||
; needed
|
||||
loop DelayLoop
|
||||
|
|
@ -207,7 +207,7 @@ image.
|
|||
inc dx ; to the Bit Mask register
|
||||
RowLoop:
|
||||
|
||||
push ax ;preserve the left column’s bit mask
|
||||
push ax ;preserve the left column's bit mask
|
||||
push cx ;preserve the width
|
||||
push di ;preserve the destination offset
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ image.
|
|||
CheckMoreScanLines:
|
||||
pop di ;get back the destination offset
|
||||
pop cx ;get back the width
|
||||
pop ax ;get back the left column’s bit mask
|
||||
pop ax ;get back the left column's bit mask
|
||||
add di,SCREEN_WIDTH_IN_BYTES
|
||||
;point to the start of the next scan
|
||||
; line of the image
|
||||
|
|
|
|||
Loading…
Reference in a new issue