Search code examples
assemblycharacter-encodingx86dostasm

How to print a smiley face character in assembly?


What are the lines of code to output a smiley face character in assembly (TASM)?

I know in order to print a dot, it requires:

MOV AH, 2
DL, '.'
INT 21h

and in order to print backspace,

MOV AH, 6
MOV DL, 8
INT 21H

How about a smiley face? I know it exists because it appears when there are garbage values.


Solution

  • In the DOS codepage 437 (and most others) the white smiley face is code #1, and the black one is code #2. So these are the values you need to put into DL.

    MOV AH, 6
    MOV DL, 1; print ☺
    INT 21H