8086 Microprocessor Program To String Reverse

To write a 8086 Microprocessor program to reverse a string

assume cs:code,ds:data
data segment
m1 db 0ah,0dh,"enter the string : $"
m2 db 0ah,0dh,"reverse of the string is: $"
s1 db 10h dup(?)
data ends
code segment
start:mov ax,data
mov ds,ax
lea dx,m1
mov ah,09h
int 21h
mov ch,01h
mov si,offset s1
back: mov ah,01h
int 21h
cmp al,0dh
jz exit
mov [si],al
inc si
inc ch
jmp back
exit: lea dx,m2
mov ah,09h
int 21h
cmp1:mov al,[si]
mov dl,al
mov ah,02h
int 21h
dec si
dec ch
jnz cmp1
mov ah,4ch
int 21h
code ends
end start

No comments:

Post a Comment

Post Your valuable comments here ..........