11.3 Interrupt 10h Video Reference

To use one of these funtions, first place the function number in AH, then set the other input registers, then call the function with INT 10h. Registers not used by the function as inputs or outputs are not affected.

Note: The text functions work in all modes, including graphics modes.

11.3.1 Function 00h: Set Video Mode

Sets the video mode. This function will clear the screen unless bit 7 of the AL register is set.

Inputs
  • AH = 00h

  • AL = Video Mode (add 128 to not clear the screen). This is an very incomplete list of modes; see another interrupt reference for full details of all modes supported.

    • 01h: 40x25 Text, 16 colors, 8 pages

    • 03h: 80x25 Text, 16 colors, 8 pages

    • 13h: 320x200 Graphics, 256 colors, 1 page

Outputs
  • (None)

11.3.2 Function 01h: Define Cursor Appearance

Sets the starting and ending lines of the screen cursor, and can also be used to make the cursor invisible. In some modes, the characters are not exactly 8 lines high in these cases the graphics hardware will adapt the input values to the current character size.

Inputs
  • AH = 01h

  • CH = Starting line of cursor (0-7). Add 20h to make the cursor invisible.

  • CL = Ending line of cursor (0-7).

Outputs
  • (None)

11.3.3 Function 02h: Set Cursor Position

Moves the cursor to the specified position on the screen. The video hardware maintains a separate cursor for each display page, and the cursor will move only if the page number given in BH is the current display page. Giving a position that is off the screen will cause the cursor to disappear from the screen.

Inputs
  • AH = 02h

  • BH = Display page (valid only in text modes--use 00h for graphics modes).

  • DH = Row (00h is top row).

  • DL = Column (00h is leftmost column).

Outputs
  • (None)

11.3.4 Function 05h: Set Current Display Page

Sets the display page which will appear on the screen.

Inputs
  • AH = 05h

  • AL = Display page (the range of valid values depends on the current video mode--see Function 00h)

Outputs
  • (None)

11.3.5 Function 06h: Scroll Text Lines Up

Scrolls part or all of the current display page up by one or more text lines. This function can also be used to clear part or all of the screen.

Inputs
  • AH = 06h

  • AL = Number of lines to be scrolled up (AL = 00h will clear the window).

  • BH = Color attribute for blank lines. In text mode, this corresponds to the attribute byte. In VGA graphics modes, this is the color number to which all the pixels in the blank lines will be set.

  • CH = Top row of window to be scrolled up.

  • CL = Leftmost column of window.

  • DH = Bottom row of window.

  • DL = Rightmost column of window.

Outputs
  • (None)

11.3.6 Function 07h: Scroll Text Lines Down

Inputs
  • AH = 07h

  • AL = Number of lines to be scrolled down (AL = 00h will clear the window).

  • BH, CH, CL, DH, DL : Same as Function 06h.

Outputs
  • (None)

11.3.7 Function 08h: Read Character and Attribute at Current Cursor Position

Inputs
  • AH = 08h

  • BH = Display page.

Outputs
  • AL = ASCII code of character. If the current video mode is a graphics mode and no match is found, 00h is returned.

  • AH = Color attribute.

11.3.8 Function 09h: Write Character and Attribute at Current Cursor Position

Writes the specified character with the specified color attribute at the current cursor position in the specified display page. The cursor is NOT moved to the next screen position. Special control codes are not recognized, and are printed as normal ASCII characters (e.g., writing a carriage return will not cause the cursor to move to the beginning of the line).

Inputs
  • AH = 09h

  • AL = ASCII code.

  • CX = Repeat factor. The character will be written this many times. In graphics mode, all the characters must fit on the same screen line.

  • BH = Display page.

  • BL = Color attribute. In text mode, this corresponds to the attribute byte. In graphics mode, this is the foreground color (the background color will be 0). In graphics mode, if bit 7 is set, the character will be XORed with the current bitmap.

Outputs
  • (None)

11.3.9 Function 0Ah: Write Character Only at Current Cursor Position

This function is identical to Function 09h except that in text modes, the attribute byte currently in video memory is not modified (BL is ignored). In graphics modes, this function is exactly identical to Function 09h. See the comments for Function 09h.

Inputs
Outputs
  • (None)

11.3.10 Function 0Ch: Write Graphics Pixel

Sets the color number of the specified pixel in graphics mode. Valid in all graphics modes.

Inputs
  • AH = 0Ch

  • BH = Display page.

  • DX = Screen line (0 is top).

  • CX = Screen column (0 is leftmost).

  • AL = Color number.

Outputs
  • (None)

11.3.11 Function 0Dh: Read Graphics Pixel

Returns the color number of the specified pixel in graphics mode. Valid in all graphics modes.

Inputs
  • AH = 0Dh

  • BH = Display page.

  • DX = Screen line (0 is top).

  • CX = Screen column (0 is leftmost).

Outputs
  • AL = Color number.

11.3.12 Function 0Eh: Write Character

Writes the specified character to the current cursor position in the current display page. In text modes, the attribute byte is not modified. The cursor is moved to the next screen position, and the screen is scrolled up if necessary. Special ASCII characters, like carriage return and backspace, are interpreted as control codes and will modify the cursor position accordingly.

Inputs
  • AH = 0Eh

  • AL = ASCII code.

  • BL = Foreground color (valid only in graphics modes).

Outputs
  • (None)

11.3.13 Function 10h: VGA Color Functions

Color in VGA modes is quite complicated because it is based on a palette of colors. There are 256 DAC (Digital-to-Analog Converter) registers. Each of these 18-bit registers contains an RGB (Red, Green, Blue) color value. These registers define the basic color palette used in 256-color modes. register. Each palette register corresponds to one color number in video memory. For example, if the bitmap contains color number 17 for a certain pixel, then DAC register #17 determines what color will be generated for the pixel.

It is possible to set the DAC registers by using either Interrupt 10h functions (listed below) or by directly accessing the VGA card using port I/O. See Example 11-1 for code that sets the palette using port I/O. For more information on VGA graphics, see Section 11.2.

11.3.13.1 Subfunction 00h: Set Border (Overscan) Color

Sets the color of the border around the screen.

Inputs
  • AX = 1001h

  • BH = DAC register number (0-255).

Outputs
  • (None)

11.3.13.2 Subfunction 10h: Set Individual DAC Register

Sets the RGB (Red, Green, Blue) values for one of the DAC (Digital-to-Analog Converter) registers.

Inputs
  • AX = 1010h

  • BX = DAC register number (0-255).

  • DH = Red value (0-63).

  • CH = Green value (0-63).

  • CL = Blue value (0-63).

Outputs
  • (None)