-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestProgram.asm
300 lines (295 loc) · 4.4 KB
/
TestProgram.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.data
Caption db "Test Program", 0
Output db "——————————————————", 0ah,
"| RESULT |", 0ah,
"——————————————————", 0ah, 0ah,
"Program Result: %d", 0ah, 0ah,
"Author: Shendrikov Yevhenii", 0
StrBuf dw ?, 0
main PROTO
.code
main PROC
push ebp
mov ebp, esp
sub esp, 0
;; SET
mov edx, 0
;; SET
mov ecx, 10
;; SET
mov ecx, 0
;; LABEL
__JackShenC_label1:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 10
jne __JackShenC_label36
mov eax, 0
__JackShenC_label36:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label3
;; ADD
mov eax, edx
add eax, ecx
;; SET
mov edx, eax
;; SET
mov eax, 0
;; LABEL
__JackShenC_label2:
;; SET
mov eax, ecx
;; ADD
add ecx, 1
;; SET
;; JUMP
jmp __JackShenC_label1
;; LABEL
__JackShenC_label3:
;; NOTEQUALCMP
mov eax, 1
cmp edx, 45
jne __JackShenC_label37
mov eax, 0
__JackShenC_label37:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label4
;; RETURN
mov eax, 1
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label4:
;; SET
mov edx, 0
;; SET
mov ecx, 20
;; LABEL
__JackShenC_label5:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 80
jne __JackShenC_label38
mov eax, 0
__JackShenC_label38:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label7
;; ADD
mov eax, edx
add eax, ecx
;; SET
mov edx, eax
;; LABEL
__JackShenC_label6:
;; MULT
mov eax, ecx
imul eax, 2
;; SET
mov ecx, eax
;; JUMP
jmp __JackShenC_label5
;; LABEL
__JackShenC_label7:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 80
jne __JackShenC_label39
mov eax, 0
__JackShenC_label39:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label8
;; RETURN
mov eax, 2
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label8:
;; NOTEQUALCMP
mov eax, 1
cmp edx, 60
jne __JackShenC_label40
mov eax, 0
__JackShenC_label40:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label9
;; RETURN
mov eax, 3
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label9:
;; SET
mov edx, 0
;; LABEL
__JackShenC_label10:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 100
jne __JackShenC_label41
mov eax, 0
__JackShenC_label41:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label12
;; ADD
mov eax, edx
add eax, ecx
;; SET
mov edx, eax
;; LABEL
__JackShenC_label11:
;; ADD
add ecx, 1
;; SET
;; JUMP
jmp __JackShenC_label10
;; LABEL
__JackShenC_label12:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 100
jne __JackShenC_label42
mov eax, 0
__JackShenC_label42:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label13
;; RETURN
mov eax, 4
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label13:
;; NOTEQUALCMP
mov eax, 1
cmp edx, 1790
jne __JackShenC_label43
mov eax, 0
__JackShenC_label43:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label14
;; RETURN
mov eax, 5
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label14:
;; SET
mov edx, 0
;; LABEL
__JackShenC_label15:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 110
jne __JackShenC_label44
mov eax, 0
__JackShenC_label44:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label17
;; ADD
add edx, ecx
;; SET
;; SET
mov eax, ecx
;; ADD
add ecx, 1
;; SET
;; LABEL
__JackShenC_label16:
;; JUMP
jmp __JackShenC_label15
;; LABEL
__JackShenC_label17:
;; NOTEQUALCMP
mov eax, 1
cmp ecx, 110
jne __JackShenC_label45
mov eax, 0
__JackShenC_label45:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label18
;; RETURN
mov eax, 6
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label18:
;; NOTEQUALCMP
mov eax, 1
cmp edx, 1045
jne __JackShenC_label46
mov eax, 0
__JackShenC_label46:
;; JUMPZERO
cmp eax, 0
je __JackShenC_label19
;; RETURN
mov eax, 7
mov esp, ebp
pop ebp
ret
;; LABEL
__JackShenC_label19:
;; SET
mov eax, 0
;; LABEL
__JackShenC_label20:
;; SET
mov ecx, eax
;; ADD
add eax, 1
;; SET
;; EQUALCMP
mov ecx, 1
cmp eax, 10
je __JackShenC_label47
mov ecx, 0
__JackShenC_label47:
;; JUMPZERO
cmp ecx, 0
je __JackShenC_label23
;; JUMP
jmp __JackShenC_label22
;; LABEL
__JackShenC_label23:
;; LABEL
__JackShenC_label21:
;; JUMP
jmp __JackShenC_label20
;; LABEL
__JackShenC_label22:
;; RETURN
mov esp, ebp
pop ebp
ret
main ENDP
start:
invoke main
invoke wsprintf, ADDR StrBuf, ADDR Output, eax
invoke MessageBox, 0, ADDR StrBuf, ADDR Caption, MB_ICONINFORMATION
invoke ExitProcess, 0
end start