.
model small
.stack 100h
.data
msg db 'aabaa$'
newline db 0dh,0ah,'$'
p db 'Given string is a Palindrome$'
np db 'Given string is not a Palindrome$'
.code
main proc
mov ax,@data
mov ds,ax
lea si,msg
mov cx,0
length:
mov al,[si]
cmp al,'$'
je len
inc cx
inc si
jmp length
len:
mov bx,cx
lea si,msg
push_loop:
mov al,[si]
cmp al,'$'
je cmps
push ax
inc si
jmp push_loop
cmps:
lea si, msg
mov cx,bx
check_loop:
cmp cx,0
je palin
pop dx
mov al,[si]
cmp al,dl
jne not_palin
inc si
dec cx
jmp check_loop
palin:
lea dx,p
mov ah,9
int 21h
jmp exit
not_palin:
lea dx, np
mov ah,9
int 21h
jmp exit
exit:
mov ah,4ch
int 21h
main endp
end main