Common Software Interrupt Services (MS-DOS)


Operating system software service routines are handled in the same way as hardware interrupt service rountines except that an instruction is used to generate the interrupt for software services.


8088 INTERRUPTS

"MS-DOS" (high-level) Services

"DOS Services" (as opposed to low-level or hardware-level services) are provided through software interrupt number 21(hex.); the specific service being requested is indicated by pre-setting the AH register with a code before performing the "int 21h". The following is a list of a few of the common services available (do not memorize the numbers in this list):
AH = 01h : KEYBOARD INPUT AND DISPLAY
Wait for keyboard character; echo character on display; return ASCII code for character in AL. Terminate program if Ctrl-C or Ctrl-Break is typed.
AH = 07h : KEYBOARD INPUT WITH NO ECHO
Wait for keyboard character; returns ASCII code for character in AL. Does not check for Ctrl-C or Ctrl-Break.
AH = 0Bh : KEYBOARD STATUS
If a character is available from the keyboard, returns FFh in AL; otherwise returns 00h in AL.
AH = 02h : DISPLAY CHARACTER
Display character with ASCII code pre-stored in DL.
AH = 09h : DISPLAY STRING
Display string of characters found in memory starting at the address given by [DS:DX] and ending with a "$" (an ASCII$ string); the "$" character is not displayed.
AH = 4Ch : TERMINATE PROGRAM WITH ERRORLEVEL
Terminate program execution and return an "errorlevel" code equal to the value in the AL register; a value of 00h normally is used to indicate a normal (non-abort) program termination. For .COM-style programs (only) an alternate method of program termination is with a different interrupt, "int 20h"; note that this method only works properly with .COM programs and does not allow for a return code value.

(Do not memorize the numbers in the above list.)

Note the "keyboard" and "display" services described above really apply to "standard input" and "standard output" and thus allow for "piping" to/from other programs or "redirection" to/from files.