Question: Explain INT 21H-DOS interrupt.
0

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

mumbai university mpa • 491 views
ADD COMMENTlink
modified 5 months ago by gravatar for RB RB ♦♦ 110 written 7 months ago by gravatar for kazi.tahoor kazi.tahoor0
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.

ADD COMMENTlink
modified 5 months ago by gravatar for Ankit Pandey Ankit Pandey70 written 5 months ago by gravatar for RB RB ♦♦ 110
Please log in to add an answer.