.model small
.data
prompt_msg db "Please enter your length:$"
.stack 100h
.code
main proc
mov ax,@data
mov ds,ax
mov es,ax
call prompt_user
;exit
mov ah,01h
int 21h
mov ah,4ch
int 21h
endp main
prompt_user proc
call NewLine
call CarriageReturn
mov ah,09h
lea dx,prompt_msg
int 21h
ret
endp prompt_user
NewLine proc
mov ah,09h
mov dx,0dh
int 21h
ret
endp NewLine
CarriageReturn proc
mov ah,09h
mov dx,0ah
int 21h
ret
endp CarriageReturn
end main
This code prints the message without new line and prints thrice overlapping the previous message. I use Tasm and this is 8086 assembly.
It prints something like this
"your length here: enter your length here: Please enter your length here:"
Within your two procedures newline
and carriagereturn
, you are setting dx to the values 13 and 10 respectively, then executing function 09 which is `display string beginning at DS:DX.
Now, prompt_msg
is located at DS:0000 so it obediently prints the message from the 14th charater, then again from the 11th, and then the entire message when dx is loaded with the offset of prompt_msg
= 0000
I suspect right strongly that you should call function 02 not 09, which outputs the character in DL (hence, it's probably only necessary to load DL, not DX in those procedures.)