Initial conversion to markdown
This commit is contained in:
parent
a96a114403
commit
5e10794a24
362 changed files with 67353 additions and 0 deletions
121
29-05.md
Normal file
121
29-05.md
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
------------------------ --------------------------------- --------------------
|
||||
[Previous](29-04.html) [Table of Contents](index.html) [Next](29-06.html)
|
||||
------------------------ --------------------------------- --------------------
|
||||
|
||||
### Overscan {#Heading5}
|
||||
|
||||
While we’re at it, I’m going to touch on overscan. Overscan is the color
|
||||
of the border of the display, the rectangular area around the edge of
|
||||
the monitor that’s outside the region displaying active video data but
|
||||
inside the blanking area. The overscan (or border) color can be
|
||||
programmed to any of the 64 possible colors by either setting Attribute
|
||||
Controller register 11H directly or calling video function 10H,
|
||||
subfunction 1.
|
||||
|
||||
------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
 *On ECD-compatible monitors, however, there’s too little scan time to display a proper border when the EGA is in 350-scan-line mode, so overscan should always be 0 (black) unless you’re in 200-scanmode. Note, though, that a VGA can easily display a border on a VGA-compatible monitor, and VGAs are in fact programmed at mode set for an 8-pixel-wide border in all modes; all you need do is set the overscan color on any VGA to see the border.*
|
||||
------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### A Bonus Blanker {#Heading6}
|
||||
|
||||
An interesting bonus: The Attribute Controller provides a very
|
||||
convenient way to blank the screen, in the form of the aforementioned
|
||||
bit 5 of the Attribute Controller Index register (at address 3C0H after
|
||||
the Input Status 1 register—3DAH in color, 3BAH in monochrome—has been
|
||||
read and on every other write to 3C0H thereafter). Whenever bit 5 of the
|
||||
AC Index register is 0, video data is cut off, effectively blanking the
|
||||
screen. Setting bit 5 of the AC Index back to 1 restores video data
|
||||
immediately. Listing 29.4 illustrates this simple but effective form of
|
||||
screen blanking.
|
||||
|
||||
**LISTING 29.4 L29-4.ASM**
|
||||
|
||||
; Program to demonstrate screen blanking via bit 5 of the
|
||||
; Attribute Controller Index register.
|
||||
;
|
||||
AC_INDEX equ 3c0h ;Attribute Controller Index register
|
||||
INPUT_STATUS_1 equ 3dah ;color-mode address of the Input
|
||||
; Status 1 register
|
||||
;
|
||||
; Macro to wait for and clear the next keypress.
|
||||
;
|
||||
WAIT_KEY macro
|
||||
mov ah,8 ;DOS input without echo function
|
||||
int 21h
|
||||
endm
|
||||
;
|
||||
stack segment para stack ‘STACK’
|
||||
db512 dup (?)
|
||||
stack ends
|
||||
;
|
||||
Data segment word ‘DATA’
|
||||
SampleText db ‘This is bit-mapped text, drawn in hi-res ’
|
||||
db ‘EGA graphics mode 10h.’, 0dh, 0ah, 0ah
|
||||
db ‘Press any key to blank the screen, then ’
|
||||
db ‘any key to unblank it,’, 0dh, 0ah
|
||||
db ‘then any key to end.$’
|
||||
Data ends
|
||||
;
|
||||
Code segment
|
||||
assume cs:Code, ds:Data
|
||||
Start proc near
|
||||
mov ax,Data
|
||||
mov ds,ax
|
||||
;
|
||||
; Go to hi-res graphics mode.
|
||||
;
|
||||
mov ax,10h ;AH = 0 means mode set, AL = 10h selects
|
||||
; hi-res graphics mode
|
||||
int 10h ;BIOS video interrupt
|
||||
;
|
||||
; Put up some text, so the screen isn’t empty.
|
||||
;
|
||||
mov ah,9 ;DOS print string function
|
||||
mov dx,offset SampleText
|
||||
int 21h
|
||||
;
|
||||
WAIT_KEY
|
||||
;
|
||||
; Blank the screen.
|
||||
;
|
||||
mov dx,INPUT_STATUS_1
|
||||
in al,dx ;reset port 3c0h to index (rather than data)
|
||||
; mode
|
||||
mov dx,AC_INDEX
|
||||
sub al,al ;make bit 5 zero...
|
||||
out dx,al ;...which blanks the screen
|
||||
;
|
||||
WAIT_KEY
|
||||
;
|
||||
; Unblank the screen.
|
||||
;
|
||||
mov dx,INPUT_STATUS_1
|
||||
in al,dx ;reset port 3c0h to Index (rather than data)
|
||||
; mode
|
||||
mov dx,AC_INDEX
|
||||
mov al,20h ;make bit 5 one...
|
||||
out dx,al ;...which unblanks the screen
|
||||
;
|
||||
WAIT_KEY
|
||||
;
|
||||
; Restore text mode.
|
||||
;
|
||||
mov ax,2
|
||||
int 10h
|
||||
;
|
||||
; Done.
|
||||
;
|
||||
Done:
|
||||
mov ah,4ch ;DOS terminate function
|
||||
int 21h
|
||||
Start endp
|
||||
Code ends
|
||||
end Start
|
||||
|
||||
------------------------ --------------------------------- --------------------
|
||||
[Previous](29-04.html) [Table of Contents](index.html) [Next](29-06.html)
|
||||
------------------------ --------------------------------- --------------------
|
||||
|
||||
* * * * *
|
||||
|
||||
Graphics Programming Black Book © 2001 Michael Abrash
|
||||
Loading…
Reference in a new issue