How to read a string using Assembly Language program using 8086 Microprocessor?
Solution
print macro str mov ah,09h mov dx,offset str int 21h endm data segment arr db 80 dup ('$') msg1 db "Enter the string$" msg2 db "The string is $" nl db 0dh,0ah,'$' data ends code segment assume ds:data,cs:code start: mov ax,data mov ds,ax print msg1 print nl mov si,offset arr rpt1: mov ah,01h int 21h cmp al,0dh jz stop1 mov [si],al inc si jmp rpt1 stop1: mov [si],'$' print nl mov si,offset arr print msg2 mov dx,offset arr mov ah,09h int 21h mov ah,4ch int 21h code ends end start
Output
Enter the string
hello world !
The string is hello world !
No comments:
Post a Comment