Help Menu

Appendix B - DOS 10H, 21H, and 33H Interrupt Parameters

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

Appendix B: DOS 10H, 21H, and 33H Interrupt Parameters
Overview
This appendix contains the most popular DOS, BIOS, and Mouse interrupts and parameters.
Screen Control with BIOS-Type 10H Interrupts
Syntax: INT 10H (when the following parameters are set to the required values).
Interface Control of the CRT
AH Value
Function
Input
Output
AH = 0
Set the mode of display
AL = 0
40 25 color text
AL = 1
40 25 color text
AL = 2
80 25 color text
AL = 3
40 25 color text
AL = 4
320 200 4-color graphics
AL = 5
320 420 4-color graphics
AL = 6
640 200 2-color graphics
AL = 7
80 25 monochrome text
AL = 13
320 200 16-color graphics
AL = 14
640 200 16-color graphics
AL = 15
640 350 monochrome graphics
AL = 16
640 350 16-color graphics
AL = 17
640 480 2-color graphics
AL = 18
640 480 16-color graphics
AL = 19
320 200 256-color graphics
AH = 1
Set cursor type
CH =
Bits 4–0 start of line for cursor
CL =
Bits 4–0 end of line for cursor
AH = 2
Set cursor position
DH =
Row
DL =
Column
BH =
Page number of display (0 for graphics)
AH = 3
Read cursor position
DH = row
DL = column
CH = cursor mode
CL = cursor mode
BH = page number of display
AH = 4
Get light pen position
AH = 0, switch not down/triggered
AH = 1, valid answers
as follows:
   DH = row
   DL = column
   CH = graph line
    (0 to 99)
   BX = graph column
    (0 to 319/639)
AH = 5
Set active display page
AL =
New page value
(0 to 7) modes 0 and 1
(0 to 3) modes 2 and 3
AH = 6
Scroll active page up
AL =
Number of lines, 0 for
entire screen
CH =
Row, upper-left corner
CL =
Column upper-left corner
DH =
Row, lower-right corner
DL =
Column, lower-right corner
BH =
Attribute to be used
AH = 7
Scroll active page down
AL =
Number of lines, 0 for
entire screen
CH =
Row, upper-left corner
CL =
Column, upper-left corner
DH =
Row, lower-right corner
DL =
Column, lower-right corner
BH =
Attribute to be used
Handling Characters
AH Value
Function
Input
Output
AH = 8
Read attribute/
character at cursor position
BH =
AL =
AH =
Display page
Character read
Attribute of character
AH = 9
Write attribute/
character at cursor position
BH =
CX =
AL =
BL =
Display page
Count of characters to write
Character to write
Attribute of character
AH = 10
Write character at
cursor position
BH =
CX =
AL =
Display page
Count of characters to write
Character to write
Graphics Interface
AH Value
Function
Input
Output
AH = 11
Select color palette
BH =
Palette ID (0 to 127)
BL =
Color for above ID
    0—background (0 to 15)
   1—palette
   0—green(1), red(2), yellow(3)
   1—cyan(1), magenta(2),
    white(3)
AH = 12
Draw dot on screen
DX =
Row (0 to 199)
CX =
Column (0 to 319/639)
AL =
Color of dot
AH = 13
Read dot information
DX =
Row (0 to 199)
CX =
Column (0 to 319/639)
AL =
Value of dot
ASCII Teletype Output
AH Value
Function
Input
Output
AH = 14
Write to active page
AL =
Character to write
BL =
Foreground color
AH = 15
Get video state
AL =
Current mode
AH =
Number of screen columns
BH =
Current display page
AH = 16
(Reserved)
AH = 17
(Reserved)
AH = 18
(Reserved)
AH = 19
Write string
ES:BP =
Point to string
CX =
Length of string
DX =
Cursor position for start
BH =
Page number
AL = 0
BL = attribute (char, char, char,...char) cursor not moved
AL = 1
BL = attribute (char, char, char,...char) cursor is moved
AL = 2
(char, attr, char, attr...) cursor
not moved
AL = 3
(char, attr, char, attr...) cursor
is moved
AH = 1A
R/W display combination code
AH = 1B
Return functionality state information
AH = 1C
Save/restore video state
Specifications and Requirements for the
DOS 21H Interrupt
Syntax: INT 21H (when the following parameters are set to the required values).
AH Value
Function
Input
Output
AH = 0
End of program
(similar to INT 20H)
AH = 1
Wait and display keyboard character
with CTRL-BREAK check
AL = character entered
AH = 2
Display character with CTRL-BREAK check
DL =
Character to display
AH = 3
Asynchronous character input
AL = character entered
AH = 4
Asynchronous character output
DL =
Character to send
AH = 5
Character to write
DL =
Character to write
AH = 6
Input keyboard
character
DL =
0FFH if character entered,
0 if none
AH = 7
Wait for keyboard character (no display)
AL = character entered
AH = 8
Wait for keyboard character (no display— CTRL-BREAK check)
AL = character entered
AH = 9
String displayed
DS:DX
Address of string; must end with $ sentinel
AH = A
Keyboard string to
buffer
DS:DX =
Address of buffer. First byte = size, second = number of characters read
AH = B
Input keyboard status
AL–no character
      = 0FFH
      character = 0
AH = C
Clear keyboard buffer and call function
AL =
1,6,7,8,0,A (function #)
AH = D
Reset default disk drive
None
None
AH = E
Select default disk drive
Al = number of drives
DL–0 = A drive
       1 = B drive, etc.
AH = F
Open file with
unopened FCB
DS:DX =
Location
AL = 0FFH if not found
AL = 0H if found
AH = 10
Close file with FCB
DS:DX =
Location
(same as AH = OFH)
AH = 11
Search directory for match of unopened FCB


DS:DX =
AL = 0FFH if not found
00000AL = 0H if found
Location
DTA contains directory entry
AH = 12
Search (after AH = 11) for other files that match wildcard specifications
(Same as AH = 11H)
AH = 13
Delete file named
by FCB
DS:DX =
Location
(same as AH = 11H)
AH = 14
Sequential read of open file. Number of bytes in FCB (record size)
DS:DX =
Location
AL = 0 transfer OK
AL = 1 end of file
AL = 2 overrun DTA segment
AL = 3 EOF/partial read
AH = 15
Sequential write of
open file. Transfer from DTA to file, with FCB update of current record
DS:DX =
Location
AL = 0 transfer OK
AL = 1 disk full/ROF
AL = 2 overrrun DTA segment
AH = 16
Create file (length set
to zero)
DS:DX =
Location
(same as AH = 11H)
AH = 17
Rename file
DS:DX
Location
AL = 0 rename OK
AL = 0FFH no match found
AH = 18
(DOS internal use)
AH = 19
Drive code (default)
AL–0 = A drive
      1 = B drive, etc.
AH = 1A
Set Data Transfer Add
DS:DX =
Points to location
AH = 1B
File Allocation Table
DS:DX =
Address of FAT
DX = number of units
AL = record/alloc. unit
CX = sector size (same as
AH = 1B)
AH = 1C
Disk drive FAT information
DL =
Drive number: 0 = default,
1 = A, 2 = B
AH = 1D
(DOS internal use)
AH = 1E
(DOS internal use)
AH = 1F
(DOS internal use)
AH = 20
(DOS internal use)
AH = 21
Random read file
DS:DX =
Location of FCB
(same as AH = 14H)
AH = 22
Random write file
DS:DX =
(same as AH = 21H)
AH = 23
Set file size
DS:DX =
Location of FCB
AL = 0 if set
AL = 0FFH if not set
AH = 24
Random record size
DS:DX =
Location of FCB
AH = 25
Set interrupt vector (change address)
DS:DX =
AL =
Address of vector table
Interrupt number
AH = 26
Create program segment
DX =
Segment number
AH = 27
Random block read
DS:DX =
Address of FCB
AL–0 read OK
      1 EOF
      2 wrap around
      3 partial record
AH = 28
Random block write
DS:DX =
Address of FCB
AL–0 write OK
      1 lack of space
AH = 29
Parse file name
DS:SI =
DS:DI =
Point to command line
Memory location for FCB
AL = bits to set options
AH = 2A
Read date
CX = year (80 to 99)
DH = month (1 to 12)
DL = day (1 to 31)
AH = 2B
Set date
CX and DX (same as previous)
AL–0 if valid
0FF if not valid
AH = 2C
Read time
CH = hours (0 to 23)
CL = minutes (0 to 59)
AH = 2D
Set time
CX and DX (same as previous)
AL–0 if valid
0FF if not valid
AH = 2E
Set verify state
DL =
AL =
0
0 = verify off
1 = verify on
AH = 2F
Get DTA
ES:BX =
Get DTA into ES
AH = 30
Get DOS version
AL = version number
AH = sub number
AH = 31
Terminate and remain resident
AL = exit code
DX = memory size in paragraphs
AH = 32
(DOS internal use)
AH = 33
CTRL-BREAK check
AL =
AL =
0 = request state
1 = set the state
DL = 0 for off
DL = 1 for on
AH = 34
(DOS internal use)
AH = 35
Read interrupt address
AL =
Interrupt number
ES:BX point to vector address
AH = 36
Disk space available
DL =
Drive (0 = default, 1 = A,
2 = B, etc.)
AX = sectors/cluster (FFFF if invalid)
BX = number of free clusters
CX = bytes per sector
DX = total number of clusters
AH = 37
(DOS internal use)
AH = 38
Country-dependent information (32-byte block)
DS:DX =
Location of memory
Date/time
Currency symbol
Thousands separator
Decimal separator
AH = 39
Make directory
DS:DX =
Address of string for directory
AH = 3A
Remove directory
DS:DX =
Address of string for directory
AH = 3B
Change directory
DS:DX =
Address of string for new directory
AH = 3C
Create a file
DS:DX =

CX =
Address of string for file
AX = file handle
File attribute
AH = 3D
Open a file
DS:DX =
AL =
Address of string for file
0 = open for reading
1 = open for writing
2 = open for both
AX returns file handle
AH = 3E
Close a file handle
BX =
File handle
AH =3F
Read a file or device
BX =
CX =
DS:DX =
File handle
Number of bytes to read
Address of buffer
AX = number of bytes read
AH = 40
Write a file or device
BX =
CX =
DS:DX =
File handle
Number of bytes to read
Address of buffer
AX = number of bytes written
AH = 41
Delete a file
DS:DX =
Address of file string
AH = 42
Move file pointer
BX =
AL =
CX:DX
DX:AX
File handle
Pointer’s starting location
Number of bytes
Current file pointer
AH = 43
Set file attribute
AL = 1
CX =
DS:DX =

Attribute
Address of file string
AH = 45
Duplicate file handle
BX
File handle
AX = returned file handle
AH = 46
Force duplicate file handle
BX
File handle
CX = second file handle
AH = 47
Current directory
DL =

DS:SI =
Drive number (0 = default,
1 = A drive, 2 = B drive)
Buffer address
DS:SI returns address of string
AH = 48
Allocate memory
BX
Number of paragraphs
AX = allocated blocks
AH = 49
Free allocated memory
ES
Segment of returned block
AH = 4A
Set block
ES
BX
Segment block
New block size
AH = 4B
Load/execute program
DS:DX
Location of ASCIIZ string (drive/path/filename)
AL–0 = load and execute
      3 = load/no execute
AH = 4C
Terminate (exit)
AL
Binary return code (all files closed)
AH = 4D
Retrieve return code
AX returns exit code of another program
AH = 4E
Find first matching file
DS:DX
Location of ASCIIZ string (drive/path/filename)
CX = search attribute
DTA completed
AH = 4F
Next matching file
(AH = 4EH called first)
AH = 50
(DOS internal use)
AH = 51
(DOS internal use)
AH = 52
(DOS internal use)
AH = 53
(DOS internal use)
AH = 54
Verify state
None
AL–0 if verify off
      1 if verify on
AH = 55
(DOS internal use)
AH = 56
Rename file
DS:DX =
ES:DI =
Address of string for old information
Address of string for new information
AH = 57
Get/set file date/time
AL

BX
DX and CX
00 (return)
01 (set)
File handle
Date and time information
AH = 59
Extended error code
BX =
DOS version (3.0 = 0)
AX = error code
BH = class of error
BL = suggested action
CH = where error occurred
AH = 5A
Create temporary file



DS:DX =
CX = file attribute
CF = Set on error
AX = error code
Points to string
AH = 5B
Create a new file
(same as previous)
  Note For DOS versions above 2.0, use AH = 36H for file management.
Mouse Control Functions Accessed
Through Interrupt 33H
Syntax: INT 33H (when the following parameters are set to the required values)
AH Value
Function
Input
Output
AX = 0
Install flag and reset
BX =
CX =
DX =
If AX = 0 and BX = –1
Mouse support not available
AX = –1, then BX = number of supported mouse buttons
AX = 1
Show pointer
BX =

CX =

DX =
Does nothing if already visible, otherwise
increments the pointer-draw flag by 1
Shows pointer image when pointer-draw flag = 0
AX = 2
Hide pointer
BX =

CX =

DX =
Does nothing if already hidden, otherwise
decrements the pointer-
draw flag
Value of –1 hides image
AX = 3
Get position and button status
BX =
CX =
DX =
For 2- or 3-button mice, BX returns which button pressed:
0 = leftmost, 1 = rightmost,
2 = center button. Button 3 to 15 reserved. CX = x coordinate;
DX = y coordinate of pointer
in pixels
AX = 4
Set pointer position
CX =

DX =
New horizontal position in pixels
New vertical position in pixels
For values that exceed screen boundaries, screen maximum and minimum are used
AX = 5
Get button press information
BX =
Button status requested, where 0 = leftmost, 1 = rightmost,
2 = center button.
AX–bit 0 (leftmost) = 0 or 1        bit 1 (rightmost) = 0 or 1
       bit 2 (center) = 0 or 1
If 0 button up, and if 1 button down. BX = number of
times button pressed since last call
CX = horizontal coordinate of mouse
DX = vertical coordinate
of mouse
AX = 6
Get button release information
BX =
Button status requested, same format as for AX = 5 previosly described. AX, BX, CX, and DX as previously described. If 0, button up; 1 if button down
AX = 7
Set minimum and maximum horizontal position
CX =


DX =
Minimum virtual-screen horizontal coordinate
in pixels
Maximum virtual-screen horizontal coordinate
in pixels
AX = 8
Set minimum and maximum vertical position
DX =
Maximum virtual-screen vertical coordinate in pixels
AX = 9
Set graphics pointer
block
BX=

CX =

DX =

ES =
Pointer hot-spot horizontal coordinate in pixels
Pointer hot-spot vertical coordinate in pixels
Address of screen/pointer masks
Segment of screen/pointer masks
AX = 10
Set text pointer
BX =
CX =

DX =
Pointer select value
Screen mask value/hardware cursor start scan line
Pointer mask value/ hardware cursor stop scan line
BX = 0 select software text pointer
BX = 1 select hardware cursor CX and DX bit map to:
0 to 7 character
8 to 10 foreground color
11 intensity
12 to 14 background color
15 blinking
AX = 11
Read mouse motion counters
BX =
CX =
DX =
CX = horizontal count
DX = vertical count
Range –32,768 to +32, 768 read in mickeys
AX = 12
Set user-defined subroutine
CX =
DX =
ES =
Call mask
Offset of subroutine
Segment of subroutine CX word bit map:
0 pointer position changed
1 leftmost button pressed
2 leftmost button released
3 rightmost button pressed
4 rightmost button released
5 center button pressed
6 center button released
7 to 15 reserved = 0
Following values loaded when subroutine is called:
AX = condition of mask
BX = button status
CX = pointer horizontal coordinate
DX = pointer vertical coordinate
SI = last vertical mickey count read
DI = last horizontal mickey count read
AX = 13
Light pen emulation on
BX =

CX =
DX =
Instructs mouse driver to emulate a light pen
Vertical mickey/pixel ratio
Ratios specify number of mickeys per 8 pixels
AX = 14
Light pen emulation off
BX =
CX =
DX =
Disables mouse driver light pen emulation
(Same as AX = 13)
AX = 15
Set mickey/pixel ratio
CX =
DX =
Horizontal mickey/pixel ratio
(Same as AX = 13)
AX = 16
Conditional off
CX =
DX =
SI =
DI =
Left column coordinate
in pixels
Upper row coordinate
in pixels
Right column coordinate
in pixels
Lower row coordinate
in pixels
Defines an area of the screen for updating
AX = 19
Set double speed threshold
BX =
DX =
Doubles pointer motion
Threshold speed in mickeys/second
AX = 20
Swap user-defined subroutine
CX =
DX = ES =
Call mask Offset subroutine
Segment of subroutine
Sets hardware interrupts for call mask and subroutine address, returns previous values CX word call mask:
0 pointer position changed
1 leftmost button pressed
2 leftmost button released
3 rightmost button pressed
4 rightmost button released
5 center button pressed
6 center button released
7 to 12 reserved = 0
Following values loaded when subroutine is called:
AX = condition of mask
BX = button status
CX = pointer horizontal
coordinate
DX = pointer vertical
coordinate
SI = last vertical mickey
count read
DI = last horizontal mickey
count read
AX = 21
Get mouse state storage requirements
BX =
CX =
DX =
Gets size of buffer in bytes needed to store state of the mouse driver
BX = size of buffer in bytes
AX = 22
Save mouse driver state
BX =
CX =
DX =
ES =
Saves the mouse driver state
Offset of buffer
Segment of buffer
AX = 23
Restore mouse driver
state
BX =
CX =
DX =
ES =
Restores the mouse driver state from a user buffer
Offset of buffer
Segment of buffer

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net