CHAPTER 9
VIDEO SYSTEMS
This covers the following services offered by BIOS INT 10H:
| 00H Set video mode | 0BH Set color palette |
| 01H Set cursor size | 0CH Write pixel dot |
| 02H Set cursor position | 0DH Read pixel dot |
| 03H Return cursor status | 0EH Write in teletype mode |
| 05H Select active page | 0FH Get current video mode |
| 06H Scroll up screen | 10H Access palette registers |
| 07H Scroll down screen | 11H Access character generator |
| 08H Read character/attribute | 12H Select alternative routine |
| 09H Display character/attribute | 13H Display character string |
| 0AH Display character | 1BH Return video information |
The common (or once common) video adapters include MDA (monochrome display adapter), CGA (color graphics adapter), EGA (enhanced graphics adapter), and VGA (video graphics array). The VGA and its SVGA successors replace the CGA and EGA video adapters.
The basic components of a video system are monitor, Video Display Area, video BIOS, and Video Controller.
Monitor:
The monitor's screen consists of a group of closely-spaced horizontal lines know as the raster. Each line contains hundreds of points called pixels (picture elements) which consist of three consists of three luminescent phosphors dots for each of the primary additive colors red, green, and blue.
Video Display Area:
Data is sent to the video display area in RAM from a program by either an INT operation or by directly transferring it into the area. The following are the beginning segment addresses for major video modes:
•A000: [0] Used for font descriptor when in text mode and for high-resolution graphics for video modes 0DH through 13H.•B000:[0-] Monochrome text for mode 07H.
•B800:[0] Text and graphics for modes 00H and 06H.
The video circuitry continuously scan the data in the Video Area and refreshes the screen accordingly.
This data can be either text where each character is represented by two bytes one for the character and one for its attribute or it can be graphics data which determines the color of the pixel.
The Video Display Area allows for data to be stored in pages. In text mode there can be 8 pages numbered page 0 through page 7 with page 0 being the default display page. Since each character in text mode requires two bytes one page requires 4K bytes of memory (80X25X2).
Video Controller:
The video controller does the following:
•Generates horizontal and vertical timing signals
•Maintains and increments a counter that indicates the current location in the Video Display Area
•Handles the size and location of the cursor and the selects the page to be displayed
Video BIOS:
The video BIOS acts as an interface to the video adapter. It contains routines for setting the cursor position and size and displaying characters and pixels. The Video RAM BIOS supports two Video Data Areas:
1. 40: [49H] contains such data as current mode, number of columns, and size of the Video Display area.
2. 40:[84H] contains such data as number of rows and character height.
VIDEO MODES
The video mode determines such factors as text or graphics, color or monochrome, screen resolution, and the number of colors.
BIOS INT 10H is used to initialize the mode, for the currently executing program or to switch between text and graphics. Setting the mode also clears the screen.
The following are some of the available text modes:
| Mode | Rows x Cols | Type | Area | Pages | Resolution | Colors |
| 00 | 25 x 40 | Color | B800 | 0-7 | 360 x 400 | 16 |
| 01 | 25 x 40 | Color | B800 | 0-7 | 360 x 400 | 16 |
| 02 | 25 x 80 | Color | B800 | 0-3 | 720 x 400 | 16 |
| 03 | 25 x 80 | color | B800 | 0-3 | 720 x 400 | 16 |
| 07 | 25 x 80 | monochrome | B000 | 0 | 720 x 400 |
ATTRIBUTES
The attribute byte in text mode determines the characteristics of each displayed character.
The attribute byte has the following format:
| Background | Foreground | |||||||
| Attributte: | BL | R | G | B | I | R | G | B |
| Bit number: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
The background can display one of eight colors and the foreground characters can display one of 16 colors. Blinking and intensity apply only to the foreground, although you can us INT 10H function 10H to override the blinking feature and enable the foreground to display 16 colors.
BIOS INT 10H OPERATIONS
INT 10H Function 00H: Set Video Mode
Sets the video mode and also clears the screen (this can be overridden).
AH contains 00H and AL contains the color
INT 10H Function 01H: Set Cursor Size
Sets the cursor size on the Video Controller.
set AH = 01H
set CH (bits 4-0) = top of cursor (start scan line)
set CL (bits 4-0) = bottom of cursor (end scan line)
INT 10H Function 02H: Set Cursor Position
Set the cursor anywhere on the screen whether in graphics or text mode.
set AH = 02H
set BH = page number (0 is the default)
set DH = row and DL = column
INT 10H Function 03H: Return Cursor Status
set AH = 03H
set BH = page number
AX and BX are unchanged and returns these values:
CH = Starting scan line DH = Row
CL = Ending scan line DL = Column
INT 10H Function 05H: Select Active Page
set AH = 05H
set AL = page number
INT 10H Function 06H: Scroll Up Screen
set AH = 06H
set AL = number of rows (00H for full screen)
BH = attribute or pixel value
CX = starting row:column
DX = ending row:column
The operation returns no values: Here's a standard approach for scrolling up on line:
1. Initialize ROW variable to 0
2. Display a line and advance the cursor to the next line.
3. Text whether ROW is near the bottom of the screen (CMP ROW,22)
4. If yes, scroll one line, use ROW to set the cursor, and clear ROW to 00H.
5. If no, increment ROW (INC ROW).
INT 10H Function 07H: Scroll Down Screen
set AH = 07H
set AL = Number of rows (00H for full screen)
set BH = Attribute or pixel value
set CX = Starting row:column
set DX = Ending row:column
INT 10H Function 08H: Read Character and Attribute at Cursor
set AH = 08H
set BH = page number
In text mode, AL contains the character and AH its attribute.
In graphics mode, 00H for a non-ASCII character.
INT 10H Function 09H: Display Character and Attribute at Cursor
set AH = 09H
set AL = ASCII character
set BH = Page number
set BL = Attribute or pixel value
set CX = count (how many times to repeat character in AL)
This operation does not advance the cursor or respond to the Bell, Carriage Return, Line Feed, or Tab Characters: instead, it attempts to display them as ASCII characters. In text mode, when the display exceeds the rightmost column, the operation automatically continues the display on the next row at column 0. For graphics mode, use BL for defining the foreground color. If bit 7 is 0, the defined color replaces present pixel color: if bit 7 is 1, the defined color is combined (XORed) with them.
INT 10H Function 0AH: Display Character at Cursor
Same as 09H, except instead of setting the attribute it uses the current value.
INT 10H Function 0BH: Set Color Palette
set AH = 0BH
set BH = 00H : Select the background color, where BL contains the color value in bits 0-3
(any of 16 colors)
set BH = 01H: Select the palette for graphics, where BL contains the palettel (0 or 1)
INT 10H Function 0CH: Write Pixel Dot
set AH = 0CH
AL = color of pixel
BH = page number
CX = column
DX = row
Maximum row or column size depends upon the graphics resolution.
INT 10H Function 0DH: Read Pixel Dot
set AH = 0DH
set BH = page number
set CX = column
set DX = row
AL contains the returned pixel color
INT 10H Function 0EH: Display in Teletype Mode
INT 10H Function 0FH: Get Current Video Mode
set AH = 0FH
AL = current video mode
BH = active video page
Figure 9-2 (See Text)
INT 10H Function 10H: Access Palette Registers and Video DAC
set AH = 10H
Subfunction 00H:
Update Palette Register (changes the color displayed by any of 16
Palette registers)
set BH = color value
set BL = 00 - 0FH (palette register number)
Subfunction 01H:
Update Border Color
set BH = new border color
Subfunction 03H:
Select Background Intensity (enable or disable blinking attribute)
set BL = 00H (disable) or 01H (enable)
Subfunction 07H:
Read Palette Register ( returns the color code stored in any of the 16
Palette registers)
BH = returned color code
Subfunction 08H:
Read Overscan Register (returns the color code currently in the
Overscan (border) register)
BH = returned color code
Subfunction 09H: Read Table of Palette Register Values
Subfunction 10H: Update DAC Color Register
Subfunction 12H: Update Block of DAC register
Subfunction 15H: Read Video DAC Color Register
Subfunction 17H: Read Block of DAC Registers
Subfunction 1BH: Perform gRay Scaling on DAC Registers
INT 10H Function 11H: Access Character Generator
INT 10H Function 12H: Select Alternative Video Routine
INT 10H Function 13H: Display Character String
INT 10H Function 1AH: Video Display Combination
INT 10H Function 1BH: Return Video BIOS Information
INT 10H Function 1CH: Save or Restore Video State