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
34
27-05.html
34
27-05.html
|
|
@ -36,10 +36,10 @@
|
|||
</TABLE>
|
||||
</CENTER>
|
||||
<P><BR></P>
|
||||
<P>Another interesting point about flipping from graphics to text and back is that the standard mode 3 character/attribute map doesn’t actually take up every byte of the first 4000 bytes of planes 0 and 1. The standard mode 3 character/attribute map actually only takes up every even byte of the first 4000 in each plane; the odd bytes are left untouched. This means that only about 12K bytes actually have to be saved when going to text mode. The code in Listing 27.3 flips from graphics mode to text mode and back, saving only those 12K bytes that actually have to be saved. This code saves and restores the first 8K of plane 2 (the font area) while in graphics mode, but performs the save and restore of the 4000 bytes used for the character/attribute map while in text mode, because the characters and attributes, which are actually stored in the even bytes of planes 0 and 1, respectively, appear to be contiguous bytes in memory in text mode and so are easily saved as a single block.
|
||||
<P>Another interesting point about flipping from graphics to text and back is that the standard mode 3 character/attribute map doesn’t actually take up every byte of the first 4000 bytes of planes 0 and 1. The standard mode 3 character/attribute map actually only takes up every even byte of the first 4000 in each plane; the odd bytes are left untouched. This means that only about 12K bytes actually have to be saved when going to text mode. The code in Listing 27.3 flips from graphics mode to text mode and back, saving only those 12K bytes that actually have to be saved. This code saves and restores the first 8K of plane 2 (the font area) while in graphics mode, but performs the save and restore of the 4000 bytes used for the character/attribute map while in text mode, because the characters and attributes, which are actually stored in the even bytes of planes 0 and 1, respectively, appear to be contiguous bytes in memory in text mode and so are easily saved as a single block.
|
||||
</P>
|
||||
<P>Explaining why only every other byte of planes 0 and 1 is used in text mode and why characters and attributes appear to be contiguous bytes when they are actually in different planes is a large part of the explanation I’m not going to go into now. One bit of fallout from this, however, is that if you flip to text mode and preserve the graphics bitmap using the mechanism illustrated in Listing 27.3, you shouldn’t write to any text page other than page 0 (that is, don’t write to any offset in display memory above 3999 in text mode) or alter the Page Select bit in the Miscellaneous Output register (3C2H) while in text mode. In order to allow completely unfettered access to text pages, it would be necessary to save every byte in the first 32K of each of planes 0 and 1. (On the other hand, this <I>would</I> allow up to 16 text screens to be stored simultaneously, with any one displayable instantly.) Moreover, if any fonts other than the default font are loaded, the portions of plane 2 that those particular fonts are loaded into would have to be saved, up to a maximum of all 64K of plane 2. In the worst case, a full 128K would have to be saved in order to preserve all the memory potentially used by text mode.</P>
|
||||
<P>As I said, Phil Coleman’s question is an interesting one, and I’ve only touched on the intriguing possibilities arising from the various configurations of display memory in VGA graphics and text modes. Right now, though, we’ve still got the basics of the remarkably complex (but rewarding!) VGA to cover.</P>
|
||||
<P>Explaining why only every other byte of planes 0 and 1 is used in text mode and why characters and attributes appear to be contiguous bytes when they are actually in different planes is a large part of the explanation I’m not going to go into now. One bit of fallout from this, however, is that if you flip to text mode and preserve the graphics bitmap using the mechanism illustrated in Listing 27.3, you shouldn’t write to any text page other than page 0 (that is, don’t write to any offset in display memory above 3999 in text mode) or alter the Page Select bit in the Miscellaneous Output register (3C2H) while in text mode. In order to allow completely unfettered access to text pages, it would be necessary to save every byte in the first 32K of each of planes 0 and 1. (On the other hand, this <I>would</I> allow up to 16 text screens to be stored simultaneously, with any one displayable instantly.) Moreover, if any fonts other than the default font are loaded, the portions of plane 2 that those particular fonts are loaded into would have to be saved, up to a maximum of all 64K of plane 2. In the worst case, a full 128K would have to be saved in order to preserve all the memory potentially used by text mode.</P>
|
||||
<P>As I said, Phil Coleman’s question is an interesting one, and I’ve only touched on the intriguing possibilities arising from the various configurations of display memory in VGA graphics and text modes. Right now, though, we’ve still got the basics of the remarkably complex (but rewarding!) VGA to cover.</P>
|
||||
<P><B>LISTING 27.3 L27-3.ASM</B></P>
|
||||
<!-- CODE //-->
|
||||
<PRE>
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
;
|
||||
; By Michael Abrash
|
||||
;
|
||||
Stack segment para stack ‘STACK’
|
||||
Stack segment para stack ‘STACK’
|
||||
db 512 dup(0)
|
||||
Stack ends
|
||||
|
||||
|
|
@ -61,19 +61,19 @@ MAP_MASK equ 2 ;index of Map Mask register
|
|||
GC_INDEX equ 3ceh ;Graphics Controller Index register
|
||||
READ_MAP equ 4 ;index of Read Map register
|
||||
|
||||
Data segment para common ‘DATA’
|
||||
Data segment para common ‘DATA’
|
||||
|
||||
GStrikeAnyKeyMsg0 label byte
|
||||
db 0dh, 0ah, ‘Graphics mode’, 0dh, 0ah
|
||||
db ‘Strike any key to continue...’, 0dh, 0ah, ‘$’
|
||||
db 0dh, 0ah, ‘Graphics mode’, 0dh, 0ah
|
||||
db ‘Strike any key to continue...’, 0dh, 0ah, ‘$’
|
||||
|
||||
GStrikeAnyKeyMsg1 label byte
|
||||
db 0dh, 0ah, ‘Graphics mode again’, 0dh, 0ah
|
||||
db ‘Strike any key to continue...’, 0dh, 0ah, ‘$’
|
||||
db 0dh, 0ah, ‘Graphics mode again’, 0dh, 0ah
|
||||
db ‘Strike any key to continue...’, 0dh, 0ah, ‘$’
|
||||
|
||||
TStrikeAnyKeyMsg label byte
|
||||
db 0dh, 0ah, ‘Text mode’, 0dh, 0ah
|
||||
db ‘Strike any key to continue...’, 0dh, 0ah, ‘$’
|
||||
db 0dh, 0ah, ‘Text mode’, 0dh, 0ah
|
||||
db ‘Strike any key to continue...’, 0dh, 0ah, ‘$’
|
||||
|
||||
Plane2Save db 2000h dup (?) ;save area for plane 2 data
|
||||
; where font gets loaded
|
||||
|
|
@ -82,11 +82,11 @@ CharAttSave db 4000 dup (?) ;save area for memory wiped
|
|||
; data in text mode
|
||||
Data ends
|
||||
|
||||
Code segment para public ‘CODE’
|
||||
Code segment para public ‘CODE’
|
||||
assume cs:Code, ds:Data
|
||||
Start proc near
|
||||
mov ax,10h
|
||||
int 10h ;select video mode 10h (640×350)
|
||||
int 10h ;select video mode 10h (640x350)
|
||||
;
|
||||
; Fill the graphics bit-map with a colored pattern.
|
||||
;
|
||||
|
|
@ -114,7 +114,7 @@ FillBitMap:
|
|||
shl ah,1
|
||||
loop FillBitMap
|
||||
;
|
||||
; Put up “strike any key” message.
|
||||
; Put up “strike any key” message.
|
||||
;
|
||||
mov ax,Data
|
||||
mov ds,ax
|
||||
|
|
@ -160,13 +160,13 @@ FillBitMap:
|
|||
mov cx,4000/2 ;length of one text screen in words
|
||||
rep movsw
|
||||
;
|
||||
; Fill the text mode screen with dots and put up “strike any key”
|
||||
; Fill the text mode screen with dots and put up “strike any key”
|
||||
; message.
|
||||
;
|
||||
mov ax,TEXT_SEGMENT
|
||||
mov es,ax
|
||||
sub di,di
|
||||
mov al,‘.’ ;fill character
|
||||
mov al,‘.’ ;fill character
|
||||
mov ah,7 ;fill attribute
|
||||
mov cx,4000/2 ;length of one text screen in words
|
||||
rep stosw
|
||||
|
|
@ -215,7 +215,7 @@ FillBitMap:
|
|||
mov cx,2000h/2 ;restore 8K (length of default font)
|
||||
rep movsw
|
||||
;
|
||||
; Put up “strike any key” message.
|
||||
; Put up “strike any key” message.
|
||||
;
|
||||
mov ax,Data
|
||||
mov ds,ax
|
||||
|
|
|
|||
Loading…
Reference in a new issue