forked from aromalsanthosh/Microprocessor-Lab-S5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpalindrome.asm
61 lines (50 loc) · 1.28 KB
/
palindrome.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
data segment
msg1 db 0ah,0dh,"Enter the string : $"
msg2 db 0ah,0dh,"Is a pallindrome $"
msg3 db 0ah,0dh,"Is not a pallindrome $"
n db 09h dup(?)
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
;Getting offset of array
mov si,offset n
mov di,offset n
;Printing message1
lea dx,msg1
mov ah,09h
int 21h
mov cl,00h
;Reading string
scan:mov ah,01h
int 21h
cmp al,0dh
jz ended
mov [si],al
inc cl
inc si
jmp scan
ended:
dec si
mov bl,[si]
cmp [di],bl
jnz notpal
inc di
dec cl
jnz ended
pal:
;Printing pallindrom
lea dx,msg2
mov ah,09h
int 21h
jmp stoped
notpal: ;Printing not pallindrom
lea dx,msg3
mov ah,09h
int 21h
stoped:
mov ah,4ch
int 21h
code ends
end start