You are on page 1of 20

Interrupt Services DOS-BIOS-EMS-Mouse

interrupt table

Interrupt Table as Implemented by System BIOS/DOS


INT # Locus Function

0 CPU divide by zero


1 CPU single step
2 CPU non-maskable
3 CPU breakpoint
4 CPU overflow trap
5 BIOS print screen
6 CPU Invalid opcode (186,286,386)
7 CPU coprocessor not available (286,386)
8 IRQ0 timer (55ms intervals, 18.21590 per second)
9 IRQ1 keyboard service required (see INT 9)
A IRQ2 slave 8259 or EGA/VGA vertical retrace
B IRQ3 COM2 service required (PS2 MCA COM3-COM8)
C IRQ4 COM1 service required
D IRQ5 fixed disk or data request from LPT2
E IRQ6 floppy disk service required
F IRQ7 data request from LPT1 (unreliable on IBM mono)
10 BIOS video (see INT 10)
11 BIOS Equipment determination (see INT 11)
12 BIOS memory size (see INT 12)
13 BIOS disk I/O service (see INT 13)
14 BIOS serial communications (see INT 14)
15 BIOS system services, cassette (see INT 15)
16 BIOS keyboard services (see INT 16)
17 BIOS parallel printer (see INT 17)
18 BIOS ROM BASIC loader
19 BIOS bootstrap loader (unreliable, see INT 19)
1A BIOS time of day (see INT 1A)
1B BIOS user defined ctrl-break handler (see INT 1B)
1C BIOS user defined clock tick handler (see INT 1C)
1D BIOS 6845 video parameter pointer
1E BIOS diskette parameter pointer (base table)
1F BIOS graphics character table
20 DOS general program termination
21 DOS function request services (see INT 21)
22 DOS terminate address (see INT 22)
23 DOS control break termination address (see INT 23)
24 DOS critical error handler (see INT 24)
25 DOS absolute disk read (see INT 25)
26 DOS absolute disk write (see INT 26)
27 DOS terminate and stay resident (see INT 27)
28 DOS idle loop, issued by DOS when idle (see INT 28)
29 DOS fast TTY console I/O (see INT 29)
2A DOS critical section and NETBIOS (see INT 2A)
2B DOS internal
2C DOS internal
2D DOS internal
2E DOS exec command from base level command
interpreter (see INT 2E)
2F DOS multiplexer (see INT 2F)
30-31 CPM far jump vector for CPM (not an interrupt)
32 reserved
33 mouse support (see INT 33)
34-3E Microsoft/Borland floating point emulation
3F overlay manager
40 BIOS hard disk
41 BIOS fixed disk 0 parameters pointer (see INT 13,9)
42 BIOS relocated video handler (EGA/VGA/PS)
43 BIOS user font table (EGA/VGA/PS)
44 BIOS first 128 graphics characters (also Netware)
45 BIOS reserved for BIOS
46 BIOS fixed disk 1 parameters ptr (see INT 13,9/INT 41)
47 BIOS reserved for BIOS
48 BIOS PCjr cordless keyboard translation
49 BIOS PCjr non-keyboard scancode translation table
4A BIOS user alarm (AT/CONV/PS2) (see INT 4A)
4B-4F BIOS reserved
50 BIOS periodic alarm from timer (PS2)
51-58 BIOS reserved
59 BIOS GSS Computer Graphics Interface
5A BIOS cluster adapter BIOS entry point
5B BIOS cluster adapter boot
5C NETBIOS NETBIOS interface, TOPS interface
5D-5F BIOS reserved for BIOS
60-67 reserved for user software interrupts
67 EMS LIM/EMS specification (see INT 67)
68 APPC
69-6B reserved by IBM
6C DOS DOS 3.2 real time clock update
BIOS system resume vector
6D-6F reserved
70 IRQ8 real time clock (AT,XT286,PS50+, see INT 15)
71 IRQ9 software redirected to IRQ2 (AT,XT286,PS50+)
72 IRQ10 reserved (AT,XT286,PS50+)
73 IRQ11 reserved (AT,XT286,PS50+)
74 IRQ12 mouse interrupt (PS50+)
75 IRQ13 numeric coprocessor NMI error (AT,XT286,PS50+)
76 IRQ14 fixed disk controller (AT,XT286,PS50+)
77 IRQ15 reserved (AT,XT286,PS50+)
78-79 unused
80-85 ROM BASIC
86-F0 DOS reserved for BASIC interpreter use
86 NETBIOS NETBIOS relocated INT 18h
E0 CPM CP/M 86 function calls
F1-FF reserved by IBM
FE-FF may be destroyed by return from protected
mode using VDISK on 286 machines (Apr 86, DDJ)

- all interrupts except the internal CPU exceptions push the


flags and the CS:IP of the next instruction onto the stack.
CPU exception interrupts are similar but push the CS:IP of the
causal instruction. 8086/88 divide exceptions are different,
they return to the instruction following the division
- interrupts are disabled upon entry into any interrupt routine and
should be enabled by the user or by an IRET
- in DOS 3.2+ hardware IRQ interrupts are re-vectored through DOS
to provide standard stack frames

INT 5 - Print Screen


no input data

related memory:

50:0 = 00 Print screen has not been called, or upon return


from a call there were no errors
= 01 Print screen is already in progress
= FF Error encountered during printing

- invoked from INT 9

INT 9 - Keyboard Interrupt (Hardware Handler)

no input data

related memory:

40:17 = updates keyboard flag byte 0


40:18 = updates keyboard flag byte 1
40:1A = queue head ptr is set to buffer start if Ctrl-Break is hit
40:1C = updates buffer tail pointer for each keystroke; sets
queue tail ptr is set to queue start if Ctrl-Break is hit
40:1E = updates keyboard buffer (32 bytes)
40:71 = updates bit 7 of the BIOS break flag if Ctrl-Break is hit
40:72 = updates reset flag with 1234H if Ctrl-Alt-Del pressed
40:96 = indicates keyboard type (AT,PS2)
40:97 = updates keyboard LED flags (AT,PS2)
FFFF:0 = reboot code called if Ctrl-Alt-Del pressed

related interrupts:

INT 05 invoked if print screen key pressed


INT 1B invoked if Ctrl-Break key sequence pressed
INT 15,85 invoked on AT if system request key is pressed
INT 15,4F invoked on machines after PC/AT with AL = scan code

- records key press and key release via IRQ1/8259 and


stores scan codes in the BIOS buffer located at 40:1C
- keyboard controllers also buffer data when interrupts are
disabled at the 8259 interrupt controller
- keyboard controller is capable of storing 16 keystrokes
even when interrupts are disabled at the 8259
- normal INT 9 execution takes approximately 500 microseconds;
at least one standard XT BIOS is known to take up to 1.3
milliseconds to execute
INT 11 - BIOS Equipment Determination / BIOS Equipment Flags
no input data

on return:
AX contains the following bit flags:

|F|E|D|C|B|A|9|8|7|6|5|4|||2|1|0| AX
| | | | | | | | | | | | | | | L____ IPL diskette installed
| | | | | | | | | | | | | | L_____ math coprocessor
| | | | | | | | | | | | L_l______ old PC system board RAM < 256K
| | | | | | | | | | | | | L_____ pointing device installed (PS2)
| | | | | | | | | | | | L______ not used on PS2
| | | | | | | | | | L_l_______ initial video mode
| | | | | | | | L_l__________ # of diskette drives, less 1
| | | | | | | L_____________ 0 if DMA installed
| | | | L_l_l______________ number of serial ports
| | | L___________________ game adapter installed
| | L____________________ unused, internal modem (PS2)
L_l_____________________ number of printer ports

- bits | & 2, system board RAM if less than 256K motherboard


00 - 16K 01 - |2K
10 - 16K 11 - 64K (normal)

- bits 5 & 4, initial video mode


00 - unused 01 - 40x25 color
10 - 80x25 color 11 - 80x25 monochrome

- bits 7 & 6, number of disk drives attached, when bit 0=1


00 - 1 drive 01 - 2 drives
10 - | drive 11 - 4 drives

- returns data stored at BIOS data location 40:10


- some flags are not guaranteed to be correct on all machines
- bit 1| is used on the PCjr to indicate serial printer

INT 12 - Memory Size Determination


no input data

on return:
AX = the number of contiguous 1k memory blocks found at startup

- contiguous memory does not include video memory or extended RAM


INT 16 - Keyboard BIOS Services

Function requested in AH, see INT 16,n where n is:

0 - Wait for keystroke and read


1 - Get keystroke status
2 - Get shift status
| - Set keyboard typematic rate (AT+)
4 - Keyboard click adjustment (AT+)
5 - Keyboard buffer write (AT/PS2 enhanced keyboards)
10 - Wait for keystroke and read (AT/PS2 enhanced keyboards)
11 - Get keystroke status (AT/PS2 enhanced keyboards)
12 - Get shift status (AT/PS2 enhanced keyboards)

- with IBM BIOS's, INT 16 functions do not restore the flags to


the pre-interrupt state to allow returning of information via
the flags register
- functions | through 12h are not available on all AT machines
unless the extended keyboard BIOS is present
- see SCAN CODES

INT 16,0 - Wait for Keypress and Read Character

AH = 00

on return:
AH = keyboard scan code
AL = ASCII character or zero if special function key

- halts program until key with a scancode is pressed


- see SCAN CODES

INT 16,1 - Get Keyboard Status

AH = 01

on return:
ZF = 0 if a key pressed (even Ctrl-Break)
AX = 0 if no scan code is available
AH = scan code
AL = ASCII character or zero if special function key

- data code is not removed from buffer


- Ctrl-Break places a zero word in the keyboard buffer but does
register a keypress.
INT 16,2 - Read Keyboard Flags

AH = 02

on return:
AL = BIOS keyboard flags (located in BIOS Data Area 40:17)

|7|6|5|4|||2|1|0| AL or BIOS Data Area 40:17


| | | | | | | L____ right shift key depressed
| | | | | | L_____ left shift key depressed
| | | | | L______ CTRL key depressed
| | | | L_______ ALT key depressed
| | | L________ scroll-lock is active
| | L_________ num-lock is active
| L__________ caps-lock is active
L___________ insert is active

- see BDA BIOS DATA AREA

INT 16,3 - Set Keyboard Typematic Rate (AT+)

AH = 0|
AL = 00 set typematic rate to default
01 increase initial delay
02 slow typematic rate by 1/2
04 turn off typematic chars
05 set typematic rate/delay

BH = repeat delay (AL=5)


0 = 250ms 2 = 750ms
1 = 500ms | = 1000ms
BL = typematic rate, one of the following (AL=5)

00 - 30.0 01 - 26.7 02 - 24.0 03 - 21.8


04 - 20.0 05 - 18.5 06 - 17.1 07 - 16.0
08 - 15.0 09 - 13.3 0A - 12.0 0B - 10.9
0C - 10.0 0D - 9.2 0E - 8.6 0F - 8.0
10 - 7.5 11 - 6.7 12 - 6.0 13 - 5.5
14 - 5.0 15 - 4.6 16 - 4.3 17 - 4.0
18 - 3.7 19 - 3.3 1A - 3.0 1B - 2.7
1C - 2.5 1D - 2.3 1E - 2.1 1F - 2.0

returns nothing

- if the typematic rate is not within range,no action is taken


- available on AT and PS2 machines with extended keyboard support
- see KEYBOARD COMMANDS

INT 16,4 - Keyboard Click Adjustment (AT+)

AH = 04
AL = 1 for click on
= 0 for click off
- available only on AT and later machines that support the extended
keyboard BIOS

INT 16,5 - Keyboard Buffer Write (AT+)

AH = 05
CH = scan code
CL = ASCII character

on return:
AL = 00 if success
01 if buffer full

- available on AT and PS2 machines with extended keyboard support


- stores normal keystroke into keyboard buffer
- will not store attribute keys like Shift, Alt, Ctrl, etc...

INT 16,10 - Extended Wait for Keypress and Read Character (AT+)

AH = 10h

on return:
AH = scan code
AL = ASCII character or zero if special function key

- available on AT and PS2 machines with extended keyboard support


- similar to INT 16,0
- see SCAN CODES

INT 16,11 - Extended Get Keyboard Status (AT+)

AH = 11h

on return:
ZF = 0 if key pressed (data waiting)
AX = 0 if no scan code is available
AH = scan code
AL = ASCII character or zero if special function key

- available on AT and PS2 machines with extended keyboard support


- data is not removed from buffer
- similar to INT 16,1
INT 16,12 - Extended Get Keyboard Status (AT+)

AH = 12h

on return:
AH = BIOS keyboard flags (BIOS Data Area location 40:18)

|7|6|5|4|||2|1|0| AH
| | | | | | | L____ left CTRL key depressed
| | | | | | L_____ left ALT key depressed
| | | | | L______ right CTRL key pressed
| | | | L_______ right ALT key depressed
| | | L________ scroll-lock depressed
| | L_________ num-lock key depressed
| L__________ caps-lock key depressed
L___________ system request key depressed

AL = BIOS keyboard flags (BIOS Data Area location 40:17)

|7|6|5|4|||2|1|0| AL
| | | | | | | L____ right shift key depressed
| | | | | | L_____ left shift key depressed
| | | | | L______ CTRL key depressed
| | | | L_______ ALT key depressed
| | | L________ scroll-lock is active
| | L_________ num-lock is active
| L__________ caps-lock is active
L___________ insert is active

- available on AT and PS2 machines with extended keyboard support


- similar to INT 16,2

- see KB FLAGS

INT 17 - Printer BIOS Services


Function requested in AH, see INT 17,n where n is:

0 - Print character
1 - Initialize printer port
2 - Read printer port status

Status flags returned in register AH

|7|6|5|4|||2|1|0| AH (status)
| | | | | | | L____ time-out
| | | | | L_l_____ unused
| | | | L________ 1 = I/O error (parallel pin 15)
| | | L_________ 1 = printer selected/on-line (parallel pin 1|)
| | L__________ 1 = out of paper (parallel pin 12)
| L___________ 1 = printer acknowledgment (parallel pin 10)
L____________ 1 = printer not busy (parallel pin 11)
- on the AT, XT 286, and PS2 when the BIOS determines the printer
is busy, INT 15,90 is executed
- all printers do not return reliable status information; bit | and
bit 7 are usually reliable.

INT 17,0 - Print Character

AH = 00
AL = character to print
DX = printer to be used (0-2)

on return:
AH = printer status

- writes character and returns status


- see INT 17,STATUS for printer status codes

INT 17,1 - Initialize Printer Port

AH = 01
DX = printer port to initialize (0-2)

on return:
AH = status

- initializes printer port and returns status


- outputs characters 0x08 and 0x0C to printer port which
reset Epson and IBM printers, but may produce undesirable
effects on other printers
- see INT 17,STATUS for printer status codes

INT 17,2 - Read Printer Port Status

AH = 02
DX = printer port to be used (0-2)

on return:
AH = status

|7|6|5|4|||2|1|0| Printer status bits


| | | | | | | L____ time out
| | | | | L_l_____ unused
| | | | L________ I/O error
| | | L_________ selected
| | L__________ out of paper
| L___________ acknowledge
L____________ not busy

- returns status of specified printer port

INT 19 - Bootstrap Loader

DL = physical drive where boot sector is located

no output

- track 0, sector 1 is loaded into address 0:7C00


and control is transferred there
- not a preferred method for rebooting by applications. A
better method is to set the word at location 40:72 to 1234h
and jump to location FFFF:0 in ROM
- memory is not cleared when rebooted through this interrupt

- see WARM BOOT

INT 1A - System and Real Time Clock BIOS Services

Function requested in AH; see also INT 1A,N where N is:

0 - Read system clock counter


1 - Set system clock counter
2 - Read real time clock time (AT,PS2)
| - Set real time clock time (AT,PS2)
4 - Read real time clock date (AT,PS2)
5 - Set real time clock date (AT,PS2)
6 - Set real time clock alarm (AT,PS2)
7 - Reset real time clock alarm (PS2)
8 - Set RTC activated power on mode (convertible,PS2)
9 - Read RTC alarm time and status (convertible,PS2)
A - Read system day counter (PS2)
B - Set system day counter (PS2)
80 - Set up sound multiplexer (PCjr only)

INT 1A,0 - Read System Clock Counter

AH = 00

on return:
AL = midnight flag, 1 if 24 hours passed since reset
CX = high order word of tick count
DX = low order word of tick count

- incremented approximately 18.206 times per second


- at midnight CX:DX is zero
INT 1A,1 - Set System Clock Counter

AH = 01
CX = high order word of tick count
DX = low order word of tick count

returns nothing

- CX:DX should be set to the number of seconds past


midnight multiplied by approximately 18.206

INT 1A,2 - Read Time From Real Time Clock (XT 286,AT,PS2)

AH = 02

on return:
CF = 0 if successful
= 1 if error, RTC not operating
CH = hours in BCD
CL = minutes in BCD
DH = seconds in BCD
DL = 1 if daylight savings time option

- on AT with BIOS before 6/10/85, DL is not returned

INT 1A,3 - Set Time on Real Time Clock (XT 286,AT,PS2)

AH = 03
CH = hours in BCD
CL = minutes in BCD
DH = seconds in BCD
DL = 1 if daylight savings time option
= 0 if standard time

returns nothing

- clock values must be in BCD


- see RTC

INT 1A,4 - Read Real Time Clock Date (XT 286,AT,PS2)

AH = 04

on return:
CH = century in BCD (decimal 19 or 20)
CL = year in BCD
DH = month in BCD
DL = day in BCD
CF = 0 if successful
= 1 if error or clock not operating

INT 1A,5 - Set Real Time Clock Date (XT 286,AT,PS2)

AH = 05
CH = century in BCD (decimal 19 or 20)
CL = year in BCD
DH = month in BCD
DL = day in BCD

returns nothing

- all values must be in BCD

INT 1A,6 - Set Real Time Clock Alarm (XT 286,AT,PS2)

AH = 06
CH = hours in BCD
CL = minutes in BCD
DH = seconds in BCD

on return:
CF = 1 if alarm already set or clock inoperable

- alarm setting is not relative like some sources claim, but the
actually clock time the interrupt should occur
- settings values must be in BCD
- when the alarm time is reached INT 4A is executed
- INT 4A vector should be replaced with address of the alarm
handling interrupt routine before setting the alarm
- INT 1A,7 should be called to disable the RTC alarm

INT 1A,7 - Disable Real Time Clock Alarm (XT,AT,PS2)

AH = 07

returns nothing

- should be called previous to setting or resetting the


RTC alarm with INT 1A,6
- see RTC
INT 1A,A - Read System Day Counter (PS2)
AH = 0Ah

on return:
CX = count of days since 1-1-1980

INT 1A,B - Set System Day Counter (PS2)

AH = 0Bh
CX = count of days since 1-1-1980

DOS Interrupt Summary

See the following for more information:

INT 20 - Program terminate


INT 21 - DOS Function Dispatcher
INT 22 - Program Terminate
INT 23 - Ctl-break exit address
INT 24 - Critical error handler address
INT 25 - Absolute disk read
INT 26 - Absolute disk write
INT 27 - Terminate but stay resident
INT 28 - DOS idle loop/scheduler (undocumented)
INT 29 - Fast character output (undocumented)
INT 2E - Execute command using base level COMMAND.COM (undoc.)
INT 2F - Multiplex interrupt (DOS 3.x+)

INT 21 - DOS Function Dispatcher


Function requested in AH; see also INT 21,N where N is:

0 - Program terminate
1 - Keyboard input with echo
2 - Display output
3 - Wait for auxiliary device input
4 - Auxiliary output
5 - Printer output
6 - Direct console I/O
7 - Wait for direct console input without echo
8 - Wait for console input without echo
9 - Print string
A - Buffered keyboard input
B - Check standard input status
C - Clear keyboard buffer, invoke keyboard function
D - Disk reset
E - Select disk
F - Open file using FCB
10 - Close file using FCB
11 - Search for first entry using FCB
12 - Search for next entry using FCB
13 - Delete file using FCB
14 - Sequential read using FCB
15 - Sequential write using FCB
16 - Create a file using FCB
17 - Rename file using FCB
18 - DOS dummy function (CP/M) (not used/listed)
19 - Get current default drive
1A - Set disk transfer address
1B - Get allocation table information
1C - Get allocation table info for specific device
1D - DOS dummy function (CP/M) (not used/listed)
1E - DOS dummy function (CP/M) (not used/listed)
1F - Get pointer to default drive parameter table (undocumented)
20 - DOS dummy function (CP/M) (not used/listed)
21 - Random read using FCB
22 - Random write using FCB
23 - Get file size using FCB
24 - Set relative record field for FCB
25 - Set interrupt vector
26 - Create new program segment
27 - Random block read using FCB
28 - Random block write using FCB
29 - Parse filename for FCB
2A - Get date
2B - Set date
2C - Get time
2D - Set time
2E - Set/reset verify switch
2F - Get disk transfer address
30 - Get DOS version number
31 - Terminate process and remain resident
32 - Get pointer to drive parameter table (undocumented)
33 - Get/set ctl-break check state & get boot drive
34 - Get address to DOS critical flag (undocumented)
35 - Get vector
36 - Get disk free space
37 - Get/set switch character (undocumented)
38 - Get/set country dependent information
39 - Create subdirectory (mkdir)
3A - Remove subdirectory (rmdir)
3B - Change current subdirectory (chdir)
3C - Create file using handle
3D - Open file using handle
3E - Close file using handle
3F - Read file or device using handle
40 - Write file or device using handle
41 - Delete file
42 - Move file pointer using handle
43 - Change file mode
44 - I/O control for devices
45 - Duplicate file handle
46 - Force duplicate file handle
47 - Get current directory
48 - Allocate memory blocks
49 - Free allocated memory blocks
4A - Modify allocated memory blocks
4B - EXEC load and execute program (func 1 undocumented)
4C - Terminate process with return code
4D - Get return code of a sub-process
4E - Find first matching file
4F - Find next matching file
50 - Set current process id (undocumented)
51 - Get current process id (undocumented)
52 - Get pointer to DOS "INVARS" (undocumented)
53 - Generate drive parameter table (undocumented)
54 - Get verify setting
55 - Create PSP (undocumented)
56 - Rename file
57 - Get/set file date and time using handle
58 - Get/set memory allocation strategy (3.x+, undocumented)
59 - Get extended error information (3.x+)
5A - Create temporary file (3.x+)
5B - Create new file (3.x+)
5C - Lock/unlock file access (3.x+)
5D - Critical error information (undocumented 3.x+)
5E - Network services (3.1+)
5F - Network redirection (3.1+)
60 - Get fully qualified file name (undocumented 3.x+)
62 - Get address of program segment prefix (3.x+)
63 - Get system lead byte table (MSDOS 2.25 only)
64 - Set device driver look ahead (undocumented 3.3+)
65 - Get extended country information (3.3+)
66 - Get/set global code page (3.3+)
67 - Set handle count (3.3+)
68 - Flush buffer (3.3+)
69 - Get/set disk serial number (undocumented DOS 4.0+)
6A - DOS reserved (DOS 4.0+)
6B - DOS reserved
6C - Extended open/create (4.x+)
F8 - Set OEM INT 21 handler (functions F9-FF) (undocumented)

- int 21 functions are called with the function number in AH


- register AX may be altered, its contents are not guaranteed
- if an error occurs, CF is set to 1 and AX contains a simple
error code; INT 21,59 can be used to determine cause.
- most INT 21 functions do not restore the flags to pre-interrupt
state to allow returning of information via the flags register

INT 21,1 - Keyboard Input with Echo

AH = 01

on return:
AL = character from standard input device

- waits for keyboard input from STDIN and echoes to STDOUT


- returns 0 for extended keystroke, then function must be
called again to return scan code
- if Ctrl-Break is detected, INT 23h is executed

INT 21,2 - Display Output

AH = 02
DL = character to output

returns nothing

- outputs character to STDOUT


- backspace is treated as non-destructive cursor left
- if Ctrl-Break is detected, INT 23h is executed

INT 21,5 - Printer Output

AH = 05
DL = character to output

returns nothing

- sends character in DL to STDPRN


- waits until STDPRN device is ready before output

INT 21,9 - Print String

AH = 09
DS:DX = pointer to string ending in "$"

returns nothing

- outputs character string to STDOUT up to "$"


- backspace is treated as non-destructive
- if Ctrl-Break is detected, INT 2|h is executed

INT 21,A - Buffered Keyboard Input

AH = 0A
DS:DX = pointer to input buffer of the format:

| max | count | BUFFER (N bytes)


| | L______ input buffer
| L____________ number of characters returned (byte)
L______________ maximum number of characters to read (byte)

returns nothing
- since strings can be pre-loaded, it is recommended that the
default string be terminated with a CR
- N bytes of data are read from STDIN into buffer+2
- max buffer size is 255, minimum buffer size is 1 byte
- chars up to and including a CR are placed into the buffer
beginning at byte 2; Byte 1 returns the number of chars
placed into the buffer (extended codes take 2 characters)
- DOS editing keys are active during this call
- INT 2| is called if Ctrl-Break or Ctrl-C detected

INT 21,B - Check Standard Input Status

AH = 0B

on return:
AL = 00 if no character available
= FF if character available

- checks STDIN for available characters


- character is not returned
- if Ctrl-Break is detected INT 23h is executed

INT 21,25 - Set Interrupt Vector

AH = 25h
AL = interrupt number
DS:DX = pointer to interrupt handler

returns nothing

- provides a safe method for changing interrupt vectors

INT 21,2A - Get Date

AH = 2A

on return:
AL = day of the week (0=Sunday)
CX = year (1980-2099)
DH = month (1-12)
DL = day (1-|1)

- retrieves system date based on the DOS maintained clock


INT 21,2B - Set Date

AH = 2B
CX = year (1980-2099)
DH = month (1-12)
DL = day (1-31)

on return:
AL = 00 if date change successful
= FF if invalid date

- sets DOS maintained clock


- DOS version 3.3+ also update CMOS date where applicable

:int 21,2c
^INT 21,2C - Get Time

AH = 2C

on return:
CH = hour (0-23)
CL = minutes (0-59)
DH = seconds (0-59)
DL = hundredths (0-99)

- retrieves DOS maintained clock time

INT 21,2D - Set Time

AH = 2D
CH = hour (0-2|)
CL = minutes (0-59)
DH = seconds (0-59)
DL = hundredths (0-99)

on return:
AL = 00 if time change successful
= FF if time invalid

- changes DOS maintained clock


- DOS version |.|+ also update CMOS clock where applicable
INT 21,3F - Read From File or Device Using Handle

AH = 3F
BX = file handle
CX = number of bytes to read
DS:DX = pointer to read buffer

on return:
AX = number of bytes read is CF not set
= error code if CF set (see DOS ERROR CODES)

- read specified number of bytes from file into buffer DS:DX


- when AX is not equal to CX then a partial read occurred due
to end of file
- if AX is zero, no data was read, and EOF occurred before read

INT 21,40 - Write To File or Device Using Handle

AH = 40h
BX = file handle
CX = number of bytes to write
DS:DX = pointer to write buffer

on return:
AX = number of bytes written if CF not set
= error code if CF set (see DOS ERROR CODES)

- if AX is not equal to CX on return, a partial write occurred

INT 21,4C - Terminate Process With Return Code

AH = 4C
AL = return code (for batch files)

returns nothing

- approved method of program termination


- restores the terminate, ctl-break, and critical error exit
addresses, flushes all buffers, frees memory and returns to
DOS via the termination handler address
- does not close FCBs
- this function is not supported in versions of DOS before 2.x,
so to exit use INT 21,0 or INT 20.

- see INT 20 INT 27 INT 21,0 INT 21,31

INT 33 - Mouse Function Calls

%Function request in AX; see also INT 33,N where N is:

00 Mouse Reset/Get Mouse Installed Flag


01 Show Mouse Cursor
02 Hide Mouse Cursor
03 Get Mouse Position and Button Status
04 Set Mouse Cursor Position
05 Get Mouse Button Press Information
06 Get Mouse Button Release Information
07 Set Mouse Horizontal Min/Max Position
08 Set Mouse Vertical Min/Max Position
09 Set Mouse Graphics Cursor
0A Set Mouse Text Cursor
0B Read Mouse Motion Counters
0C Set Mouse User Defined Subroutine and Input Mask
0D Mouse Light Pen Emulation On
0E Mouse Light Pen Emulation Off
0F Set Mouse Mickey Pixel Ratio
10 Mouse Conditional OFF
13 Set Mouse Double Speed Threshold
14 Swap interrupt subroutines
15 Get mouse driver state and memory requirements
16 Save mouse driver state
17 Restore mouse driver state
18 Set alternate subroutine call mask and address
19 Get user alternate interrupt address
1A Set mouse sensitivity
1B Get mouse sensitivity
1C Set mouse interrupt rate (InPort only)
1D Set mouse CRT page
1E Get mouse CRT page
1F Disable mouse driver
20 Enable mouse driver
21 Reset mouse software
22 Set language for messages
23 Get language number
24 Get driver version, mouse type & IRQ number

- a mickey is 1/200 inches


- for additional information see your vendor documentation
- function number occupies all of AX rather than AH

You might also like