forked from shoaib30/Microprocessor-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPALINDROME.asm
More file actions
52 lines (45 loc) · 706 Bytes
/
PALINDROME.asm
File metadata and controls
52 lines (45 loc) · 706 Bytes
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
;palindrome.asm
;Shoaib Ahmed
;18.05.15
;Test whether string is palindrome
assume cs:code,ds:data
data segment
str1 db "madam"
len1 db (len1-str1)
str2 db 10 dup(?)
msg1 db 0ah,0dh,"String is palindrome$"
msg2 db 0ah,0dh,"String is not palindrome$"
data ends
code segment
DISP MACRO msg
LEA dx,msg
MOV ah,9
INT 21h
ENDM
START: MOV ax,data
MOV ds,ax
MOV es,ax
LEA si,len1
DEC si
LEA di,str2
MOV ch,0
MOV cl,len1
RPT: MOV al,[si]
MOV [di],al
DEC si
INC di
LOOP RPT
LEA si,str1
LEA di,str2
CLD
MOV ch,0
MOV cl,len1
REP CMPSB
JNZ NOTPAL
DISP msg1
JMP FIN
NOTPAL: DISP msg2
FIN: MOV ah,4ch
INT 21h
code ends
end START