Displaying a Character 

MASM uses DOS functions 02 and 06 to display a single character. DOS function 09 is used for the display of strings of characters.

DOS Functions 02 and 06

Both functions are identical, except that function 02 can be interrupted by a control break (Ctrl-Break), while function 06 cannot. The ASCII code of the character to be displayed has to be stored in register DL. To display a single ASCII character at the current cursor position, use the following sequence of instructions:

Character Display
MOV AH,  02H		;(OR:    MOV AH,  06H)
MOV DL,  Character Code
INT 21H

The Character code may be the ASCII code of the character taken from the ASCII table, or the character itself written between quotes.

The following code displays number 2 on the screen using its ASCII code:

Display character 2
MOV AH,  02H
MOV DL,  32H
INT 21H

The following code also displays number 2 on the screen:

This code also displays character 2
MOV AH,  02H
MOV DL,  ‘2’
INT 21H