well i have written the program in tasm and it works fine .
the programmin stlye is a bit different but i guess u can undestand
.model small
.stack 40
.data
str1 db 50 dup('$')
msg db 10,13, 'enter the str1ing : $'
disp db 10,13, 'displaying the str1ing : $'
.code
mov ax,@data
mov ds,ax
lea dx,msg
mov ah,09h
int 21h
lea si,str1 ; making si to hold the starting address
xor cx,cx ; clearing cx register
lp:
mov ah , 01h ; the first two lines are to read from keyyboard
int 21h
cmp al 0dh ; compares until we press enter character
jz stop
mov [si] , al ; if enter key is not pressed contents are stored in
inc si ; string and si is incremented
inc cx
jmp lp
stop:
lea dx , disp
mov ah,09h
int 21h
lea si , str1
lpz:
mov dl , [si]
mov ah , 02h ; the first two lines displays the data
int 21h
inc si
dec cx
jnz lpz
mov ah,4ch
int 21h
end
i guess this should do the trick .