int 21h supports about 100 different functions a


INT 21H supports about 100 different functions. A function is recognised by putting the function number in AH register. For illustration if we want to call function number 01 then we place this value in AH register first by employing MOV instruction and after that call INT 21H:

Some significant DOS function calls are: 

DOS

Function Call 

Purpose

Example

AH = 01H

 

For reading a single character from keyboardand echo it on monitor. The input value is put inAL register.

To get one character input in a variable in data segment you may include the following in the code segment:

MOV AH,01

INT 21H

MOV X, AL 

(Please note that interrupt call will return value in AL which is being transferred to variable of data segment X. X must be byte type).

AH = 02H

This function prints 8 bit data (normally ASCII) that is stored in DL register on the screen.

To print a character let say '?' on the screen we may have to use following set of commands:

MOV AH, 02H;

MOV DL, '?'

INT 21H

AH = 08H

This is an input function for inputting one character. This is same as AH = 01H functions with the only difference that value does not get displayed on the screen.

Same example as 01 can be used only difference in this case would be that theinput character wouldn't get displayed

MOV AH, 08H

INT 21H

MOV X, AL

AH = 09H

This program outputs a string whose offset is stored in DX register and that is terminated using a $ character. One can print newline, tab character also. 

To print a string "hello world" followed by a carriage return (control character) we may have to use the following assembly program segment.

 

Example of

AH = 09H

CR EQU ODH 

; ASCII code of carriage return.

DATA SEGMENT 

STRING DB 'HELLO WORLD', CR, '$'

DATA ENDS

CODE SEGMENT

         :

      MOV AX, DATA

      MOV DS, AX

      MOV AH, 09H

      MOV DX, OFFSET STRING

; Store the offset of string in DX register.

      INT 21H

AH = 0AH

For input of string up to 255 characters. The stringis stored in a buffer.

Look in the examples given.

AH = 4CH

Return to DOS

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: int 21h supports about 100 different functions a
Reference No:- TGS0327935

Expected delivery within 24 Hours