Solved programming problem

Input String and Print in Assembly.

Source code

org 100h

.model small

.stack 100h

.data

msg1 db "hello $"

msg2 db 100 dup(?) ;creat 100 size array

count  db 0

.code

 mov ax,@data

 mov ds,ax

 mov es,ax

 lea di,msg2

   

l1:

 mov ah,1

 int 21h    

 cmp al,0dh   ; untill user press "Enter" its take input

 je done

 stosb ; add corrent char to the stored di register

 inc count

 cmp count,99  ; check for the max length

 jge done

 jmp l1

done:

 mov al,'$'   ; add '$' in the last index

 stosb

 mov ah,9  ; print msg

 lea dx,msg1

 int 21h

 mov ah,9  ; print msg2

 lea dx,msg2

 int 21h

 mov ah,4ch

 int 21h

 

   endp

ret

Output


Output:

Write the Name.....

 

 

Press "Enter"

 

Join the discussion

Add your comment