-
Notifications
You must be signed in to change notification settings - Fork 0
/
tetris.asm
983 lines (870 loc) · 13.7 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
@redraw
push %rcx
push %rdx
push %rsi
push %rdi
push %r8
push %r9
push %r10
push %r11
push %rbp
sub $32,%rsp
mov @_$DATA+0-@_$NEXT(%rip),%rcx
xor %edx,%edx
xor %r8d,%r8d
.dllcall "user32.dll" "InvalidateRect"
add $32,%rsp
pop %rbp
pop %r11
pop %r10
pop %r9
pop %r8
pop %rdi
pop %rsi
pop %rdx
pop %rcx
ret
@rect
push %rax
push %rcx
push %rdx
push %rsi
push %rdi
push %r8
push %r9
push %r10
lea @_$DATA+576-4-@_$NEXT(%rip),%r10
mov %eax,%r8d
mov %edx,%r9d
mov $2032,%rax
mul %ecx
lea (%rax,%r8,4),%rcx
add %r10,%rcx
@rect_X1
mov %esi,%r8d
@rect_X2
mov %r9d,(%rcx,%r8,4)
dec %r8d
jne @rect_X2
add $2032,%rcx
dec %edi
jne @rect_X1
pop %r10
pop %r9
pop %r8
pop %rdi
pop %rsi
pop %rdx
pop %rcx
pop %rax
ret
@p_digit
push %rax
push %rcx
push %rdx
push %rsi
push %rdi
shl $1,%edx
lea @digits_bitmap-@_$NEXT(%rip),%rsi
mov (%rsi,%rdx,1),%si
mov $5,%dh
@p_digit_X1
mov $3,%dl
@p_digit_X2
test $1,%esi
je @p_digit_X3
push %rdx
push %rsi
mov $0xffffff,%edx
mov $4,%edi
mov %edi,%esi
call @rect
pop %rsi
pop %rdx
@p_digit_X3
add $4,%eax
shr $1,%esi
dec %dl
jne @p_digit_X2
sub $12,%eax
add $4,%ecx
dec %dh
jne @p_digit_X1
pop %rdi
pop %rsi
pop %rdx
pop %rcx
pop %rax
ret
@p_letter
push %rax
push %rcx
push %rdx
push %rsi
push %rdi
mov %rdx,%rsi
mov $5,%dh
@p_letter_X1
mov $5,%dl
mov (%rsi),%dil
@p_letter_X2
test $1,%edi
je @p_letter_X3
push %rdx
push %rsi
push %rdi
mov $0xffffff,%edx
mov $4,%edi
mov %edi,%esi
call @rect
pop %rdi
pop %rsi
pop %rdx
@p_letter_X3
shr $1,%edi
add $4,%eax
dec %dl
jne @p_letter_X2
inc %rsi
sub $20,%eax
add $4,%ecx
dec %dh
jne @p_letter_X1
pop %rdi
pop %rsi
pop %rdx
pop %rcx
pop %rax
ret
@p_block
push %rax
push %rcx
push %rdx
push %rsi
push %rdi
cmp $21,%eax
jae @p_block_end
cmp $20,%ecx
jae @p_block_end
shl $3,%eax
shl $3,%ecx
lea 4(%rax,%rax,2),%eax
lea 4(%rcx,%rcx,2),%ecx
mov $20,%esi
mov %esi,%edi
call @rect
@p_block_end
pop %rdi
pop %rsi
pop %rdx
pop %rcx
pop %rax
ret
@p_tetris
push %rax
push %rcx
push %rdx
push %rsi
push %rbx
push %r8
lea @Tetris_color-@_$NEXT(%rip),%r8
mov %edx,%esi
and $0xfc,%dl
mov (%r8,%rdx,1),%edx
shl $1,%esi
mov @Tetris_bitmap-@Tetris_color(%r8,%rsi,1),%si
mov $4,%bh
@p_tetris_X1
mov $4,%bl
@p_tetris_X2
test $1,%esi
je @p_tetris_X3
call @p_block
@p_tetris_X3
shr $1,%esi
inc %eax
dec %bl
jne @p_tetris_X2
sub $4,%eax
inc %ecx
dec %bh
jne @p_tetris_X1
pop %r8
pop %rbx
pop %rsi
pop %rdx
pop %rcx
pop %rax
ret
@p_map
push %rax
push %rcx
push %rdx
push %rsi
push %rdi
lea @_$DATA+256-@_$NEXT(%rip),%rsi
mov %rsi,%rdi
xor %ecx,%ecx
@p_map_X1
xor %eax,%eax
@p_map_X2
mov (%rsi),%dl
test %dl,%dl
je @p_map_X3
movzbl %dl,%edx
shl $2,%edx
mov @Tetris_color-4-@_$DATA-256(%rdi,%rdx,1),%edx
call @p_block
@p_map_X3
inc %rsi
inc %eax
cmp $16,%eax
jne @p_map_X2
inc %ecx
cmp $20,%ecx
jne @p_map_X1
pop %rdi
pop %rsi
pop %rdx
pop %rcx
pop %rax
ret
@paint_all
push %rbx
push %r8
lea @N_bitmap-@_$NEXT(%rip),%r8
mov $122936,%ecx
xor %eax,%eax
lea @_$DATA+576-@N_bitmap(%r8),%rdx
@paint_all_clear
mov %rax,(%rdx)
add $8,%rdx
dec %ecx
jne @paint_all_clear
mov $388,%eax
xor %ecx,%ecx
mov $1,%esi
mov $484,%edi
mov $0xffffff,%edx
call @rect
mov $390+72,%eax
mov $2,%ecx
mov $4,%ebx
@paint_all_NEXT
movzbl @NEXT_str-1-@N_bitmap(%r8,%rbx,1),%edx
add %r8,%rdx
call @p_letter
sub $24,%eax
dec %ebx
jne @paint_all_NEXT
mov $390+96,%eax
mov $200,%ecx
mov $5,%ebx
@paint_all_SCORE
movzbl @SCORE_str-1-@N_bitmap(%r8,%rbx,1),%edx
add %r8,%rdx
call @p_letter
sub $24,%eax
dec %ebx
jne @paint_all_SCORE
call @p_map
mov @_$DATA+36-@_$NEXT(%rip),%edx
mov $17,%eax
mov $2,%ecx
call @p_tetris
mov @_$DATA+32-@_$NEXT(%rip),%edx
mov @_$DATA+40-@_$NEXT(%rip),%eax
mov @_$DATA+44-@_$NEXT(%rip),%ecx
call @p_tetris
mov @_$DATA+52-@_$NEXT(%rip),%eax
mov $490,%ebx
@p_score_X1
xor %edx,%edx
mov $10,%ecx
div %ecx
xchg %eax,%ebx
mov $226,%ecx
call @p_digit
sub $16,%eax
xchg %eax,%ebx
test %eax,%eax
jne @p_score_X1
pop %r8
pop %rbx
ret
@Tetris_rand
push %rcx
push %rdx
push %rsi
push %rdi
push %r8
push %r9
push %r10
push %r11
push %rbp
mov %rsp,%rbp
and $0xf0,%spl
sub $48,%rsp
@rand_loop
mov %rsp,%rcx
.dllcall "msvcrt.dll" "rand_s"
test %rax,%rax
jne @rand_loop
mov (%rsp),%eax
mov $28,%ecx
xor %edx,%edx
div %ecx
mov %edx,%eax
mov %rbp,%rsp
pop %rbp
pop %r11
pop %r10
pop %r9
pop %r8
pop %rdi
pop %rsi
pop %rdx
pop %rcx
ret
@Tetris_clock
push %rcx
push %rdx
push %rsi
push %rdi
push %r8
push %r9
push %r10
push %r11
push %rbp
mov %rsp,%rbp
and $0xf0,%spl
sub $32,%rsp
.dllcall "msvcrt.dll" "clock"
mov %eax,%ecx
sub @_$DATA+60-@_$NEXT(%rip),%eax
mov %ecx,@_$DATA+60-@_$NEXT(%rip)
mov %rbp,%rsp
pop %rbp
pop %r11
pop %r10
pop %r9
pop %r8
pop %rdi
pop %rsi
pop %rdx
pop %rcx
ret
@Tetris_check
push %rcx
push %rdx
push %rbx
push %rsi
push %rdi
push %r8
lea @_$DATA+0-@_$NEXT(%rip),%r8
mov 40(%r8),%eax
mov 44(%r8),%ecx
mov 32(%r8),%edx
shl $1,%edx
mov @Tetris_bitmap-@_$DATA+0(%r8,%rdx,1),%dx
mov $4,%bh
@Tetris_check_X1
mov $4,%bl
@Tetris_check_X2
test $1,%edx
je @Tetris_check_X3
cmp $16,%eax
jae @Tetris_check_fail
mov %ecx,%esi
cmp $0,%esi
jl @Tetris_check_X3
cmp $20,%esi
jae @Tetris_check_fail
mov %ecx,%esi
shl $4,%esi
add %eax,%esi
cmpb $0,256(%r8,%rsi,1)
jne @Tetris_check_fail
@Tetris_check_X3
shr $1,%edx
inc %eax
dec %bl
jne @Tetris_check_X2
sub $4,%eax
inc %ecx
dec %bh
jne @Tetris_check_X1
@Tetris_check_success
xor %eax,%eax
jmp @Tetris_check_end
@Tetris_check_fail
mov $1,%eax
@Tetris_check_end
pop %r8
pop %rdi
pop %rsi
pop %rbx
pop %rdx
pop %rcx
ret
@game_over_msg
.string "Game Over"
@Tetris_game_over
movb $1,@_$DATA+48-@_$NEXT(%rip)
and $0xf0,%spl
sub $32,%rsp
mov @_$DATA+0-@_$NEXT(%rip),%rcx
xor %edx,%edx
.dllcall "user32.dll" "KillTimer"
xor %ecx,%ecx
mov %ecx,%r9d
lea @game_over_msg-@_$NEXT(%rip),%rdx
mov %rdx,%r8
.dllcall "user32.dll" "MessageBoxA"
xor %ecx,%ecx
mov %rcx,(%rsp)
.dllcall "msvcrt.dll" "exit"
@Tetris_put
push %rax
push %rcx
push %rdx
push %rbx
push %rsi
push %rdi
push %r8
lea @_$DATA-@_$NEXT(%rip),%r8
mov 40(%r8),%eax
mov 44(%r8),%ecx
mov 32(%r8),%edx
mov %edx,%esi
shr $2,%esi
inc %esi
shl $1,%edx
mov @Tetris_bitmap-@_$DATA(%r8,%rdx,1),%dx
mov $4,%bh
@Tetris_put_X1
mov $4,%bl
@Tetris_put_X2
test $1,%edx
je @Tetris_put_X3
cmp $0,%ecx
jl @Tetris_game_over
incb 129(%r8,%rcx,1)
mov %ecx,%edi
shl $4,%edi
add %eax,%edi
mov %sil,256(%r8,%rdi,1)
@Tetris_put_X3
shr $1,%edx
inc %eax
dec %bl
jne @Tetris_put_X2
sub $4,%eax
inc %ecx
dec %bh
jne @Tetris_put_X1
xor %ecx,%ecx
mov %ecx,%eax
@Tetris_put_X4
cmpb $16,129(%r8,%rcx,1)
jne @Tetris_put_X5
mov %ecx,%edx
@Tetris_put_X6
mov 129-1(%r8,%rdx,1),%bl
mov %bl,129(%r8,%rdx,1)
dec %edx
jne @Tetris_put_X6
mov %eax,%edx
@Tetris_put_X7
mov 240(%r8,%rdx,1),%rbx
mov %rbx,256(%r8,%rdx,1)
mov 240+8(%r8,%rdx,1),%rbx
mov %rbx,256+8(%r8,%rdx,1)
sub $16,%edx
jne @Tetris_put_X7
incl @_$DATA+52-@_$NEXT(%rip)
mov @_$DATA+56-@_$NEXT(%rip),%edx
sub $400,%edx
mov %edx,%ebx
shl $7,%edx
sub %ebx,%edx
shr $7,%edx
add $400,%edx
mov %edx,@_$DATA+56-@_$NEXT(%rip)
@Tetris_put_X5
add $16,%eax
inc %ecx
cmp $20,%ecx
jne @Tetris_put_X4
mov @_$DATA+36-@_$NEXT(%rip),%eax
mov %eax,@_$DATA+32-@_$NEXT(%rip)
call @Tetris_rand
mov %eax,@_$DATA+36-@_$NEXT(%rip)
movl $6,@_$DATA+40-@_$NEXT(%rip)
movl $-4,@_$DATA+44-@_$NEXT(%rip)
pop %r8
pop %rdi
pop %rsi
pop %rbx
pop %rdx
pop %rcx
pop %rax
ret
@Tetris_rotate
push %rax
push %rcx
testb $1,@_$DATA+48-@_$NEXT(%rip)
jne @Tetris_rotate_X1
mov @_$DATA+32-@_$NEXT(%rip),%eax
lea 1(%rax),%ecx
mov %al,%ch
and $3,%cl
and $0xfc,%al
or %cl,%al
mov %eax,@_$DATA+32-@_$NEXT(%rip)
call @Tetris_check
test %al,%al
je @Tetris_rotate_X1
mov %ch,@_$DATA+32-@_$NEXT(%rip)
@Tetris_rotate_X1
call @redraw
pop %rcx
pop %rax
ret
@Tetris_move
push %rax
push %rdx
testb $1,@_$DATA+48-@_$NEXT(%rip)
jne @Tetris_move_end
add %eax,@_$DATA+40-@_$NEXT(%rip)
add %ecx,@_$DATA+44-@_$NEXT(%rip)
mov %eax,%edx
call @Tetris_check
xchg %eax,%edx
test %dl,%dl
je @Tetris_move_X1
sub %eax,@_$DATA+40-@_$NEXT(%rip)
sub %ecx,@_$DATA+44-@_$NEXT(%rip)
@Tetris_move_X1
test %dl,%cl
je @Tetris_move_end
call @Tetris_put
@Tetris_move_end
call @redraw
pop %rdx
pop %rax
ret
@game_init
call @Tetris_rand
mov %eax,@_$DATA+32-@_$NEXT(%rip)
call @Tetris_rand
mov %eax,@_$DATA+36-@_$NEXT(%rip)
movl $6,@_$DATA+40-@_$NEXT(%rip)
movl $-4,@_$DATA+44-@_$NEXT(%rip)
movl $1000,@_$DATA+56-@_$NEXT(%rip)
ret
@WndProc
push %rbp
mov %rsp,%rbp
push %r9
push %r8
push %rdx
push %rcx
cmp $2,%edx
jne @WndProc_Destroy
xor %ecx,%ecx
sub $24,%rsp
push %rcx
.dllcall "msvcrt.dll" "exit"
@WndProc_Destroy
cmp $15,%edx
jne @WndProc_Paint
push %rbx
push %r12
push %r13
push %r14
sub $160,%rsp
mov %rcx,%r12
lea 32(%rsp),%rdx
.dllcall "user32.dll" "BeginPaint"
mov %rax,%rcx
mov %rax,%r13
.dllcall "gdi32.dll" "CreateCompatibleDC"
mov %rax,%r14
mov %r13,%rcx
mov $508,%edx
mov $484,%r8d
.dllcall "gdi32.dll" "CreateCompatibleBitmap"
mov %rax,%rbx
mov %rax,%rdx
mov %r14,%rcx
.dllcall "gdi32.dll" "SelectObject"
call @paint_all
mov %rbx,%rcx
mov $983488,%edx
lea @_$DATA+576-@_$NEXT(%rip),%r8
.dllcall "gdi32.dll" "SetBitmapBits"
sub $8,%rsp
mov %r13,%rcx
xor %edx,%edx
xor %r8d,%r8d
mov $508,%r9d
pushq $0xcc0020
push %rdx
push %rdx
push %r14
pushq $484
sub $32,%rsp
.dllcall "gdi32.dll" "BitBlt"
add $80,%rsp
mov %rbx,%rcx
.dllcall "gdi32.dll" "DeleteObject"
mov %r14,%rcx
.dllcall "gdi32.dll" "DeleteDC"
lea 32(%rsp),%rdx
mov %r12,%rcx
.dllcall "user32.dll" "EndPaint"
add $160,%rsp
pop %r14
pop %r13
pop %r12
pop %rbx
jmp @WndProc_End
@WndProc_Paint
cmp $256,%edx
jne @WndProc_Keydown
cmp $38,%r8d
jne @Keydown_Up
call @Tetris_rotate
jmp @WndProc_End
@Keydown_Up
cmp $40,%r8d
jne @Keydown_Down
xor %eax,%eax
mov $1,%ecx
call @Tetris_move
jmp @WndProc_End
@Keydown_Down
cmp $37,%r8d
jne @Keydown_Left
xor %ecx,%ecx
mov $-1,%eax
call @Tetris_move
jmp @WndProc_End
@Keydown_Left
cmp $39,%r8d
jne @Keydown_Right
xor %ecx,%ecx
mov $1,%eax
call @Tetris_move
@Keydown_Right
@WndProc_Keydown
cmp $275,%edx
jne @WndProc_Timer
call @Tetris_clock
shl $1,%eax
add @_$DATA+64-@_$NEXT(%rip),%eax
cmp @_$DATA+56-@_$NEXT(%rip),%eax
jb @clock_X1
sub @_$DATA+56-@_$NEXT(%rip),%eax
push %rax
xor %eax,%eax
mov $1,%ecx
call @Tetris_move
pop %rax
@clock_X1
mov %eax,@_$DATA+64-@_$NEXT(%rip)
@WndProc_Timer
@WndProc_End
lea -32(%rbp),%rsp
mov (%rsp),%rcx
mov 8(%rsp),%rdx
mov 16(%rsp),%r8
mov 24(%rsp),%r9
.dllcall "user32.dll" "DefWindowProcA"
mov %rbp,%rsp
pop %rbp
ret
.entry
push %rbp
mov %rsp,%rbp
sub $80,%rsp
call @game_init
xor %ebx,%ebx
movq $80,(%rsp)
lea @WndProc-@_$NEXT(%rip),%rax
mov %rax,8(%rsp)
mov %rbx,16(%rsp)
lea @_$IMAGE-@_$NEXT(%rip),%rax
mov %rax,24(%rsp)
sub $16,%rsp
mov $0x7f00,%edx
mov %ebx,%ecx
push %rdx
push %rcx
.dllcall "user32.dll" "LoadIconA"
add $16,%rsp
mov %rax,48(%rsp)
mov $0x7f00,%edx
mov %ebx,%ecx
push %rdx
push %rcx
.dllcall "user32.dll" "LoadCursorA"
add $32,%rsp
mov %rax,40(%rsp)
movq $8,48(%rsp)
mov %rbx,56(%rsp)
lea @WinName-@_$NEXT(%rip),%rax
mov %rax,64(%rsp)
mov %rbx,72(%rsp)
mov %rsp,%rcx
sub $24,%rsp
push %rcx
.dllcall "user32.dll" "RegisterClassExA"
add $32,%rsp
test %rax,%rax
je @Err_Exit
push %rbx
lea @_$IMAGE-@_$NEXT(%rip),%rax
push %rax
push %rbx
push %rbx
pushq $484+29
pushq $508+6
mov $0x80000000,%eax
push %rax
push %rax
mov $0x10c80000,%r9d
lea @WinName-@_$NEXT(%rip),%rdx
mov %rdx,%r8
mov $0x100,%ecx
push %r9
push %r8
push %rdx
push %rcx
.dllcall "user32.dll" "CreateWindowExA"
test %rax,%rax
je @Err_Exit
mov %rax,@_$DATA+0-@_$NEXT(%rip)
mov @_$DATA+0-@_$NEXT(%rip),%rax
mov %rax,%rcx
xor %edx,%edx
mov %edx,%r9d
mov $15,%r8d
.dllcall "user32.dll" "SetTimer"
call @Tetris_clock
@MsgLoop
lea 32(%rsp),%rcx
xor %edx,%edx
mov %edx,%r8d
mov %edx,%r9d
.dllcall "user32.dll" "GetMessageA"
cmp $0,%rax
jl @Err_Exit
lea 32(%rsp),%rcx
.dllcall "user32.dll" "TranslateMessage"
lea 32(%rsp),%rcx
.dllcall "user32.dll" "DispatchMessageA"
jmp @MsgLoop
@Err_Exit
mov %rbp,%rsp
pop %rbp
ret
.align 2
@digits_bitmap
.word 075557
.word 044444
.word 071747
.word 074747
.word 044755
.word 074717
.word 075717
.word 044447
.word 075757
.word 074757
@N_bitmap
.byte 021
.byte 023
.byte 025
.byte 031
.byte 021
@E_bitmap
.byte 037
.byte 001
.byte 037
.byte 001
.byte 037
@X_bitmap
.byte 021
.byte 012
.byte 004
.byte 012
.byte 021
@T_bitmap
.byte 037
.byte 004
.byte 004
.byte 004
.byte 004
@S_bitmap
.byte 036
.byte 001
.byte 016
.byte 020
.byte 017
@C_bitmap
.byte 036
.byte 001
.byte 001
.byte 001
.byte 036
@O_bitmap
.byte 016
.byte 021
.byte 021
.byte 021
.byte 016
@R_bitmap
.byte 017
.byte 021
.byte 017
.byte 005
.byte 031
@NEXT_str
.byte 0,5,10,15
@SCORE_str
.byte 20,25,30,35,5
@Tetris_bitmap
.word 0x0660
.word 0x0660
.word 0x0660
.word 0x0660
.word 0x0072
.word 0x0262
.word 0x0270
.word 0x0232
.word 0x00f0
.word 0x2222
.word 0x00f0
.word 0x2222
.word 0x0074
.word 0x0622
.word 0x0170
.word 0x0223
.word 0x0063
.word 0x0264
.word 0x0063
.word 0x0264
.word 0x0071
.word 0x0226
.word 0x0470
.word 0x0322
.word 0x0036
.word 0x0231
.word 0x0036
.word 0x0231
@Tetris_color
.long 0x00ff00,0xffff00,0xff00ff,0xff0000,0x00ffff,0xff0000,0x00ffff
@WinName
.string "Tetris"
.datasize 995328