-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeleteSpecificWordInSentence.asm
134 lines (108 loc) · 1.57 KB
/
DeleteSpecificWordInSentence.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
section .text
input:
mov eax,3
mov ebx,0
int 0x80
ret
output:
mov eax,4
mov ebx,1
int 0x80
ret
global _start
_start:
mov ecx,inpmsg
mov edx,linp
call output
mov ecx,inpsen
mov edx,1000
call input
mov ecx,inpwrdmsg
mov edx,linpwrd
call output
mov ecx,inpwrd
mov edx,100
call input
mov ebp,0
mov esi,0
sencheck:
mov cl,byte[inpwrd+esi]
mov dl,byte[inpsen+ebp]
cmp cl,dl
jne continue
mov dword[ptrstrt],ebp
comparing:
add esi,1
cmp byte[inpwrd+esi],10
jne cont
mov dword[ptrstop],ebp
call deleteword
mov ecx,dword[ptrstrt]
mov edx,dword[ptrstop]
sub edx,ecx
add edx,1
sub ebp,edx
cont:
add ebp,1
cmp byte[inpsen+ebp],10
je printsen
mov cl,byte[inpwrd+esi]
mov dl,byte[inpsen+ebp]
cmp cl,dl
je comparing
mov esi,0
continue:
add ebp,1
cmp byte[inpsen+ebp],10
jne sencheck
printsen:
mov ecx,10
mov edx,1
call output
mov ecx,omsg
mov edx,lomsg
call output
mov ebp,0
printing:
mov al,byte[inpsen+ebp]
cmp al,10
je exit
mov byte[printdata],al
mov ecx,printdata
mov edx,1
call output
add ebp,1
jmp printing
exit:
mov ecx,10
mov edx,1
call output
mov eax,1
mov ebx,0
int 0x80
deleteword:
mov edx,0
mov eax,dword[ptrstrt]
mov ebx,dword[ptrstop]
add ebx,1
deleting:
mov cl,byte[inpsen+ebx+edx]
mov byte[inpsen+eax+edx],cl
add edx,1
mov cl,byte[inpsen+ebx+edx-1]
cmp cl,10
jne deleting
ret
section .bss
inpsen resb 1000
inpwrd resb 100
section .data
ptrstop dd 0
ptrstrt dd 0
inpmsg db "ENTER THE SENTENCE : ",32
linp equ $-inpmsg
inpwrdmsg db "ENTER THE WORD TO BE DELETED : ",32
linpwrd equ $-inpwrdmsg
omsg db "MODIFIED SENTENCE",10
lomsg equ $-omsg
printdata db 30h