DOS Function
DOS Function
DOS Functions
DOS Service
In assembly language DOS functions and interrupts are used for input/output services. An interrupt occurs when any currently executing program is disturbed (interrupted). Interrupts are generated for a variety of reasons, usually related to peripheral devices such as keyboard, disk drive or printer. The Intel 8086 microprocessor recognizes two types of interrupts; hardware and software.
Hardware interrupt is generated when a peripheral device needs attention from microprocessor. A software interrupt is a call to subroutine located in the operating system, usually an input-output routine. i.e. a software interrupt calls a built-in subroutine from the operating system usually DOS for input and output operations.
02H
05H
06H
07H
09H 0AH
0BH
OCH
4CH
Clear key board buffer and invoke input functions: The input functions are stored in AL and other registers should hold the values as required.
Return control to operating system (stop program).
INT 21H/AH=01H
Read character from standard input, with echo, result is stored in AL. If there is no character in the keyboard buffer, the function waits until any key is pressed. Example:
MOV AH, 01H INT 21H
INT 21H/AH=02H
Write character to standard output. Entry: DL = character to write, after execution AL= DL. Example:
MOV AH, 02H MOV DL, a INT 21H
INT 21H/AH=09H
Output a string at DS:DX. String must be terminated by $. Example:
ORG 100H MOV DX, OFFSET MSG MOV AH, 09H INT 21H RET MSG DB hellow world $
INT 21H/AH=0AH
Input of a string to DS:DX, first byte is buffer size, second byte is number of chars actually read. This function does not add $ in the end of string. To print using INT 21H/AH=09H, you must set dollar character at the end of it and start printing from address DS:DX + 2 This function does not allow to enter more character than the specified buffer size.
INT 21H/AH=0AH
Example:
Org 100h MOV DX, OFFSET BUFFER MOV AH, 0AH INT 21H JMP PRINT BUFFER DB 10,?, 10 DUP( ) PRINT: XOR BX, BX MOV BL, BUFFER[1] MOV BUFFER*BX=2+, $ MOV DX, OFFSET BUFFER+2 MOV AH, 09H INT 21H RET
INT 21H/AH=4CH
Return control to the operating system (stop program). Example:
MOV AH, 4CH INT 21H
INT 10H
The INT 10H BIOS interrupt is often called video service interrupt. It directly controls the video display in a system. The INT 10H instruction uses register AH to select the video service provided by the interrupt. The video BIOS ROM is located on the video board and varies from one video card to another.
INT 10H/AH=00H
Set video mode. Input:
AL = desired video mode Supported video modes are:
00h text mode: 40x25. 16 colors. 8 pages. 03h text mode. 80x25. 16 colors. 8 pages. 13h graphical mode. 40x25. 256 colors. 320x200 pixels. 1 page.
Example:
MOV AL, 13H MOV AH, 00H INT 10H
Example:
MOV DH, 10H MOV DL, 20H MOV BH, 0H MOV AH, 2H INT 10H
Return:
AH = attribute AL = character
Example:
MOV AL, 13H MOV AH, 0 INT 10H ; set graphics video mode MOV AL, 1100B MOV CX, 10H MOV DX, 20H MOV AH, 0CH INT 10h ; set pixel