Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
52
29-04.md
52
29-04.md
|
|
@ -2,13 +2,13 @@
|
|||
[Previous](29-03.html) [Table of Contents](index.html) [Next](29-05.html)
|
||||
------------------------ --------------------------------- --------------------
|
||||
|
||||
How does one go about setting the palette registers? Well, it’s
|
||||
How does one go about setting the palette registers? Well, it's
|
||||
certainly possible to set the palette registers directly by addressing
|
||||
them at registers 0 through 0FH of the Attribute Controller. However,
|
||||
setting the palette registers is a bit tricky—bit 5 of the Attribute
|
||||
Controller Index register must be 0 while the palette registers are
|
||||
written to, and glitches can occur if the updating doesn’t take place
|
||||
during the blanking interval—and besides, it turns out that there’s no
|
||||
written to, and glitches can occur if the updating doesn't take place
|
||||
during the blanking interval—and besides, it turns out that there's no
|
||||
need at all to go straight to the hardware on this one. Conveniently,
|
||||
the EGA BIOS provides us with video function 10H, which supports setting
|
||||
either any one palette register or all 16 palette registers (and the
|
||||
|
|
@ -21,7 +21,7 @@ to. If AL is 1 (subfunction 1), then BH contains the value to set the
|
|||
overscan (border) color to. Finally, if AL is 2 (subfunction 2), then
|
||||
ES:DX points to a 17-byte array containing the values to set palette
|
||||
registers 0-15 and the overscan register to. (For completeness, although
|
||||
it’s unrelated to the palette registers, there is one more subfunction
|
||||
it's unrelated to the palette registers, there is one more subfunction
|
||||
of video function 10H. If AL = 3 (subfunction 3), bit 0 of BL is set to
|
||||
1 to cause bit 7 of text attributes to select blinking, or set to 0 to
|
||||
cause bit 7 of text attributes to select highreverse video.)
|
||||
|
|
@ -44,16 +44,16 @@ produce high-intensity colors. Palette register 6 is set to 14H to
|
|||
produce brown, rather than the yellow that the expected value of 6H
|
||||
would produce.)
|
||||
|
||||
When you run Listing 29.3, you’ll see that the whole screen changes
|
||||
When you run Listing 29.3, you'll see that the whole screen changes
|
||||
color as each new color set is selected. This occurs because most of the
|
||||
pixels on the screen have a value of 0, selecting the background color
|
||||
stored in palette register 0, and we’re reprogramming palette register 0
|
||||
stored in palette register 0, and we're reprogramming palette register 0
|
||||
right along with the other 15 palette registers.
|
||||
|
||||
It’s important to understand that in Listing 29.3 the contents of
|
||||
It's important to understand that in Listing 29.3 the contents of
|
||||
display memory are never changed after initialization. The only change
|
||||
is the mapping from the 4-bit pixel data coming out of display memory to
|
||||
the 6-bit data going to the monitor. For this reason, it’s technically
|
||||
the 6-bit data going to the monitor. For this reason, it's technically
|
||||
inaccurate to speak of bits in display memory as representing colors;
|
||||
more accurately, they represent attributes in the range 0-15, which are
|
||||
mapped to colors 0-3FH by the palette registers.
|
||||
|
|
@ -61,7 +61,7 @@ mapped to colors 0-3FH by the palette registers.
|
|||
**LISTING 29.3 L29-3.ASM**
|
||||
|
||||
; Program to illustrate the color mapping capabilities of the
|
||||
; EGA’s palette registers.
|
||||
; EGA's palette registers.
|
||||
;
|
||||
VGA_SEGMENT equ 0a000h
|
||||
SC_INDEX equ 3c4h ;Sequence Controller Index register
|
||||
|
|
@ -70,16 +70,16 @@ mapped to colors 0-3FH by the palette registers.
|
|||
TOP_BAR equ BAR_HEIGHT*6 ;start the bars down a bit to
|
||||
; leave room for text
|
||||
;
|
||||
stack segment para stack ‘STACK’
|
||||
stack segment para stack ‘STACK'
|
||||
db 512 dup (?)
|
||||
stack ends
|
||||
;
|
||||
Data segment word ‘DATA’
|
||||
KeyMsg db ‘Press any key to see the next color set. ’
|
||||
db ‘There are 64 color sets in all.’
|
||||
Data segment word ‘DATA'
|
||||
KeyMsg db ‘Press any key to see the next color set. '
|
||||
db ‘There are 64 color sets in all.'
|
||||
db 0dh, 0ah, 0ah, 0ah, 0ah
|
||||
db 13 dup (‘ ’), ‘Attribute’
|
||||
db 38 dup (‘ ’), ‘Color$’
|
||||
db 13 dup (‘ '), ‘Attribute'
|
||||
db 38 dup (‘ '), ‘Color$'
|
||||
;
|
||||
; Used to label the attributes of the color bars.
|
||||
;
|
||||
|
|
@ -87,27 +87,27 @@ mapped to colors 0-3FH by the palette registers.
|
|||
x= 0
|
||||
rept 16
|
||||
if x lt 10
|
||||
db ‘0’, x+‘0’, ‘h’, 0ah, 8, 8, 8
|
||||
db ‘0', x+‘0', ‘h', 0ah, 8, 8, 8
|
||||
else
|
||||
db ‘0’, x+‘A’-10, ‘h’, 0ah, 8, 8, 8
|
||||
db ‘0', x+‘A'-10, ‘h', 0ah, 8, 8, 8
|
||||
endif
|
||||
x= x+1
|
||||
endm
|
||||
db ‘$’
|
||||
db ‘$'
|
||||
;
|
||||
; Used to label the colors of the color bars. (Color values are
|
||||
; filled in on the fly.)
|
||||
;
|
||||
ColorNumberslabelbyte
|
||||
rept 16
|
||||
db ‘000h’, 0ah, 8, 8, 8, 8
|
||||
db ‘000h', 0ah, 8, 8, 8, 8
|
||||
endm
|
||||
COLOR_ENTRY_LENGTHequ($-ColorNumbers)/16
|
||||
db ‘$’
|
||||
db ‘$'
|
||||
;
|
||||
CurrentColordb?
|
||||
;
|
||||
; Space for the array of 16 colors we’ll pass to the BIOS, plus
|
||||
; Space for the array of 16 colors we'll pass to the BIOS, plus
|
||||
; an overscan setting of black.
|
||||
;
|
||||
ColorTable db 16 dup (?), 0
|
||||
|
|
@ -133,9 +133,9 @@ mapped to colors 0-3FH by the palette registers.
|
|||
int 21h
|
||||
;
|
||||
; Put up the color bars, one in each of the 16 possible pixel values
|
||||
; (which we’ll call attributes).
|
||||
; (which we'll call attributes).
|
||||
;
|
||||
mov cx,16 ;we’ll put up 16 color bars
|
||||
mov cx,16 ;we'll put up 16 color bars
|
||||
sub al,al ;start with attribute 0
|
||||
BarLoop:
|
||||
push ax
|
||||
|
|
@ -259,10 +259,10 @@ mapped to colors 0-3FH by the palette registers.
|
|||
BinToHexDigit proc near
|
||||
cmp al,9
|
||||
ja IsHex
|
||||
add al,‘0’
|
||||
add al,‘0'
|
||||
ret
|
||||
IsHex:
|
||||
add al,‘A’-10
|
||||
add al,‘A'-10
|
||||
ret
|
||||
BinToHexDigit endp
|
||||
;
|
||||
|
|
@ -281,7 +281,7 @@ mapped to colors 0-3FH by the palette registers.
|
|||
mov al,[CurrentColor] ;start with the current color
|
||||
mov bx,offset ColorNumbers+1
|
||||
;build color number text string on the fly
|
||||
mov cx,16 ;we’ve got 16 colors to do
|
||||
mov cx,16 ;we've got 16 colors to do
|
||||
ColorNumberLoop:
|
||||
pus hax;save the color #
|
||||
and al,3fh;limit to 6-bit color values
|
||||
|
|
|
|||
Loading…
Reference in a new issue