home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
vga.doc
< prev
next >
Wrap
Text File
|
1990-01-04
|
44KB
|
1,064 lines
Chapter 5
VGA
-------
****************************************
* *
****** INTRODUCTION ********
* *
****************************************
A. VIDEO MODE :
1. Text mode
2. Graphics mode
B. DISPLAY MEMORY ORGANIZATION
C. CHARACTER GENERATOR
D. COLOR PALETTE AND COLOR REGISTER
E. GRAPHICS READ AND WRITE MODES
1. Write modes : 0-3
2. Read modes : 0-1
F. VGA REGISTER
1. General or External registers
2. Sequencer registers
3. CRTC registers
4. Graphics registers
5. Attribute registers
G. VGA BIOS DATA AREA
H. VIDEO POST SEQUENCE
I. VIDEO BIOS SERVICE ROUTINES
************************************
* *
******* TEXT MODES *******
* *
************************************
┌────────────────────────────────────────────────────────────────────┐
│ Mode #chars Display page Resolution Buffer │
│ (X/Y) Char Box Format no. in Pixels │
├────────────────────────────────────────────────────────────────────│
│ 0,1 40/25 8 x 8 16/256K 8 320 x 200 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 0*,1* 40/25 8 x 14 16/256K 8 320 x 350 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 0+,1+ 40/25 8 x 16 16/256K 8 320 x 400 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 2,3 80/25 8 x 8 16/256K 8 640 x 200 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 2*,3* 80/25 8 x 14 16/256K 8 640 x 350 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 2+,3+ 80/25 8 x 16 16/256K 8 640 x 400 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 7 80/25 9 x 14 bw 8 720 x 350 B0000 │
├────────────────────────────────────────────────────────────────────│
│ 7+ 80/25 9 x 16 bw 8 720 x 400 B0000 │
└────────────────────────────────────────────────────────────────────┘
Note:
1. The asterisk (*) in the display mode indicates that VGA is in a text
mode with 350 vertical lines.
2. The plus (+) in the display mode indicates that VGA is in a text mode
with 400 vertical lines.
3. Display modes 0 through 6 emulate the Color Graphics Adapter(CGA).
Mode 7 emulates the IBM Monochrome MDA or Hercules Monochrome graphics.
4. The code "bw" stands for black and white or synonymously monochrome.
************************************
* *
******* GRAPHICS MODES *******
* *
************************************
┌────────────────────────────────────────────────────────────────────┐
│ Mode #chars Display page Resolution Buffer │
│ (Hex) (X/Y) Char Box Format no. in Pixels │
├────────────────────────────────────────────────────────────────────│
│ 4,5 40/25 8 x 8 4/256K 1 320 x 200 B8000 │
├────────────────────────────────────────────────────────────────────│
│ 6 80/25 8 x 8 2/256K 1 640 x 350 B8000 │
├────────────────────────────────────────────────────────────────────│
│ D 40/25 8 x 8 16/256K 8 320 x 200 A0000 │
├────────────────────────────────────────────────────────────────────│
│ E 80/25 8 x 8 16/256K 4 640 x 200 A0000 │
├────────────────────────────────────────────────────────────────────│
│ F 80/25 8 x 14 bw 2 640 x 350 A0000 │
├────────────────────────────────────────────────────────────────────│
│ 10 80/25 8 x 14 16/256K 2 640 x 350 A0000 │
├────────────────────────────────────────────────────────────────────│
│ 11 80/30 8 x 16 2/256K 1 640 x 480 A0000 │
├─────────────────────────────────────────────────────────────────── │
│ 12 80/30 8 x 16 16/256K 1 640 x 480 A0000 │
├────────────────────────────────────────────────────────────────────┤
│ 13 40/25 8 x 8 256/256K 1 320 x 200 A0000 │
└────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────────────┐
│ MODE │
│ (Hex) # of Colors # Bits per Plane Bit Planes Affected Notes │
├────────────────────────────────────────────────────────────────────────┤
│ 4,5 4 2 0,1 1 │
├────────────────────────────────────────────────────────────────────────│
│ 6 2 1 0 2 │
├────────────────────────────────────────────────────────────────────────│
│ D 16 1 0,1,2,3 3 │
├────────────────────────────────────────────────────────────────────────│
│ E 16 1 0,1,2,3 3 │
├────────────────────────────────────────────────────────────────────────│
│ F 4 1 0,2 4 │
├────────────────────────────────────────────────────────────────────────│
│ 10 16 1 0,1,2,3 3 │
├────────────────────────────────────────────────────────────────────────│
│ 11 2 1 0 2 │
├────────────────────────────────────────────────────────────────────────│
│ 12 16 1 0,1,2,3 3 │
├────────────────────────────────────────────────────────────────────────┤
│ 13 256 8 0,1,2 or 3 5 │
└────────────────────────────────────────────────────────────────────────┘
Notes:
1.In modes 4 and 5, alternate bytes of data, each containing four
pixels, are stored in bit plane 0 and bit plane 1. Bit plane 0
contributes the low-order bit, and bit plane 1 contributes the
high-order bit of the two-bit pixel.
2.In modes 6 and 11 hex, each pixel consists of one bit in bit plane 0.
3.In mode D,E,10,12 hex, each pixel corresponds to one bit in each of
the four bit planes. Bit plane 0 contributes the low-order bit,
followed by bit plane 1, and bit plane 2. Bit plane 3 contributes the
high-order bit of the four bit pixel.
4.In mode F hex, bit plane 0 contributes the low-order bit and bit plane
2 contributes the high-order bit of the two bit pixel.
5.In mode 13 hex, all four bit planes are chained together and each
pixel consists of eight bits. The plane in which a pixel resides
depends on the position of the pixel on the display. Each plane holds
one-quarter of the pixels.
************************************
* *
******* CHARACTER FONTS *******
* *
************************************
There are 5 character fonts set supported:
8 by 8 ,8 by 14, 8 by 16, 9 by 14, and 9 by 16.
ASCII_8X8 db 00H,00H,00H,00H,00H,00H,00H,00H ;ASCII 0
db 07EH,081H,0A5H,081H,0BDH,099H,081H,7EH ;ASCII 1
db 07CH,0FEH,0D6H,0FEH,0C6H,0FEH,07CH,00H ;ASCII 2
db 06CH,0FEH,0FEH,0FEH,07CH,038H,010H,00H ;ASCII 3
db 010H,038H,07CH,0FEH,07CH,038H,010H,00H ;ASCII 4
db 010H,038H,054H,0FEH,054H,010H,07CH,00H ;ASCII 5
.
.
.
ASCII_8X8_1 db 07CH,0C0H,0C6H,07CH,018H,0CH,078H,00H ;ASCII 128
db 06CH,00H,0CCH,0CCH,0CCH,0CCH,076H,00H ;ASCII 129
db 0CH,018H,03CH,066H,07EH,060H,03EH,00H ;ASCII 131
db 038H,044H,078H,0CH,07CH,0CCH,076H,00H ;ASCII 132
db 06CH,00H,078H,0CH,07CH,0CCH,076H,00H ;ASCII 133
db 030H,018H,078H,0CH,07CH,0CCH,076H,00H ;ASCII 134
db 038H,044H,078H,0CH,07CH,0CCH,076H,00H ;ASCII 135
.
.
.
ASCII_8X14 db 00H,00H,00H,00H,00H,00H,00H,00H,00H
db 00H,00H,00H,00H,00H ;ASCII 0
db 00H,00H,07EH,081H,0A5H,081H,081H,0BDH
db 099H,081H,07EH,00H,00H,00H ;ASCII 1
db 0H,00H,07EH,0FFH,0DBH,0FFH,0FFH,0C3H
db 0E7H,0FFH,07EH,00H,00H,00H ;ASCII 2
db 00H,00H,00H,06CH,0FEH,0FEH,0FEH,0FEH
db 07CH,038H,010H,00H,00H,00H ;ASCII 3
db 00H,00H,00H,010H,038H,07CH,0FEH,07CH
db 038H,010H,00H,00H,00H,00H ;ASCII 4
.
.
.
ASCII_8X16 db 00H,00H,00H,00H,00H,00H,00H
db 00H,00H,00H,00H,00H,00H,00H,00H,00H ;ASCII 0
db 00H,00H,07EH,081H,0A5H
db 081H,081H,0BDH,099H,081H,081H
db 07EH,00H,00H,00H,00H ;ASCII 1
db 00H,00H,07EH,0FFH,0FFH
db 0DBH,0FFH,0FFH,0C3H,0E7H
db 0FFH,07EH,00H,00H,00H,00H ;ASCII 2
db 00H,00H,00H,00H,06CH,0FEH
db 0FEH,0FEH,0FEH,07CH,038H
db 010H,00H,00H,00H,00H ;ASCII 3
.
.
.
;
; 12 additional character of 8X14
;
ASCII_9X14 db 1dh,0H,00H,00H,00H,024H,066H,0FFH
db 066H,024H,00H,00H,00H,00H,00H ;code 1dh
db 4dh,00H,00H,0C3H,0E7H,0FFH,0DBH
db 0C3H,0C3H,0C3H,0C3H,0C3H,00H,00H,00H ;code 4dh
db 54h,00H,00H,0FFH,0DBH,099H,018H,018H
db 018H,018H,018H,03CH,00H,00H,00H ;code 54h
db 56h,00H,00H,0C3H,0C3H,0C3H,0C3H
.
.
.
ASCII_9X16 db 1dh,00H,00H,00H,00H,00H,024H,066H
db 0FFH,066H,024H,00H,00H,00H,00H,00H,00H ;code 1dh
db 4dh,00H,00H,0C3H,0E7H,0FFH,0DBH,0C3H
db 0C3H,0C3H,0C3H,0C3H,0C3H,00H,00H,00H,00H ;code 4dh
db 54h,00H,00H,0FFH,0DBH,099H,018H,018H,018H
db 018H,018H,018H,03CH,00H,00H,00H,00H ;code 54h
db 56h,00H,00H,0C3H,0C3H,0C3H,0C3H,0C3H,0C3H
db 0C3H,066H,03CH,018H,00H,00H,00H,00H ;code 56h
db 57h,00H,00H,0C3H,0C3H,0C3H,0C3H,0C3H,0DBH
db 0DBH,0DBH,0FFH,066H,00H,00H,00H,00H ;code 57h
.
.
.
The 9 by 14 and 9 by 16 character font are referred to as the supplement
character set. It is called supplemental because not all of the 256
characters are provided. Typical characters that are included in the
supplement are quotation marks ("),the plus sign (+),the minus sign (-),
M,T,V,W,X,Y,Z,m,v,w,and line-drawing symbols.
************************************
* *
**** CHARACTER ATTRIBUTE ****
* *
************************************
A. MONOCHROME MODE
Mode 7: Monochrome Attributes
──────────────────────────────────────────────────────────────────────
Background Forground Attribute
(bit3 6-4) (bits 2-0)
──────────────────────────────────────────────────────────────────────
0 0 Black
0 1 Underline
0 7 Normal(white on black)
7 0 Reversed(black on white)
7 7 White
Mode 7: Examples of Monochrome Attributes
────────────────────────────────────────────────────────────────────────
Blink Background Intens Forground Code
(Bit 7) (bits 6-4) (Bit 3) (Bit 2-0) (Hex) Attribute
────────────────────────────────────────────────────────────────────────
0 0 0 1 1 Underline
0 0 1 1 9 Intense Underline
0 7 0 0 70 Reversed
0 7 1 0 74 Intense Reversed
1 7 0 0 F0 Blinking Reversed
1 7 1 0 F1 Intense Blinking
Reserved
Mode 7: Palette Registers
───────────────────────────────────────────────────────────────────────
Register # Register Value Register # Register Value
───────────────────────────────────────────────────────────────────────
0 00 8 10
1 08 9 18
2 08 A 18
3 08 B 18
4 08 C 18
5 08 D 18
6 08 E 18
7 08 F 18
B. SIXTEEN-COLOR MODE
Default Colors for a 16-color Palette
────────────────────────────────────────────────
Palette Register (Hex) Color
────────────────────────────────────────────────
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Brown
7 White
8 Gray
9 Light Blue
A Light Green
B Light cyan
C Light red
D Light Magenta
E Light Brown (yellow)
F Bright White
C. ATTRIBUTE BYTE IN THE 16-COLOR MODE
7 6 5 4 3 2 1 0
┌──────────────────────┬──────────────────────┐
│ │ │
└──────────────────────┴──────────────────────┘
Background Forground
7 6 5 4 3 2 1 0
┌──────────────────────┬────┬─────────────────┐
│ │ │ │
└──────────────────────┴─┼──┴─────────────────┘
Background │ Forground
Font #
7 6 5 4 3 2 1 0
┌───┬──────────────────┬──────────────────────┐
│ │ │ │
└─┼─┴──────────────────┴──────────────────────┘
│ Background Forground
Blinking
7 6 5 4 3 2 1 0
┌───┬──────────────────┬───┬──────────────────┐
│ │ │ │ │
└─┼─┴──────────────────┴─┼─┴──────────────────┘
│ Background │ Forground
Blinking Font #
Note:
1. The character attribute byte is used to determine the character color,
to determine the blinking status, and to select from one of the two
character sets.
Bit 3 of the character attribute byte is used either to select one of
16 forground colors for the associated character or to choose from one
of two resident character sets.
Bit 7 is selected to have dual function of either being part of the
background color code or being a switch for the blinking feature.
2. The default alphanumeric characters are defined by the bit patterns
in the first table in MAP 2, regardless of the value of bit 3 of the
attribute bytes of the characters displayed.
Changing the value in the Character Map Select register, changes the
character definition tables associated with bit 3 of attribute bytes.
If two different values appear in the bit fields in the Character Map
Select register, the value of bit 3 designates one of two different
character definition tables.
************************************
* *
******* VGA REGISTERS ******
* *
************************************
General or External Registers
──────────────────────────────────────────────────────────────────────────
Name Write (Hex) Read (Hex)
Misc. Output 3C2 3CC
Feature Control 3DA/3BA 3CA
Input Status #0 3C2
Input Status #1 3DA/3BA
──────────────────────────────────────────────────────────────────────────
Sequencer Registers
─────────────────────────────────────────────────────────────────────────
Name Index R/W Port(Hex)
Address x 3C4
Reset 0 3C5
Clocking Mode 1 3C5
Map Mask 2 3C5
Character Map Select 3 3C5
Memory Mode 4 3C5
─────────────────────────────────────────────────────────────────────────
Attribute Controller Registers
─────────────────────────────────────────────────────────────────────────
Name Index R/W Port(Hex)
Address x 3C0
Palette 0-F 3C1
Mode Control 10 3C1
Overscan Color 11 3C1
Color Plane Enable 12 3C1
Horizontal Pixel Panning 13 3C1
Color Select 14 3C1
─────────────────────────────────────────────────────────────────────────
Graphics Control Registers:
─────────────────────────────────────────────────────────────────────────
Name Index R/W Port(Hex)
Graphics Address x 3CE
Set/Reset 0 3CF
Enable Set/Reset 1 3CF
Color Compare 2 3CF
Data Rotate 3 3CF
Read Map Select 4 3CF
Mode 5 3CF
Miscellaneous 6 3CF
Color Don't Care 7 3CF
Bit Mask 8 3CF
────────────────────────────────────────────────────────────────────────
CRT Controller Registers
────────────────────────────────────────────────────────────────────────
Name Index R/W Port(Hex)
Address x 3D4/3B4
Horizontal Total 0 3D5/3B5
Horizontal Display End 1 3D5/3B5
Start Horizontal Blank 2 3D5/3B5
End Horizontal Blank 3 3D5/3B5
Start Horizontal Retrace 4 3D5/3B5
End Horizontal Retrace 5 3D5/3B5
Vertical Total 6 3D5/3B5
Overflow 7 3D5/3B5
Preset Row Scan 8 3D5/3B5
Max Scan Line 9 3D5/3B5
Cursor Start A 3D5/3B5
Cursor End B 3D5/3B5
Start Address High C 3D5/3B5
Start Address Low D 3D5/3B5
Cursor Location High E 3D5/3B5
Cursor Location Low F 3D5/3B5
Vertical Retrace Start 10 3D5/3B5
Vertical Retrace Low 11 3D5/3B5
Vertical Display End 12 3D5/3B5
Offset 13 3D5/3B5
Underline Location 14 3D5/3B5
Start Vertical Blank 15 3D5/3B5
End Vertical Blank 16 3D5/3B5
Mode Control 17 3D5/3B5
Line Compare 18 3D5/3B5
────────────────────────────────────────────────────────────────────────
************************************
* *
******* MEMORY MAPPING ******
* *
************************************
The video buffer can be configured as the following :
1). A000:0 ------- 128K for mode D,E,F,10,11,12 and 13
2). A000:0 ------- 64K for character generator for text modes
3). B000:0 ------- 32k for mode 7 and 7+
4). B800:0 ------- 32K for text mode 0,1,2,3 and graphics modes 4,5,6
************************************
* *
******* CHARACTER GENERATOR ******
* *
************************************
The character generator consists of the dot patterns that represent
each character in the character set.
The character dot patterns are stored in character boxes, each of
which is 32 bytes long.
Bits set to 1 in the character font will be displayed in the
forground color, and bits reset to 0 will be displayed in the
background color.
The display memory consists of four display planes called bit planes,
each being 64K bytes long.
VGA supports eight font tables. Each table consists of 256 32-byte bit
patterns, so the character box height is 32 scan lines. When the displayed
character box contains fewer than 32 lines, the character generator
ignored the extra bytes in each character definition.
The character generator has 8 blocks illustrated in the following:
A000:0 ╔═════════╗ ┌────────────────────┐
║ Font 0 ─╫───────── 0 │ 0 │
2000 ╟─────────║ ├────────────────────│
║ Font 4 ║ 1 │ 1 │
4000 ╠═════════╣ ├────────────────────│ character 0
║ Font 1 ║ │ . │
6000 ╟─────────║ │ . │
║ Font 5 ║ │ . │
8000 ╠═════════╣ ├────────────────────│
║ Font 2 ║ 31 │ 31 │
A000 ╟─────────║ ─────┼────────────────────┼─────────
║ Font 6 ║ 32 │ 0 │
C000 ╠═════════╣ ├────────────────────│
║ Font 3 ║ 33 │ 1 │
E000 ╟─────────║ ├────────────────────│
║ Font 7 ║ │ . │
╚═════════╝ │ . │ character 1
│ . │
│────────────────────│
63 │ 31 │
─────┼────────────────────┼─────────
64 │ . │ .
│ . │ .
│ . │ .
────┼────────────────────┼──────────
│ 0 │
├────────────────────│
│ │
│ │ character 255
├────────────────────┤
8191 │ 31 │
└────────────────────┘
***************************************************
* *
******* GRAPHICS MODES PIXEL PROGRAMMING ******
* *
***************************************************
A. Relative Registers Accessed:
Graphics Control Registers:
Name Index R/W Port(Hex)
Graphics Address x 3CE
Set/Reset 0 3CF
Enable Set/Reset 1 3CF
Color Compare 2 3CF
Data Rotate 3 3CF
Read Map Select 4 3CF
Mode 5 3CF
Miscellaneous 6 3CF
Color Don't Care 7 3CF
Bit Mask 8 3CF
B. Read/Write Mode
1. Write Mode 0 (EGA/VGA)
2. Write Mode 1 (EGA/VGA)
3. Write Mode 2 (EGA/VGA)
4. Write Mode 3 (VGA Only)
5. Read Mode 0 (EGA/VGA)
6. Read Mode 1 (EGA/VGA)
***************************************
* *
******* PALETTE/COLOR REGISTER ******
* *
***************************************
Palette Utilization
───────────────────────────────────────────────────────────────────────
Display Mode (hex) Number of Colors Palette Register Affected
0,1 16 0-15
2,3 16 0-15
4,5 4 0,1,2,3
6 2 0,1
7 4 0,1,4,5
D 16 0-15
E 16 0-15
F 4 0,1,4,5
10 16 0-15
11 2 0,1
12 16 0-15
13 256 0-15
Mode 7 Palette Defult Values
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 8 8 8 8 8 8 8 10 18 18 18 18 18 18 18
───────────────────────────────────────────────────────────
Mode F Palette Default Values
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 8 - - 18 18 - - - - - - - - - -
───────────────────────────────────────────────────────────
Mode 0,1,2,3 Palette Default Values ( 200 scan line)
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 1 2 3 4 5 14 7 38 39 3A 3B 3C 3D 3E 3F
───────────────────────────────────────────────────────────
Mode 0*,1*,2*,3* Palette Default Values ( 350, 400 )
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17
───────────────────────────────────────────────────────────
CGA-compatible Color Selection
────────────────────────────────────────────────────────────────
ATR 1 ATR 0 Set 1 Set 0 VGA Palette Register
0 0 Background Background 0
0 1 Cyan Green 1
1 0 Magenta Red 2
1 1 White Brown 3
Mode 6 Palette Default Values
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17
───────────────────────────────────────────────────────────
Mode 11 Palette Default Values
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
───────────────────────────────────────────────────────────
Mode D,E,10 and 12 Palette Default Values
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 1 2 3 4 5 14 7 38 39 3A 3B 3C 3D 3E 3F
───────────────────────────────────────────────────────────
Mode 13 Palette Default Values
──────────────────────────────────────────────────────────
Register 0 1 2 3 4 5 6 7 8 9 A B C D E F
Value 0 1 2 3 4 5 6 7 8 9 A B C D E F
───────────────────────────────────────────────────────────
. COLOR REGISTERS
The VGA is equipped with 256 Color Registers. A pixel or character in
display memory consists of from one to eight bits of data. This data
is used to address the 16 palette registers. The output of these
palette registers is used in conjunction with the data in display
memory to address the color registers. The color registers contain
the color codes that are output to the digital-to-analog converters
(DAC). The output of the DAC are sent to the monitor. Each of the
color registers consists of a red,green,and blue component. Each of
these color components is six bits wide.
. COLOR REGISTERS ADDRESSING
. COLOR REGISTER ORGANIZATION
1. Four banks of 64 color registers
2. Sixteen banks of 16 color registers
. ACCESSING THE COLOR REGISTERS
1. Modifying color registers through BIOS
2. Modifying color registers directly
Relative registers:
────────────────────────────────────────────────────
Address Read/Write Function
3C7 Write only PEL address during read
3C7 Read only DAC state
3C8 Read/Write PEL address during write
3C9 Read/Write PEL data register
3C6 Read/Write PEL mask
────────────────────────────────────────────────────
. COLOR CONVERSION
1. Gray Scale
Gray shades are composed of equal amounts of red, green, and blue.
White is the maximum gray scale value, and black is the minimum
value.
The VGA allocates six bits per color which provides 64 possible
gray scales. These 64 levels of gray scale are achived using the
six-bit color fields within the color registers.
Gray scale using the color registers
────────────────────────────────────────────────────
Color Register Value Gray Scale
────────────────────────
Red Green Blue
0 0 0 0% saturation
1 1 1 1.6% saturation
2 2 2 3.2% saturation
. . . .
. . . .
. . . .
63 63 63 100% saturation
2. Summing Colors to Gray Scale
GRAY SCALE = (0.30 X RED) + (0.59 X GREEN) + (0.11 X BLUE)
3. Relative BIOS Calls
────────────────────────────────────────────────────────────────────
AH Subfunction (Hex) Function
10 AL = 1B Sum color values immediately to gray scale
12 BL = 33 Enable/Disable summing to gray scale at
mode set
************************************
* *
******* VGA BIOS CALLS ******
* *
************************************
CONTROL
───────────────────────────────────────────────────────────
Mode Set
Select Active Display Page
Select Alternate Print Screen Routine
Video Enable/Disable
Display Switch
Video Screen On/Off
RETURN STATE
───────────────────────────────────────────────────────────
Return Curren Video State
Return Video Information
Read/Write Display Combination Code
Return Functionality/State Information
Save/Restore Video State
INTERACTIVE
───────────────────────────────────────────────────────────
Set Cursor Type
Set Cursor Position
Read Cursor Position
Cursor Emulation
TEXT
───────────────────────────────────────────────────────────
Scroll Active Page Up
Scroll Active Page Down
Read Character/Attribute
Write Character/Attribute
Write Character Only
Write Teletypewriter to Active Page
Select Scan Lines for Text Modes
Write String
GRAPHICS
───────────────────────────────────────────────────────────
Write Dot
Read Dot
PALETTE
───────────────────────────────────────────────────────────
Set Color Palette
Set Individual Palette Register
Set Overscan (Boarder) Register
Set All Palette Registers and Overscan
Toggle Intensity/Blinking Bit
Read Individual Palette Register
Read Overscan Resister
Read all Palette Registers and Overscan
Default Palette Loading During Mode Set
COLOR REGISTERS
───────────────────────────────────────────────────────────
Set Individual Color Register
Set block of Color Registers
Select Color Page
Read Individual Color Register
Read Block of Color Registers
Read Current Color Page Number
Sum Color Values to Gray Scale
Default Palette Loading During Mode Set
Summing to Gray Scales
CHARACTER GENERATOR
───────────────────────────────────────────────────────────
User text Load with Reset
ROM Monochrome Set with Reset
ROM 8x8 Character Set Load with Reset
Set Block Specifier
ROM 8x16 Character Set Load with Reset
User Alpha Load
ROM Monochrome Set
ROM 8x8 Character Set Load
ROM 8x16 Character Set Load
User Graphics Characters INT 1FH (8x8)
User Graphics Characters
Graphics Mode ROM 8x14 Character Set Load
Graphics Mode ROM 8x8 Character Set Load
Graphics Mode ROM 8x16 Character Set Load
Return Character Generator Information
******************************************
* *
*** VGA POST (DIAGNOSTIC) SEQUENCE ***
* *
******************************************
┌─────────────────────┐
│ Disable │
│ VGA 1* │
└─────────┬───────────┘ ┌────────────────┐
│ │ │
│ │ │
┌─────────┴───────────┐ │ ┌─────────┴───────────┐
│ Check Other │ │ │ Dual Monitor │
│ Display Card Exit? │ │ │ Test 7* │
│ 2* │ │ └─────────┬───────────┘
└─────────┬───────────┘ │ │
│ │ │
│ │ ┌─────────┴───────────┐
┌─────────┴───────────┐ │ │ Set Mode │
│ Enable │ │ │ 8* │
│ VGA 3* │ │ └─────────┬───────────┘
└─────────┬───────────┘ │ │
│ │ │
│ │ ┌─────────┴───────────┐
┌─────────┴───────────┐ │ │ Test Vertical │
│ Set Corresponding │ │ │ Retrace Signal 9* │
│ Video Interrupt │ │ └─────────┬───────────┘
│ Vectors 4* │ │ │
└─────────┬───────────┘ │ │
│ │ ┌─────────┴───────────┐
│ │ │ Show ACER │
┌─────────┴───────────┐ │ │ Copyright │
│ Test Video │ │ └─────────────────────┘
│ Buffer 5* │ │
└─────────┬───────────┘ │
│ │
│ │
┌─────────┴───────────┐ │
│ Sense Monitor │ │
│ Type 6* │ │
└─────────┬───────────┘ │
│ │
│ │
└─────────────────┘
Note 1:
Wake up VGA chip by programming port 46E8 hex bit 4 to 1.
Program port 102 hex bit 0 to 1.
Program port 46E8 hex bit 3 to 0 (disable the accessing of VGA
memory and I/O) for the sake of testing other display cards' presence.
Note 2:
By writing 4 words to VRAM (B000h & B800h)
read back
If VRAM R/W O.K then set the correct equip_flag (40:10) value.
Note 3:
Program port 46E8 hex bit 3 to 1 (enable the accessing of VGA memory
and I/O).
Note 4:
INT 10h : service routine entry
INT 1Fh : 2nd 128 8x8 ascii code
INT 43h : 1st 128 8x8 ascii code
INT 1Dh : point to the CGA compatible table
INT 6dh : keep the same value as INT 10h vector
INT 42h : IBM (CGA,MDA,MGA) original INT 10 vector (F000:F065)
Note 5:
By writing pattern to VRAM then read back.
If error occurs, sound 1 long 2 short error beep.
Note 6:
R G B -- 12h,12h,12h If port 3C2h bit 4 on, color monitor
R G B -- 4,12h,4 If port 3C2h bit 4 on, mono monitor
else, no monitor attached.
Note 7:
Set corresponding values to BIOS data area.
Note 8:
Set CRT mode according to the current flags setting.
Note 9:
Read input status register (3DA/3BA), if error occures, sound
1 long 3 short error beep.