-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCIE.ASM
93 lines (83 loc) · 1.2 KB
/
CIE.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.model small
.stack 100h
.data
string db "India$"
len db 05h
reve db "$$$$$$"
msg1 db "String Length is:$"
msg2 db "Reverse of String is:$"
msg3 db "Not a Palindrome$"
msg4 db "A Palindrome$"
msg5 db "Given String is:$"
.code
main proc
mov ax,@data
mov ds,ax
mov es,ax
lea dx,msg5
mov ah,09h
int 21h
lea dx,string
mov ah,09h
int 21h ;Prints Original String
mov ah,02h
mov dl,0ah
int 21h
mov ah,02h
mov dl,0dh
int 21h ;New Line
lea dx,msg1
mov ah,09h
int 21h
mov dl,len
add dl,30h
mov ah,02h ;Prints length
int 21h
mov ah,02h
mov dl,0ah
int 21h
mov ah,02h
mov dl,0dh
int 21h
mov cx,0005h
lea si,string
add si,0004h
lea di,reve
abc:
mov al,[si]
mov [di],al
inc di
dec si
dec cl
jnz abc
lea dx,msg2
mov ah,09h
int 21h
lea dx,reve
mov ah,09h
int 21h
mov ah,02h
mov dl,0ah
int 21h
mov ah,02h
mov dl,0dh
int 21h
lea di,reve
lea si,string
mov cx,0005h
repe cmpsb
cmp cl,'0'
jae nc
lea dx,msg3
mov ah,09h
int 21h
jmp ou
nc:
lea dx,msg4
mov ah,09h
int 21h
ou:
mov ah,04ch
int 21h
main endp
end main