0% found this document useful (0 votes)
6 views2 pages

Assembly Palindrom Check

Uploaded by

saiful23102
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Assembly Palindrom Check

Uploaded by

saiful23102
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

.

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

You might also like