-
Notifications
You must be signed in to change notification settings - Fork 0
/
tetris.asm
2458 lines (2303 loc) · 62.1 KB
/
tetris.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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
INCLUDE Irvine32.inc
includelib user32.lib
includelib irvine32.lib
includelib kernel32.lib
main EQU start@0
.data
numb byte 0
gg byte 0
cursorinfo CONSOLE_CURSOR_INFO <50,FALSE>
gamemode byte 1
menuselect byte 0
outputHandle DWORD 0
filehandle dword 0
filename byte "airecord.txt",0
filehandle2 dword 0
filename2 byte "bestai.txt",0
filehandle3 dword 0
filename3 byte "highscore.txt",0
cursorxy COORD <0,0>
countdown word 0
timeloop word 100
cblue word 9fh,9fh
cwhite word 0ffh,0ffh
cred word 4fh,4fh,4fh,4fh,4fh,4fh,4fh
coran word 0c0h,0c0h,0c0h,0c0h,0c0h,0c0h,0c0h
cyellow word 0e0h,0e0h,0e0h,0e0h,0e0h,0e0h,0e0h
cgreen word 2fh,2fh,2fh,2fh,2fh,2fh,2fh
cbluee word 1fh,1fh,1fh,1fh,1fh,1fh,1fh
cpurple word 5fh,5fh,5fh,5fh,5fh,5fh,5fh
cblack word 0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh,0fh
cwb word 0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h
cwb2 word 0b0h,0b0h,0b0h,0b0h,0b0h,0b0h,0b0h,0b0h
pointin byte "Lines : "
point dword 0
backu byte 0c9h,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0bbh,0
backw byte 0bah,0
backd byte 0c8h,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0cdh,0bch,0
brick byte 0dbh,0dbh
blink byte 0,0
bline byte "__"
dline byte "____________________"
ans1 byte 0dbh,0
ans2 byte "no",0
answer dword ?
count dword 0
nowshape word 0
nowpos COORD <0,0>,<0,0>,<0,0>,<0,0>
shape byte 0,1
byte 2,3
byte 4,7
byte 8,11
byte 12,15
byte 16,17
byte 18,18
titt1 byte " _____ ___ _____ ___ ___ ___ "
titt2 byte "|_ _|| __||_ _|| _ \|_ _|/ __|"
titt3 byte " | | | _| | | | / | | \__ \"
titt4 byte " |_| |___| |_| |_|_\|___||___/"
tit1 byte " ___ _ __ __ ___ "
tit2 byte " / __| /_\ | \/ || __|"
tit3 byte " | (_ | / _ \ | |\/| || _| "
tit4 byte " \___|/_/ \_\|_| |_||___|"
gmov1 byte " ___ "
gmov2 byte " / __| __ _ _ __ ___ "
gmov3 byte "| (_ |/ _` || ' \ / -_) "
gmov4 byte " \___|\__,_||_|_|_|\___| "
gmov5 byte " ___ "
gmov6 byte " / _ \ __ __ ___ _ _ "
gmov7 byte " | (_) |\ V // -_)| '_|"
gmov8 byte " \___/ \_/ \___||_| "
cleantit byte " "
idword byte "by 104501527"
boxu2 byte 0dah,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0bfh
scoreword byte 0b3h,"Score : ",0b3h
boxd2 byte 0c0h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0d9h
boxu byte 0dah,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0bfh
normword byte 0b3h," Normal ",0b3h
hellword byte 0b3h," Hell ",0b3h
autoword byte 0b3h," Auto ",0b3h
exitword byte 0b3h," exit ",0b3h
boxd byte 0c0h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0c4h,0d9h
shapescore dword 0,0,0,0,0,0,0
findingshape COORD <0,0>,<0,0>,<0,0>,<0,0>
tempshape byte 0
tempshapescore dword 0
expectpos COORD <0,0>,<0,0>,<0,0>,<0,0>
expectshape byte 0
expectmov word 0
temppos COORD <0,0>,<0,0>,<0,0>,<0,0>
tempsaveline dword 0,0,0,0
startc byte 0
startcc byte 0
ttp dword 0
tts dword 0
ttt dword 0
whitec byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
linepoint dword 0
;ain dword 90,7,48,78,1,0,35,14,16,1,74
ain dword 210,31,92,204,43,8,46,41,17,71,123
lastscore dword 0
temptimes dword 0
aindelta dword 0
ainn dword 10
nowscore dword 0
trainai dword 0
deltadir dword 1
airecord dword 0,0,0,0,0,0,0,0,0,0,0
bestaiscore dword 0
bestain dword 0,0,0,0,0,0,0,0,0,0,0
bestscorell byte "____________________________________________"
ascore dword 0
bscore dword 0
cscore dword 0
nhs byte "new high score !"
hs byte "highest score : "
hiw byte "highest"
scw byte "score"
hswl byte "----------"
exityn byte "exit the game?",0
exittit byte "Exit",0
shapeinfo2 COORD <0,1>,<1,1>,<1,2>,<2,2>
COORD <1,1>,<2,1>,<1,2>,<2,0>
COORD <0,2>,<1,2>,<1,1>,<2,1>
COORD <0,0>,<0,1>,<1,1>,<1,2>
COORD <0,1>,<0,2>,<1,2>,<2,2>
COORD <1,1>,<1,3>,<1,2>,<2,1>
COORD <0,1>,<1,1>,<2,1>,<2,2>
COORD <1,2>,<2,1>,<2,2>,<2,0>
COORD <0,2>,<2,2>,<1,2>,<2,1>
COORD <1,0>,<1,1>,<1,2>,<2,2>
COORD <0,1>,<0,2>,<1,1>,<2,1>
COORD <1,1>,<2,1>,<2,2>,<2,3>
COORD <0,2>,<1,1>,<1,2>,<2,2>
COORD <1,1>,<1,2>,<1,3>,<2,2>
COORD <0,2>,<1,2>,<1,3>,<2,2>
COORD <0,2>,<1,1>,<1,2>,<1,3>
COORD <0,2>,<1,2>,<2,2>,<3,2>
COORD <1,0>,<1,1>,<1,2>,<1,3>
COORD <1,1>,<1,2>,<2,1>,<2,2>
gamedata byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,0,0,0,0,0,0,0,0,0,0,2
byte 2,2,2,2,2,2,2,2,2,2,2,2
.code
checkscore proc uses eax ebx ecx edx
mov edx, 0
mov tempshapescore, 0
stchec:
mov eax, 10000000
mov ecx, 0
movsx ebx, tempshape
shl ebx, 4
mov cx, [shapeinfo2+ebx].x
mov [findingshape].x, cx
mov cx, [shapeinfo2+ebx].y
mov [findingshape].y, cx
add ebx, 4
mov cx, [shapeinfo2+ebx].x
mov [findingshape+4].x, cx
mov cx, [shapeinfo2+ebx].y
mov [findingshape+4].y, cx
add ebx, 4
mov cx, [shapeinfo2+ebx].x
mov [findingshape+8].x, cx
mov cx, [shapeinfo2+ebx].y
mov [findingshape+8].y, cx
add ebx, 4
mov cx, [shapeinfo2+ebx].x
mov [findingshape+12].x, cx
mov cx, [shapeinfo2+ebx].y
mov [findingshape+12].y, cx
add findingshape.x,10
add [findingshape+4].x,10
add [findingshape+8].x,10
add [findingshape+12].x,10
chch:
.if findingshape.x > dx
dec findingshape.x
dec [findingshape+4].x
dec [findingshape+8].x
dec [findingshape+12].x
jmp chch
.endif
.if [findingshape+12].x > 9
jmp chend
.endif
chch2:
mov bx, findingshape.y
imul bx, 12
add bx, findingshape.x
inc bx
.if gamedata[bx] != 2
mov bx, [findingshape+4].y
imul bx, 12
add bx, [findingshape+4].x
inc bx
.if gamedata[bx] != 2
mov bx, [findingshape+8].y
imul bx, 12
add bx, [findingshape+8].x
inc bx
.if gamedata[bx] != 2
mov bx, [findingshape+12].y
imul bx, 12
add bx, [findingshape+12].x
inc bx
.if gamedata[bx] != 2
inc findingshape.y
inc [findingshape+4].y
inc [findingshape+8].y
inc [findingshape+12].y
jmp chch2
.endif
.endif
.endif
.endif
mov ecx, ain[32]
movsx ebx, findingshape.y
imul ebx, ecx
add eax, ebx
;shr ebx, 1
;add eax, ebx
movsx ebx, [findingshape+4].y
imul ebx, ecx
add eax, ebx
;shr ebx, 1
;add eax, ebx
movsx ebx, [findingshape+8].y
imul ebx, ecx
add eax, ebx
;shr ebx, 1
;add eax, ebx
movsx ebx, [findingshape+12].y
imul ebx, ecx
add eax, ebx
;shr ebx, 1
;add eax, ebx
mov ecx, ain[36]
mov bx, findingshape.y ;check right
dec bx
imul bx, 12
add bx, findingshape.x
add bx, 2
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, [findingshape+4].y
dec bx
imul bx, 12
add bx, [findingshape+4].x
add bx, 2
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, [findingshape+8].y
dec bx
imul bx, 12
add bx, [findingshape+8].x
add bx, 2
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, [findingshape+12].y
dec bx
imul bx, 12
add bx, [findingshape+12].x
add bx, 2
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, findingshape.y ;check left
dec bx
imul bx, 12
add bx, findingshape.x
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, [findingshape+4].y
dec bx
imul bx, 12
add bx, [findingshape+4].x
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, [findingshape+8].y
dec bx
imul bx, 12
add bx, [findingshape+8].x
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, [findingshape+12].y
dec bx
imul bx, 12
add bx, [findingshape+12].x
.if gamedata[bx] == 2
add eax, ecx
.endif
mov bx, findingshape.y
dec bx
imul bx, 12
add bx, findingshape.x
inc bx
mov gamedata[bx], 2
mov bx, [findingshape+4].y
dec bx
imul bx, 12
add bx, [findingshape+4].x
inc bx
mov gamedata[bx], 2
mov bx, [findingshape+8].y
dec bx
imul bx, 12
add bx, [findingshape+8].x
inc bx
mov gamedata[bx], 2
mov bx, [findingshape+12].y
dec bx
imul bx, 12
add bx, [findingshape+12].x
inc bx
mov gamedata[bx], 2
mov [tempsaveline], 0
mov [tempsaveline+4], 0
mov [tempsaveline+8], 0
mov [tempsaveline+12], 0
push edx
mov edx, ain
mov linepoint, edx
mov edx, 0
mov ecx, 16
lea esi, gamedata
add esi, 49
mov bh, 0
C32:
push ecx
mov ebx, 0
mov ecx, 10
C42:
add bl, [esi+ecx-1]
loop C42
.if bl == 0
push edx
mov edx, ain[4]
sub linepoint, edx
pop edx
.elseif bl == 20
add eax, linepoint
mov [tempsaveline+edx], esi
add edx, 4
.endif
pop ecx
add esi, 12
loop C32
pop edx
mov ecx, 10
C55:
mov startc, 0
mov startcc, 0
mov ttp, 0
mov ebx, ain[16]
mov tts, ebx
mov ebx, ain[24]
mov ttt, ebx
mov ebx, 0
lea esi, gamedata
add esi, 49
C66:
push ebx
.if esi != tempsaveline && esi != [tempsaveline+4] && esi != [tempsaveline+8] && esi != [tempsaveline+12]
mov bl, [esi+ecx-1]
.if bl == 2 && startc == 0
mov startc, 1
.elseif startc != 0 && bl != 2
sub eax, ain[12]
mov whitec[ebx], 1
.if startc == 1
sub eax, ttp
mov ttp, 0
.endif
.endif
.if startc == 1 && bl == 2
mov ebx, tts
add ttp, ebx
.if tts > 0
push ebx
mov ebx, ain[20]
sub tts, ebx
pop ebx
.endif
.endif
mov bl, [esi+ecx-1]
mov bh, [esi+ecx]
.if bl != 2 && bh == 2 && startcc == 0
mov bh, [esi+ecx-2]
.if bh == 2
mov startcc, 1
.endif
.elseif startcc == 1 && bl != 2
sub eax, ttt
push ebx
mov ebx, ain[28]
add ttt, ebx
pop ebx
.elseif startcc == 1
mov startcc, 2
.endif
.endif
pop ebx
.if ebx < 15
inc ebx
add esi, 12
jmp C66
.endif
dec ecx ;loop C55
jne C55
mov ecx, 16
Crsc:
.if whitec[ecx-1] == 1
push edx
mov edx, ain[8]
sub eax, edx
pop edx
mov whitec[ecx-1], 0
.endif
loop Crsc
mov bx, findingshape.y
dec bx
imul bx, 12
add bx, findingshape.x
inc bx
mov gamedata[bx], 0
mov bx, [findingshape+4].y
dec bx
imul bx, 12
add bx, [findingshape+4].x
inc bx
mov gamedata[bx], 0
mov bx, [findingshape+8].y
dec bx
imul bx, 12
add bx, [findingshape+8].x
inc bx
mov gamedata[bx], 0
mov bx, [findingshape+12].y
dec bx
imul bx, 12
add bx, [findingshape+12].x
inc bx
mov gamedata[bx], 0
.if findingshape.y < 10 || [findingshape+4].y <10 || [findingshape+8].y <10 || [findingshape+12].y <10
sub eax, ain[40]
.endif
.if findingshape.y < 9 || [findingshape+4].y <9 || [findingshape+8].y <9 || [findingshape+12].y <9
sub eax, ain[40]
.endif
.if findingshape.y < 8 || [findingshape+4].y <8 || [findingshape+8].y <8 || [findingshape+12].y <8
sub eax, ain[40]
.endif
.if findingshape.y < 7 || [findingshape+4].y <7 || [findingshape+8].y <7 || [findingshape+12].y <7
sub eax, ain[40]
.endif
.if findingshape.y < 5
mov eax, 0
.endif
.if [findingshape+4].y < 5
mov eax, 0
.endif
.if [findingshape+8].y < 5
mov eax, 0
.endif
.if [findingshape+12].y < 5
mov eax, 0
.endif
.if eax > tempshapescore || edx == 0
mov tempshapescore, eax
.if gamemode == 3
mov ax, findingshape.x
mov temppos.x, ax
mov ax, [findingshape+4].x
mov [temppos+4].x, ax
mov ax, [findingshape+8].x
mov [temppos+8].x, ax
mov ax, [findingshape+12].x
mov [temppos+12].x, ax
mov ax, findingshape.y
dec ax
mov temppos.y, ax
mov ax, [findingshape+4].y
dec ax
mov [temppos+4].y, ax
mov ax, [findingshape+8].y
dec ax
mov [temppos+8].y, ax
mov ax, [findingshape+12].y
dec ax
mov [temppos+12].y, ax
.endif
.endif
inc edx
jmp stchec
chend:
ret
checkscore endp
aishape proc uses eax ebx ecx edx
mov edx, 0
mov ecx, 0
movsx eax, numb
shl eax, 1
movsx eax, byte ptr[eax+shape+1]
movsx ebx, nowshape
AA: .if ebx <= eax
mov [tempshape], bl
call checkscore
mov edx, tempshapescore
.if edx > ecx || bx == nowshape
mov ecx, edx
mov expectshape, bl
mov dx, temppos.x
mov expectpos.x, dx
mov dx, [temppos+4].x
mov [expectpos+4].x, dx
mov dx, [temppos+8].x
mov [expectpos+8].x, dx
mov dx, [temppos+12].x
mov [expectpos+12].x, dx
mov dx, temppos.y
mov expectpos.y, dx
mov dx, [temppos+4].y
mov [expectpos+4].y, dx
mov dx, [temppos+8].y
mov [expectpos+8].y, dx
mov dx, [temppos+12].y
mov [expectpos+12].y, dx
.endif
inc ebx
jmp AA
.endif
ret
aishape endp
aifind proc uses eax ebx ecx edx
movsx eax, nowshape
.if al < expectshape
mov expectmov, 4800h
ret
.endif
mov ax, expectpos.x
.if ax > nowpos.x
mov expectmov, 4d00h
.elseif ax != nowpos.x
mov expectmov, 4b00h
.else
mov expectmov, 5000h
.endif
ret
aifind endp
findworstpiece proc uses eax ebx ecx edx
mov shapescore, 0
mov [shapescore+4], 0
mov [shapescore+8], 0
mov [shapescore+12], 0
mov [shapescore+16], 0
mov [shapescore+20], 0
mov [shapescore+24], 0
mov tempshape, 0
call checkscore
mov eax, tempshapescore
.if eax > shapescore
mov shapescore, eax
.endif
mov tempshape, 1
call checkscore
mov eax, tempshapescore
.if eax > shapescore
mov shapescore, eax
.endif
mov tempshape, 2
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+4]
mov [shapescore+4], eax
.endif
mov tempshape, 3
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+4]
mov [shapescore+4], eax
.endif
mov tempshape, 4
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+8]
mov [shapescore+8], eax
.endif
mov tempshape, 5
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+8]
mov [shapescore+8], eax
.endif
mov tempshape, 6
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+8]
mov [shapescore+8], eax
.endif
mov tempshape, 7
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+8]
mov [shapescore+8], eax
.endif
mov tempshape, 8
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+12]
mov [shapescore+12], eax
.endif
mov tempshape, 9
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+12]
mov [shapescore+12], eax
.endif
mov tempshape, 10
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+12]
mov [shapescore+12], eax
.endif
mov tempshape, 11
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+12]
mov [shapescore+12], eax
.endif
mov tempshape, 12
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+16]
mov [shapescore+16], eax
.endif
mov tempshape, 13
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+16]
mov [shapescore+16], eax
.endif
mov tempshape, 14
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+16]
mov [shapescore+16], eax
.endif
mov tempshape, 15
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+16]
mov [shapescore+16], eax
.endif
mov tempshape, 16
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+20]
mov [shapescore+20], eax
.endif
mov tempshape, 17
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+20]
mov [shapescore+20], eax
.endif
mov tempshape, 18
call checkscore
mov eax, tempshapescore
.if eax > [shapescore+24]
mov [shapescore+24], eax
.endif
mov ecx, 0
mov ebx, 0
mov eax, 1000000000
Shcom: ;shape comfirm
.if eax > [shapescore+ebx]
mov ecx, ebx
mov eax, [shapescore+ebx]
.endif
.if ebx < 24
add ebx, 4
jmp Shcom
.endif
shr ecx, 2
mov numb, cl
ret
findworstpiece endp
resetgamedata proc uses eax ebx ecx edx
mov ecx, 20
lea esi, gamedata
inc esi
rsgm1:
push ecx
mov ecx, 10
rsgm2:
mov al, 0
mov [esi+ecx-1], al
loop rsgm2
lea esi, [esi+12]
pop ecx
loop rsgm1
ret
resetgamedata endp
clnscr2 proc uses eax ebx ecx edx
mov cursorxy.x, 5
mov cursorxy.y, 6
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 8
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 10
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 12
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 14
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 16
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 18
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 20
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 22
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 24
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.y, 26
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
ret
clnscr2 endp
clnscr proc uses eax ebx ecx edx
mov cursorxy.x, 4
mov cursorxy.y, 6
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov1, addr count, NULL
mov cursorxy.y, 7
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov2, addr count, NULL
mov cursorxy.y, 8
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov3, addr count, NULL
mov cursorxy.y, 9
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov4, addr count, NULL
mov cursorxy.y, 10
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov5, addr count, NULL
mov cursorxy.y, 11
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov6, addr count, NULL
mov cursorxy.y, 12
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov7, addr count, NULL
mov cursorxy.y, 13
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof gmov8, addr count, NULL
mov cursorxy.x, 5
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, 35, addr count, NULL
mov cursorxy.x, 10
mov cursorxy.y, 19
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof boxu2, addr count, NULL
mov cursorxy.y, 20
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof scoreword, addr count, NULL
mov cursorxy.y, 21
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof boxd2, addr count, NULL
mov cursorxy.x, 6
mov cursorxy.y, 25
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr cleantit, sizeof cleantit, addr count, NULL
ret
clnscr endp
scoreb proc uses eax ebx ecx edx
mov cursorxy.x, 4
mov cursorxy.y, 6
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov1, sizeof gmov1, addr count, NULL
mov cursorxy.y, 7
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov2, sizeof gmov2, addr count, NULL
mov cursorxy.y, 8
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov3, sizeof gmov3, addr count, NULL
mov cursorxy.y, 9
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov4, sizeof gmov4, addr count, NULL
mov cursorxy.y, 10
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov5, sizeof gmov5, addr count, NULL
mov cursorxy.y, 11
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov6, sizeof gmov6, addr count, NULL
mov cursorxy.y, 12
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov7, sizeof gmov7, addr count, NULL
mov cursorxy.y, 13
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr gmov8, sizeof gmov8, addr count, NULL
mov cursorxy.x, 10
mov cursorxy.y, 19
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr boxu2, sizeof boxu2, addr count, NULL
mov cursorxy.y, 20
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr scoreword, sizeof scoreword, addr count, NULL
mov cursorxy.y, 21
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr boxd2, sizeof boxd2, addr count, NULL
mov eax, point
.if menuselect == 0
.if eax <= ascore
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr hs, sizeof hs, addr count, NULL
mov eax, ascore
call WriteDec
.else
mov eax, point
mov ascore, eax
mov cursorxy.x, 12
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr nhs, sizeof nhs, addr count, NULL
.endif
.elseif menuselect == 1
.if eax <= bscore
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr hs, sizeof hs, addr count, NULL
mov eax, bscore
call WriteDec
.else
mov eax, point
mov bscore, eax
mov cursorxy.x, 12
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr nhs, sizeof nhs, addr count, NULL
.endif
.elseif menuselect == 2 && trainai == 0
.if eax <= cscore
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr hs, sizeof hs, addr count, NULL
mov eax, cscore
call WriteDec
.else
mov eax, point
mov cscore, eax
mov cursorxy.x, 12
mov cursorxy.y, 17
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
invoke WriteConsole, outputHandle, addr nhs, sizeof nhs, addr count, NULL
.endif
.endif
mov cursorxy.x, 19
mov cursorxy.y, 20
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
mov eax, point
call WriteDec
mov cursorxy.x, 6
mov cursorxy.y, 25
INVOKE SetConsoleCursorPosition, outputHandle, cursorxy
call WaitMsg
ret
scoreb endp
check proc uses eax ebx ecx edx
mov ecx, 4
lea esi, gamedata
inc esi
CC: push ecx
mov ecx, 10
C2: mov al, [esi+ecx-1]
.if al == 2
jmp gmover
.endif
loop C2
pop ecx
add esi, 12
loop CC
mov ecx, 16
lea esi, gamedata
add esi, 49
C3: push ecx
mov eax, 0
mov ecx, 10
C4: add al, [esi+ecx-1]
loop C4
.if al == 20
.if timeloop > 10
dec timeloop
.endif
inc point
pop ecx
mov al, 16
sub al, cl
inc al