INTERRUPT 10H (VIDEO ENTRY POINT)

ID (AH) Description
00h SET VIDEO MODE
01h SET CURSOR TYPE
02h SET CURSOR POSITION
03h READ CURSOR POSITION
04h READ LIGHT PEN
05h SELECT ACTIVE DISPLAY PAGE
06h SCROLL ACTIVE PAGE UP
07h SCROLL ACTIVE PAGE DOWN
08h READ CHAR & ATTRIBUTE AT CURSOR POSITION
09h WRITE CHAR & ATTRIBUTE AT CURSOR POSITION
0Ah WRITE CHAR AT CURSOR POSITION
0Bh SET COLOR PALETTE
0Ch WRITE DOT
0Dh READ DOT
0Eh WRITE TELETYPE
0Fh READ CURRENT VIDEO STATE

SET VIDEO MODE (AH – 00H)

NAME
SET VIDEO MODE

SYNOPSIS

  • mov AH,00h
  • mov AL,VIDEO MODE (0-7)
  • int 10h

FUNCTION

  • Sets the video mode.

Possible VIDEO MODEs (0-7)

Values
for video mode
text text
pixel
grph
resol
colors pages addr system
00h T ? 40 x 25 b/w ? B800h alpha
01h T ? 40 x 25 16 ? B800h
02h T ? 80 x 25 b/w ? B800h
03h T ? 80 x 25 16 ? B800h
04h G ? 320 x 200 4 ? B800h
05h G ? 320 x 200 4 ? B800h
06h G ? 640 x 200 s/w ? B800h
07h T ? 80 x 25 s/w ? B800h
Inputs Result
AH = 00h  
AL = VIDEO MODE (0-7)  

NOTES

  • When the mode is changed, the screen is cleared.
  • However, do not use this service as a "clear-screen" service, since this can take a little longer than the normal screen-clearing routines (Service 06h or 07h).
  • The cursor is not displayed in graphics mode.
  • Use INT 10h, Service 0Fh to get the current video mode.

SET CURSOR TYPE (AH – 01H)

NAME
SET CURSOR TYPE

SYNOPSIS

  • mov AH,01h
  • mov CH,START LINE OF CURSOR (BITS 0-4)
  • mov CL,END LINE OF CURSOR (BITS 0-4))
  • int 10h

FUNCTION

  • Adjusts the size of the cursor by setting its start and end lines.
Inputs Result
AH = 01h NONE
CH = CURSOR CONTROL (BITS 5-6),START LINE OF CURSOR (BITS 0-4)  
CL = END LINE OF CURSOR (BITS 0-4)  

CURSOR CONTROL OPERATION Register CH (BITS 5-6)

00 01 10 11
NON-BLINK DON'T DISPLAY CURSOR BLINK @ 1/16 FIELD RATE BLINK @ 1/32 FIELD RATE

Cursor Start and End line values Register CH (BITS 0-4) and Register CL (BITS 0-4)

Adapter Start Legal End Legal Start Default End Default
MDA 0 13 11 12
CGA 0 7 6 7

NOTES

  • Line numbering starts at the top of the character block (0) and increments downward. If you specify an end line lower than the start line, a two-part "wraparound" cursor is displayed.
  • There is only one cursor size for all video pages.
  • This service affects text-mode displays only. There is no cursor display in any graphics mode.
  • Service 03h returns the current cursor size.

SET CURSOR POSITION (AH – 02H)

NAME
Set Cursor Position

FUNCTION

  • Sets the cursor position (row and column) for a specified display page.

SYNOPSIS

  • mov AH,02h
  • mov BH,Page # if CRT mode is 0 -> 3, (0 if graphics or monochrome)
  • mov DH,Row # of cursor
  • mov DL,Column # of cursor
  • int 10h

OUTPUT: None

NOTES

  • This service can position the cursor on the active display page or on an inactive page.
  • In graphics modes, this service sets the logical position of the cursor, even though the cursor itself is not displayed (there is no cursor display in any graphics mode).
  • To make the cursor invisible, position it on row 25.
  • The upper left corner of the display is DH = 0h, DL = 0h, while the lower right corner is DH = 18h (24), DL = 27h (39) for 40-column mode or 4Fh (79) for 80-column mode.
  • See Service 05h for a list of legal page numbers for the different display modes. Because the service does no value checking, erratic results can occur if you specify an illegal page number. The page number for graphics modes is 0.

READ CURSOR POSITION (AH – 03H)

NAME
Read Cursor Position and Size

FUNCTION

  • Reports the cursor position (row and column) and size for a specified display page
Inputs Result
AH = 03h DH = ROW LOCATION OF CURSOR
BH = ACTIVE DISPLAY PAGE ignored and set to 0 if graphics or monochrome mode) DL = COLUMN LOCATION OF CURSOR
CL = END LINE OF CURSOR (BITS 0-4) CX = CURSOR TYPE

OUTPUT: AX = Undefined (however, we return it unchanged)

NOTES

  • This service can report the position of the cursor on the active display page or on an inactive page. Since there is only one hardware cursor, the cursor start line (CH) and cursor end line (CL) (and hence the size of the cursor) will be the same no matter what page number is specified.
  • In graphics modes, this service reports the logical position of the cursor, even though the cursor itself is not displayed.
  • The upper left corner of the display is DH = 0h, DL = 0h, while the lower right corner is DH = 18h (24), DL = 27h (39) for 40-column mode or 4Fh (79) for 80-column mode.
  • See Service 05h for a list of legal page numbers for the different display modes. Because the service does no value checking, erratic results can occur if you specify an illegal page number. The page number for graphics modes is 0.
  • Use Service 02h to set the current cursor position.
  • Use Service 01h to set the current cursor size.

READ LIGHT PEN (AH – 04H)

NAME
READ LIGHT PEN

FUNCTION

  • Reports the position and status of the light pen.
Inputs Result
AH = 03h AH = 0 if light pen not triggered. 1 if it is
None DH = Character row of light pen
DL = Character column of light pen
CH = Pixel row
BX = Pixel column, best estimate

OUTPUT: AX = None

NOTES

  • The position is reported in two forms: the character position (row in DH, column in DL), and the pixel location (raster line in CH, column/dot in BX).
  • The pixel coordinates for the light pen position are not precise. The y coordinate is always a multiple of 2, while the x coordinate is a multiple of 4 for the 320 x 200 graphics mode and a multiple of 8 for the 640 x 200 graphics mode.

SELECT ACTIVE DISPLAY PAGE (AH = 05H)

NAME
SELECT ACTIVE DISPLAY PAGE

FUNCTION

  • Sets the active display page.
Inputs Result
AH = 05h None
AL = Display page number

OUTPUT: AX = (?)

Legal Page Values (AL)

Video Mode Legal Pages
00h 0-7
01h 0-7
02h 0-7
03h 0-3
04h 0
05h 0
06h 0
07h 0

NOTES

  • The contents of a display page are not destroyed when the current display page is changed. In fact, you can write to an inactive page, then switch to it--thereby producing fast screen updates.
  • Use Service 0Fh to determine the current active display page.

SCROLL ACTIVE PAGE UP (AH = 06H)

NAME
SCROLL ACTIVE PAGE UP

FUNCTION

  • Scrolls a specified window upward a specified number of lines.
Inputs Result
AH = 06h None
AL = LINES TO SCROLL (CLEAR WINDOW IF 0)
BH = ATTRIBUTE FOR BLANK LINE{S)
CH = Row number of upper left corner
CL = Column number of upper left corner
DH = Row number of lower right corner
DL = Column number of lower right corner

OUTPUT: None

NOTES

  • Lines are inserted at the bottom with all lines moving up. The new lines are filled with blank characters of a specified display attribute (value in BH). The lines that disappear at the top of the window are lost.
  • If the number of lines to scroll is specified as 0, the entire window is filled with blanks.
  • This service affects only the currently active display page.

SCROLL ACTIVE PAGE DOWN (AH = 07H)

NAME
SCROLL ACTIVE PAGE DOWN

FUNCTION

  • Scrolls a specified window downward a specified number of lines.
Inputs Result
AH = 07h None
AL = Number of lines to scroll (if 0, clear entire window)
BH = Display attribute for blank lines
CH = Row number of upper left corner
CL = Column number of upper left corner
DH = Row number of lower right corner
DL = Column number of lower right corner

OUTPUT: None

NOTES

  • Lines are inserted at the top with all lines moving down. The new lines are filled with blank characters of a specified display attribute (value in BH). The lines that disappear at the bottom of the window are lost.
  • If the number of lines to scroll is specified as 0, the entire window is filled with blanks.
  • Use Service 06h to scroll the window up.
  • This service affects only the currently active display page.

READ CHAR & ATTRIBUTE AT CURSOR POSITION (AH = 08H)

NAME
READ CHAR & ATTRIBUTE AT CURSOR POSITION

FUNCTION

  • Reports the ASCII value and (in text mode) attribute of the character at the current cursor location of the specified display page.
Inputs Result
AH = 08h AL = CHARACTER(text mode)
BH = ACTIVE DISPLAY PAGE (if recognized, else 0) AH = ATTRIBUTE (text mode) (If recognized, else 0)
AL = CHAR READ (GRAPHICS MODE)(if recognized, else 0)
AH = ATTRIBUTE (GRAPHICS MODE) (If recognized, else 0)All characters above 80h are recognized if the RAM font vector is other than 0, else not

NOTES

  • In graphics mode, the display page need not be specified.
  • The current character and attribute can be obtained for any page, even if the page is not the current active page.
  • In graphics mode, the service returns 00h in AL if it does not recognize the character pattern.
  • Use Service 09h to write a character with a specific attribute.

WRITE CHAR & ATTRIBUTE AT CURSOR POSITION (AH = 09H)

NAME
WRITE CHAR & ATTRIBUTE AT CURSOR POSITION

FUNCTION

  • Displays a specified character with a specified attribute a specified number of times.
Inputs Result
AH = 09h None
AL = CHAR TO WRITE
BL = CHARACTER ATTRIBUTE
BH = ACTIVE DISPLAY PAGE
CX = NUMBER OF TIMES TO WRITE CHARACTER

NOTES

  • Display begins at the current cursor location on the specified display page, but the cursor itself is not moved.
  • In text mode, characters extending beyond the right side of the screen wrap to the next line; in graphics mode, they do not.
  • This service displays control characters as printable characters, rather than as their cursorcontrol equivalents. For example, if AL is 13, then the musical note will be displayed, rather than a Carriage Return.
  • In graphics modes, if the attribute (BL) is given with bit 7 set, the color bits of the character displayed are XORed with the color bits of the current character. You can use this feature to write characters and then erase them.
  • The difference between this service and Service 0Ah is that this service allows the user to specify the display attribute byte.

WRITE CHAR AT CURSOR POSITION (AH -0AH)

NAME
WRITE CHAR AT CURSOR POSITION

FUNCTION

  • Displays a specified character a specified number of times.
Inputs Result
AH = 0Ah None
AL = CHAR TO WRITE
BH = ACTIVE DISPLAY PAGE
BL = Character Attribute if in a graphics mode otherwise ignored
CX = NUMBER OF TIMES TO WRITE CHARACTER

NOTES

  • Display begins at the current cursor location on the specified display page, but the cursor itself is not moved.
  • Use Service 09h for graphics modes, since it allows the changing of colors.
  • In text mode, characters extending beyond the right side of the screen wrap to the next line; in graphics mode, they do not.
  • This service displays control characters as printable characters, rather than as their cursor control equivalents. For example, if AL is 13, then the musical note will be displayed, rather than a Carriage Return.
  • The difference between this service and Service 09h is that this service doesn't allow the specifying of the display attribute byte. This service uses the current attribute at the cursor for the new character.

SET COLOR PALETTE (AH – 0BH)

NAME
SET COLOR PALETTE

FUNCTION

  • Selects color palette for various display modes.
Inputs Result
AH = 0Bh None
BH = 0 FOR BACKGROUND COLOR IN BL
     1 FOR COLOR SET NUMBER IN BL
BL = BITS 0-4 IF BH = 0
     0 FOR COLOR SET GREEN/RED/YELLOW IF BH = 1
     1 FOR COLOR SET CYAN/MAGENTA/WHITE IF BH = 1

If BH (Palette Color ID) is 0, then:

  • Sets background color for 320 x 200 graphics modes
  • Sets border color for text modes
  • Sets foreground color for 640 x 200 graphics modes

BL contains the color to use. The CGA will set the background color for 640 x 200 graphics modes.

When setting the border color for text modes, colors 16-31 will select the high-intensity background set.

If BH (Palette Color ID) is 1, then:

  • Selects the palette for 320 x 200 graphics modes

The value in BL determines which palette combination to use, as defined below:

Palette 0 (BL = 0)

Pixel ValueColor
0Current background color
1Green
2Red
3Brown

Palette 1 (BL = 1)

Pixel ValueColor
0Current background color
1Cyan
2Magenta
3White


WRITE DOT (AH=0CH)

NAME
WRITE DOT

FUNCTION

  • Writes a pixel dot of a specified color at a specified screen coordinate.
Inputs Result
AH = 0Ch AH = ?
AL = COLOR VALUE
CX = COLUMN NUMBER (MODE DEPENDENT) Horizontal position of pixel
DX = ROW NUMBER (MODE DEPENDENT) Vertical position of pixel

Legal values

ModeCX (Horizontal)DX (Vertical)AL (Pixel Color)BH (Page Number)
04h 0-319 0-199 0-3
05h 0-319 0-199 0-3
06h 0-639 0-199 0-1

NOTES

  • If the pixel color (AL) is specified with bit 7 set, the color bits of the pixel are XORed with the color bits of the current pixel at the specified coordinate. You can use this feature to write characters and then erase them.


READ DOT (AH=0DH)

NAME
READ DOT

FUNCTION

  • Reports the color of the pixel at a specified screen coordinate.
Inputs Result
AH = 0Dh AL = COLOR VALUE
CX = COLUMN NUMBER (MODE DEPENDENT) Horizontal position of pixel
DX = ROW NUMBER (MODE DEPENDENT) Vertical position of pixel

Legal values

ModeCX (Horizontal)DX (Vertical)AL (Pixel Color)BH (Page Number)
04h 0-319 0-199 0-3
05h 0-319 0-199 0-3
06h 0-639 0-199 0-1

NOTES

  • -

WRITE TELETYPE (AH = 0EH)

NAME
WRITE TELETYPE

FUNCTION

  • Write Character in Teletype (TTY) Mode
Inputs Result
AH = 0Eh None
AL = CHARACTER TO BE WRITTEN
BL = FOREGROUND COLOR OF CHAR (USED ONLY IN GRAPHICS MODE)
BH = REQUESTED DISPLAY PAGE (REALLY IS IGNORED)

NOTES

  • In text modes, the character displayed retains the display attribute of the previous character that occupied the screen location. In graphics modes, it is necessary to specify the foreground color (in BL) each time you call this service.
  • In text modes, characters may be written to display pages other than the active page.
  • This service responds to the ASCII meanings of characters 07h (bell), 08h (backspace), 0Ah (line feed), and 0Dh (carriage return). All other ASCII values result in the displaying of a character, with the cursor moving one position.
  • If the cursor is at the end of a line, it wraps to the next line. If the cursor is at the end of the last screen line, the screen is scrolled upward and the display attribute for the entire new line is taken from the last character on the preceding line.

READ CURRENT VIDEO STATE (AH = 0FH)

NAME
READ CURRENT VIDEO STATE

FUNCTION

  • Reports the current video mode, the number of character positions per line in that video mode, and the current display page.
Inputs Result
AH = 0Fh AL = CURRENT VIDEO MODE
AH = NUMBER OF SCREEN COLUMNS
BH = ACTIVE DISPLAY PAGE

NOTES

  • See Service 00h for a table of the video modes and how to set the current video mode.

Last Update: 04.03.2024