Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -5,8 +5,8 @@
This is where it gets a little complicated. In write mode 3 (which
incidentally is not available on the EGA), each byte value that the CPU
writes to the VGA does not get written to display memory. Instead, it
turns into the bit mask. (Actually, it’s ANDed with the Bit Mask
register, and the result becomes the bit mask, but we’ll leave the Bit
turns into the bit mask. (Actually, it's ANDed with the Bit Mask
register, and the result becomes the bit mask, but we'll leave the Bit
Mask register set to 0xFF, so the CPU value will become the bit mask.)
The bit mask selects, on a bit-by-bit basis, between the data in the
latches for each plane (the previously loaded background color, in this
@ -26,24 +26,24 @@ byte to punch holes in the background color provided by the latches,
holes through which the foreground color from the Set/Reset register can
flow. The result is that a single write draws exactly the combination of
foreground and background pixels described by each font byte written by
the CPU. It may help to look at Listing 55.4, which shows The BitMan’s
the CPU. It may help to look at Listing 55.4, which shows The BitMan's
technique in action. And yes, this technique is absolutely worth the
trouble; it’s about three times faster than the fill-then-draw approach
trouble; it's about three times faster than the fill-then-draw approach
described above, and about twice as fast as transparent text. So far as
I know, there is no faster way to draw text on a VGA.
It’s important to note that the BitMan’s technique only works on full
bytes of display memory. There’s no way to clip to finer precision; the
It's important to note that the BitMan's technique only works on full
bytes of display memory. There's no way to clip to finer precision; the
background color will inevitably flood all of the eight destination
pixels that aren’t selected as foreground pixels. This makes The
BitMan’s technique most suitable for monospaced fonts with characters
pixels that aren't selected as foreground pixels. This makes The
BitMan's technique most suitable for monospaced fonts with characters
that are multiples of eight pixels in width, and for drawing to
byte-aligned addresses; the technique can be used in other situations,
but is considerably more difficult to apply.
**LISTING 55.4 L55-4.ASM**
; Demonstrates drawing solid text on the VGA, using the BitMan’s write mode
; Demonstrates drawing solid text on the VGA, using the BitMan's write mode
; 3-based, one-pass technique.
CHAR_HEIGHT equ 8 ;# of scan lines per character (must be <256)
@ -65,9 +65,9 @@ but is considerably more difficult to apply.
LineWidthBytes dw ? ;offset from one scan line to the next
FontPtr dd ? ;pointer to font with which to draw
SampleString label byte
db ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’
db ‘abcdefghijklmnopqrstuvwxyz’
db ‘0123456789!@#$%^&*(),<.>/?;:’,0
db ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ'
db ‘abcdefghijklmnopqrstuvwxyz'
db ‘0123456789!@#$%^&*(),<.>/?;:',0
.code
start:
@ -130,7 +130,7 @@ but is considerably more difficult to apply.
; CharHeight must be set to the height of each character
; FontPtr must be set to the font with which to draw
; LineWidthBytes must be set to the scan line width in bytes
; Don’t count on any registers other than DS, SS, and SP being preserved.
; Don't count on any registers other than DS, SS, and SP being preserved.
; The X coordinate is truncated to a multiple of 8. Characters are
; assumed to be 8 pixels wide.
align 2
@ -144,14 +144,14 @@ but is considerably more difficult to apply.
mul bx ; start offset of initial scan line
add di,ax ;start offset of initial byte
mov ax,SCREEN_SEGMENT
mov es,ax ;ES:DI = offset of initial character’s
mov es,ax ;ES:DI = offset of initial character's
; first scan line
;set up the VGA’s hardware so that we can
;set up the VGA's hardware so that we can
; fill the latches with the background color
mov dx,GC_INDEX
mov ax,(0ffh SHL 8) + BIT_MASK
out dx,ax ;set Bit Mask register to 0xFF (that’s the
; default, but I’m doing this just to make sure
out dx,ax ;set Bit Mask register to 0xFF (that's the
; default, but I'm doing this just to make sure
; you understand that Bit Mask register and
; CPU data are ANDed in write mode 3)
mov ax,(003h SHL 8) + G_MODE
@ -165,17 +165,17 @@ but is considerably more difficult to apply.
mov cl,es:[0ffffh] ;read the background color back into the
; latches; the latches are now filled with
; the background color. The value in CL
; doesn’t matter, we just needed a target
; doesn't matter, we just needed a target
; for the read, so we could load the latches
mov ah,ch ;foreground color
out dx,ax ;set the Set/Reset (drawing) color to the
; foreground color
;we’re ready to draw!
;we're ready to draw!
DrawTextLoop:
lodsb ;next character to draw
and al,al ;end of string?
jz DrawTextDone ;yes
push ds ;remember string’s segment
push ds ;remember string's segment
push si ;remember offset of next character in string
push di ;remember drawing offset
;load these variables before we wipe out DS
@ -200,7 +200,7 @@ but is considerably more difficult to apply.
pop di ;retrieve initial drawing offset
inc di ;drawing offset for next char
pop si ;retrieve offset of next character in string
pop ds ;retrieve string’s segment
pop ds ;retrieve string's segment
jmp DrawTextLoop ;draw next character, if any
align2