0
Explain INT 21H-DOS interrupt.

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

mumbai university mpa • 938  views
0  upvotes
0

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.

0  upvotes
Please log in to add an answer.

Next up

Read More Questions

If you are looking for answer to specific questions, you can search them here. We'll find the best answer for you.

Search

Study Full Subject

If you are looking for good study material, you can checkout our subjects. Hundreds of important topics are covered in them.

Know More