Print String in Assembly Language


Program to print a string in Assembly Language is given below:

;program to print a string in Assembly Language
.model small
.stack
.data
str db "Hello World!",'$'
.code
mov ax, seg str
mov ds, ax
mov ah,09
lea dx,str
int 21h

EXIT:
mov ah,4ch
int 21h
end

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Carriage Return, (ASCII 13D) is the control character to bring the cursor to the start of a line.



Line-feed (ASCII 10D) is the control character that brings the cursor down to the next line on the screen.

(We use the abbreviations CR and LF to refer to Return and Line-feed in comments.)


;How to come to new line while printing in assembly language.
.model small
.stack
.data
str db "First Line",0AH,"SECOND LINE",0AH,"3RD line",'$'
.code
MOV AX,@DATA
MOV DS,AX
MOV AH,09
MOV DX, OFFSET STR
INT 21H

mov ah,4ch
int 21h
end


Alternate way of printing Hello World in Assembly Language

No comments:

Post a Comment