Hello guys,
I want to reverse a string by storing it in some other location but my code is not working
can somebody help me?
Here is my code:
org 100h
mov bx,0h
mov ah,1h
readStr:
int 21h
mov str[bx],al
inc bx
cmp al,13
jne readStr
;To Print The Entered String
mov dl,0Dh
mov ah,2h
int 21h
mov dl,0Ah
INT 21H
mov str[bx],'$'
mov ah,09h
lea dx, str
int 21h
;TO Print The Reverse String
mov dl,0Dh
mov ah,2h
int 21h
mov dl,0Ah
INT 21H
mov si,0
dec bx
dec bx
printStr:
mov dl,str[bx]
mov str1[si],dl
dec bx
inc si
cmp bx,-1
jne printStr
mov str1[bx],'$'
mov ah,09h
lea dx, str1
int 21h
ret
str db ""
str1 db ""