0
7.6kviews
Explain INT 21H-DOS interrupt.

Mumbai University > Electronics and Telecommunication > Sem 4 > Microprocessor and peripherals

1 Answer
1
157views

INT 21H – DOS Interrupt :

MS-DOS provides a lot of functions for displaying and reading the text on the console. The general syntax for calling the function is

MOV AH ; Function number, input parameters

INT 21 H ; return values

- Input a character:

MOV AH, 01H

INT 21H

After the interrupt, AL contains the ASCII Code of the input character.

- Output a character :

MOV DL,…

MOV AH 02H

INT 21H

Load the desired character into DL, then call the interrupt with function code 2 in AH.

- Input a string

Section data

Buffer DB BUFSIZE ; BUFSIZE is max number of character

RESB BUFSIZE + 1

SECTION.Text

MOV DX, Buffer

MOV AH, OAH

INT 21H

After the interrupt, BYTE [ BUFFER + 1 ] will contain the number of character read, and the character themselves will start at Buffer + 2. The character will be terminated by a carriage return ( ASCII Code 13), although this will be included in the count.

- Output a string

MOV DX,…

MOV AH, 09H

INT 21H

Load the address of a \$ terminated into DX then call the interrupt with fuction code 9 in ASCIII

- Exit

MV AL,...

MOV AH, 4CH

INT 21H

Load the return code ( O for normal exit, non zero error) into AL, then call the interrupt with code 4CH in AH. This is the proper DOS exit. However, if we are running our program with DX this will exit DEBUG.

Please log in to add an answer.