-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinal.asm
456 lines (451 loc) · 6.77 KB
/
Final.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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
include number.asm
include macros2.asm
.MODEL LARGE ;Modelo de Memoria
.386 ;Tipo de Procesador
.STACK 200h ;Bytes en el Stack
.DATA
a dd ?
b dd ?
c dd ?
d dd ?
e dd ?
f dd ?
_constString0 db "Holaa :)",'$',8 dup(?)
_10 dd 10.0
_20 dd 20.0
_30 dd 30.0
_2 dd 2.0
_353 dd 353.0
_constString1 db "VALORES INICIALES: ",'$',19 dup(?)
_constString2 db "if sin else",'$',11 dup(?)
_constString3 db "a == a",'$',6 dup(?)
_constString4 db "TRUE",'$',4 dup(?)
_constString5 db "if a < b",'$',8 dup(?)
_constString6 db "TRUE",'$',4 dup(?)
_constString7 db "FALSE",'$',5 dup(?)
_constString8 db "if a > b",'$',8 dup(?)
_constString9 db "TRUE",'$',4 dup(?)
_constString10 db "FALSE",'$',5 dup(?)
_constString11 db "if a >= b",'$',9 dup(?)
_constString12 db "TRUE",'$',4 dup(?)
_constString13 db "FALSE",'$',5 dup(?)
_constString14 db "if a <= b",'$',9 dup(?)
_constString15 db "TRUE",'$',4 dup(?)
_constString16 db "FALSE",'$',5 dup(?)
_constString17 db "if a != b",'$',9 dup(?)
_constString18 db "TRUE",'$',4 dup(?)
_constString19 db "FALSE",'$',5 dup(?)
_constString20 db "if !(a <= b)",'$',12 dup(?)
_constString21 db "TRUE",'$',4 dup(?)
_constString22 db "FALSE",'$',5 dup(?)
_constString23 db "if (a == a && b == b)",'$',21 dup(?)
_constString24 db "Me parece que es true.",'$',22 dup(?)
_constString25 db "if (a > b || b > a)",'$',19 dup(?)
_constString26 db "TRUE",'$',4 dup(?)
_constString27 db "if anidado",'$',10 dup(?)
_constString28 db "b > a",'$',5 dup(?)
_constString29 db "b == b",'$',6 dup(?)
_constString30 db "IF con while anidado",'$',20 dup(?)
_constString31 db "while a < b",'$',11 dup(?)
_10000 dd 10000.0
_constString32 db "2 DIV 2",'$',7 dup(?)
_constString33 db "5 MOD 2",'$',7 dup(?)
_5 dd 5.0
_constString34 db "INLIST (c; [0; 1; 2])",'$',21 dup(?)
_0 dd 0.0
_1 dd 1.0
_constString35 db "TRUE",'$',4 dup(?)
_constString36 db "INLIST (c; [3; 4; 5])",'$',21 dup(?)
_3 dd 3.0
_4 dd 4.0
_constString37 db "TRUE",'$',4 dup(?)
_constString38 db "FALSE",'$',5 dup(?)
@terceto163 dd ?
@inlist0 dd 0
@inlist1 dd 1
@inlistFoundFlag173 dd ?
@inlistFoundFlag195 dd ?
.CODE
start:
MOV EAX,@DATA
MOV DS,EAX
MOV ES,EAX
DisplayString _constString0
newline 1
FLD _20
FLD _30
FMUL
FLD _10
FADD
FISTP a
FLD _353
FLD _20
FMUL
FLD _2
FMUL
FLD _10
FSUB
FISTP b
DisplayString _constString1
newline 1
DisplayInteger a
newline 1
DisplayInteger b
newline 1
DisplayString _constString2
newline 1
DisplayString _constString3
newline 1
FILD a
FILD a
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE END_IF27
THEN25:
DisplayString _constString4
newline 1
END_IF27:
DisplayString _constString5
newline 1
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JAE IF_ELSE36
THEN33:
DisplayString _constString6
newline 1
JMP END_IF38
IF_ELSE36:
DisplayString _constString7
newline 1
END_IF38:
DisplayString _constString8
newline 1
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JBE IF_ELSE47
THEN44:
DisplayString _constString9
newline 1
JMP END_IF49
IF_ELSE47:
DisplayString _constString10
newline 1
END_IF49:
DisplayString _constString11
newline 1
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JB IF_ELSE58
THEN55:
DisplayString _constString12
newline 1
JMP END_IF60
IF_ELSE58:
DisplayString _constString13
newline 1
END_IF60:
DisplayString _constString14
newline 1
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JB IF_ELSE69
THEN66:
DisplayString _constString15
newline 1
JMP END_IF71
IF_ELSE69:
DisplayString _constString16
newline 1
END_IF71:
DisplayString _constString17
newline 1
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JE IF_ELSE80
THEN77:
DisplayString _constString18
newline 1
JMP END_IF82
IF_ELSE80:
DisplayString _constString19
newline 1
END_IF82:
DisplayString _constString20
newline 1
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JBE IF_ELSE91
THEN88:
DisplayString _constString21
newline 1
JMP END_IF93
IF_ELSE91:
DisplayString _constString22
newline 1
END_IF93:
DisplayString _constString23
newline 1
FILD a
FILD a
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE ET_LAZY_AND104
FILD b
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE ET_LAZY_AND104
JMP THEN106
ET_LAZY_AND104:
JMP END_IF108
THEN106:
DisplayString _constString24
newline 1
END_IF108:
DisplayString _constString25
newline 1
FILD a
FILD a
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE ET_LAZY_AND119
FILD b
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE ET_LAZY_AND119
JMP THEN121
ET_LAZY_AND119:
JMP END_IF123
THEN121:
DisplayString _constString26
newline 1
END_IF123:
DisplayString _constString27
newline 1
FILD b
FILD a
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JBE END_IF138
THEN129:
DisplayString _constString28
newline 1
FILD b
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE END_IF137
THEN135:
DisplayString _constString29
newline 1
END_IF137:
END_IF138:
DisplayString _constString30
newline 1
FILD b
FILD a
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JBE END_IF159
THEN144:
DisplayString _constString31
newline 1
CMP_WHILE146:
FILD a
FILD b
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JAE END_WHILE158
THEN151:
FILD a
FLD _10000
FADD
FISTP a
DisplayInteger a
newline 1
JMP CMP_WHILE146
END_WHILE158:
END_IF159:
DisplayString _constString32
newline 1
FLD _2
FLD _2
FDIV
FISTP @terceto163
FILD @terceto163
FISTP c
DisplayInteger c
newline 1
DisplayString _constString33
newline 1
FLD _5
FLD _2
FXCH
FPREM
FISTP c
DisplayInteger c
newline 1
DisplayString _constString34
newline 1
FILD @inlist0
FISTP @inlistFoundFlag173
FILD c
FLD _0
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE INLIST_CMP179
FILD @inlist1
FISTP @inlistFoundFlag173
INLIST_CMP179:
FILD c
FLD _1
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE INLIST_CMP184
FILD @inlist1
FISTP @inlistFoundFlag173
INLIST_CMP184:
FILD c
FLD _2
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE INLIST_LOAD188
FILD @inlist1
FISTP @inlistFoundFlag173
INLIST_LOAD188:
FILD @inlistFoundFlag173
FILD @inlist1
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE END_IF193
THEN191:
DisplayString _constString35
newline 1
END_IF193:
DisplayString _constString36
newline 1
FILD @inlist0
FISTP @inlistFoundFlag195
FILD c
FLD _3
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE INLIST_CMP201
FILD @inlist1
FISTP @inlistFoundFlag195
INLIST_CMP201:
FILD c
FLD _4
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE INLIST_CMP206
FILD @inlist1
FISTP @inlistFoundFlag195
INLIST_CMP206:
FILD c
FLD _5
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE INLIST_LOAD210
FILD @inlist1
FISTP @inlistFoundFlag195
INLIST_LOAD210:
FILD @inlistFoundFlag195
FILD @inlist1
FXCH
FCOMP
FSTSW AX
SAHF
FFREE
JNE IF_ELSE216
THEN213:
DisplayString _constString37
newline 1
JMP END_IF218
IF_ELSE216:
DisplayString _constString38
newline 1
END_IF218:
ET_END219:
MOV EAX, 4C00h
INT 21h
END start