-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphic_tetris.v2.s
686 lines (578 loc) · 16.9 KB
/
graphic_tetris.v2.s
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
.eqv VGA 0xFF000000
.eqv NUMX 320
.eqv NUMY 240
# Lado do quadrado
.eqv SIDE 7
# Parametros fixos
.eqv PAR_X1 70
.eqv PAR_Y0 50
.eqv PAR_Y1 140
# Cores
.eqv BLACK 0x00
.eqv RED 0x0F #0x03
.eqv ORANGE 0x1F
.eqv GREEN 0x30
.eqv YELLOW 0x3F
.eqv DARK_BLUE 0x99
.eqv CYAN 0xF0
.eqv WHITE 0xFF
.eqv PURPLE 0xCC #0x87
.data
FILE: .asciiz "output.bin"
# Matrizes para plotar as peças em suas 4 possíveis rotações
L0: .half 0x2e00, 0x88c0, 0xe800, 0xc440
I0: .half 0xf000, 0x8888, 0xf000, 0x8888
J0: .half 0x8e00, 0xc880, 0xe200, 0x44c0
T0: .half 0x4e00, 0x8c80, 0xe400, 0x4c40
S0: .half 0x8c40, 0x6c00, 0x8c40, 0x6c00
Z0: .half 0x4c80, 0xc600, 0x4c80, 0xc600
Q0: .half 0xcc00, 0xcc00, 0xcc00, 0xcc00
# Mensagens para display
MSG0:.asciiz "Insert the number of players (1-4): "
PTS: .asciiz "Score"
GAME_OVER: .asciiz "GAME OVER"
# Parametros dependentes do número de jogadores
PAR_4P: .word 0x04081D4E # 4 jogadores
PAR_3P: .word 0x031c3162 # 3 jogadores
PAR_2P: .word 0x023C5182 # 2 jogadores
PAR_1P: .word 0x017d92c3 # 1 jogador
# Matriz do jogo
LINE_0: .word 0x000058D1
LINE_1: .word 0x000058D1
LINE_2: .word 0x000058D1
LINE_3: .word 0x000058D1
LINE_4: .word 0x0
LINE_5: .word 0x0
LINE_6: .word 0x0
LINE_7: .word 0x0
LINE_8: .word 0x0
LINE_9: .word 0x0
LINE_10: .word 0x0
LINE_11: .word 0x0
LINE_12: .word 0x0
LINE_13: .word 0x0
LINE_14: .word 0x0
LINE_15: .word 0x0
LINE_16: .word 0x0
LINE_17: .word 0x0
LINE_18: .word 0x0
LINE_19: .word 0x0
# Pontuações
SCORE12: .word 0x00750000 # Jogador 1 (upper 2 bytes) e 2 (lower 2 bytes)
SCORE34: .word 0x00000000 # Jogador 3 (upper 2 bytes) e 4 (lower 2 bytes)
.text
MAIN: la $a0, MSG0 # Pergunta quantidade de jogadores
li $a1, 3
li $a2, 3
li $a3, 0xFF00
li $v0, 104
syscall
li $v0, 5 # Le do teclado a quantidade de jogadores
syscall
move $s3, $v0
# Abre o arquivo
la $a0,FILE
li $a1,0
li $a2,0
li $v0,13
syscall
# Le o arquivos para a memoria VGA
move $a0,$v0
la $a1,0xFF000000
li $a2,76800
li $v0,14
syscall
#Fecha o arquivo
move $a0,$s1
li $v0,16
syscall
beq $s3, 4, P4 # Seleciona os parametros dependentes do número de jogadores
beq $s3, 3, P3
beq $s3, 2, P2
beq $s3, 1, P1
P4: la $t0, PAR_4P
j pass_main
P3: la $t0, PAR_3P
j pass_main
P2: la $t0, PAR_2P
j pass_main
P1: la $t0, PAR_1P
pass_main: lw $s0, 0($t0) # Carrega parâmetros da memória
andi $a0, $s0, 0x00FF0000
srl $a0, $a0, 16
andi $a1, $s0, 0x0000FF00
srl $a1, $a1, 8
andi $a2, $s0, 0x000000FF
li $a3, NUMX
jal show_initial # Plota tela inicial de jogo
#################################
########### TESTES ##############
#################################
lw $s1, SCORE12 # Carrega da memória as pontuações dos jogadores
lw $s2, SCORE34
andi $a0, $s1, 0xFFFF0000
srl $a0, $a0, 16
li $a1, 0
jal write_score # Escreve a pontuação do jogador 1
li $a0, 15
li $a1, PAR_Y0
li $a2, 0
li $a3, 0
jal plot # Plota a peça L em todas as rotações
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 43 # Plota a peça J em todas as rotações
li $a1, PAR_Y0
li $a2, 2
li $a3, 0
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 43 # Plota a peça I em todas as rotações
li $a1, 80
li $a2, 1
li $a3, 0
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 15 # Plota a peça T em todas as rotações
li $a1, 110
li $a2, 3
li $a3, 0
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 15 # Plota a peça S em todas as rotações
li $a1, 140
li $a2, 4
li $a3, 0
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 43 # Plota a peça Z em todas as rotações
li $a1, 140
li $a2, 5
li $a3, 0
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 43 # Plota a peça Q em todas as rotações
li $a1, 170
li $a2, 6
li $a3, 0
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
addi $a0, $a0, 78
addi $a3, $a3, 1
jal plot
li $a0, 2
li $a1, 0
li $a2, 3
#jal plot_matrix
li $a0, 0
#jal game_over
li $v0, 10
syscall
#################################################################################################
######### A rotina abaixo plota um quadrado 7x7 pixels. Recebe como argumento
######### a localização (x,y) e a cor.
#################################################################################################
plot_square: li $t5, PAR_Y0 # Posição inicial da tela de jogo em Y
li $t2, SIDE # Lado do quadrado l
addi $t2, $t2, -1 # l = l - 1
li $t0, 1 # count_x = 1
loopx: beq $t0, $t2, saix # se count_x = l, sai
li $t1, 1 # count_y = 1
add $t3, $t0, $a0 # x = count_x + x_inicial
loopy: beq $t1, $t2, saiy # se count_y = l, sai
add $t4, $t1, $a1 # y = count_y + y_inicial
sgt $t5, $t4, $t5 # se y está fora área de jogo, não plota
beq $t5, $zero, pass_sq
li $t9, NUMX
mult $t4, $t9 # y*320
mflo $t4
add $t4, $t4, $t3 # y*320 + x
addi $t4, $t4, VGA # endereço inicial + offset calculado
sb $a3, 0($t4) # plota um pixel na tela
pass_sq: addi $t1, $t1, 1 # incrementa o contador de y
j loopy
saiy: add $t0, $t0, 1 # incrementa o contador de x
j loopx
saix: jr $ra
#################################################################################################
######### A rotina abaixo plota uma peça. Recebe como argumento a localização (x,y),
######### o tipo da peça, a rotação, e o tipo de cor (branca ou colorida).
#################################################################################################
plot: addi $sp, $sp, -16 # Salva os argumentos na pilha
sw $a3, 12($sp)
sw $a2, 8($sp)
sw $a1, 4($sp)
sw $a0, 0($sp)
srl $t3, $a2, 3 # Extrai o bit de codificacao da cor
andi $a2, $a2, 0x07 # Extrai os bits de codificacao da peca
sll $t6, $a2, 3 # Calcula o offset do endereco da matriz a ser utilizada
sll $a3, $a3, 1 # (offset = 8*tipo_peça + 2*rotação)
add $t6, $t6, $a3
la $t7, L0 # Carrega endereço inicial das matrizes das peças
add $t7, $t7, $t6 # Faz end = end_inicial + offset
lhu $t6, 0($t7) # Carrega a matriz a ser utilizada
li $t2, 4 # Tamanho da matriz
move $t7, $zero # Inicializa i
move $t0, $zero # Inicializa contador
# Os blocos abaixo definem a cor do plot
bnez $t3, color_black
beq $a2, 0, color_orange
beq $a2, 1, color_cyan
beq $a2, 2, color_blue
beq $a2, 3, color_purple
beq $a2, 4, color_green
beq $a2, 5, color_red
beq $a2, 6, color_yellow
color_red: li $a3, RED
j loop_plot0
color_cyan: li $a3, CYAN
j loop_plot0
color_green: li $a3, GREEN
j loop_plot0
color_yellow: li $a3, YELLOW
j loop_plot0
color_blue: li $a3, DARK_BLUE
j loop_plot0
color_purple: li $a3, PURPLE
j loop_plot0
color_orange: li $a3, ORANGE
j loop_plot0
color_black: li $a3, BLACK
# Loop de plot da matriz
loop_plot0: beq $t0, $t2, sai_plot0 # Se i = 4, sai
move $t1, $zero # Inicializa j
loop_plot1: beq $t1, $t2, sai_plot1 # Se j = 4, sai
sllv $t5, $t6, $t7 # Extrai o bit na posição (i,j) da matriz
sll $t5, $t5, 16
srl $t5, $t5, 31
beq $t5, $zero, pass0 # Se bit = 0, pula o proximo bloco
addi $sp, $sp, -16 # Salva na pilha as variáveis que estão sendo utilizadas
sw $ra, 12($sp)
sw $t0, 8($sp)
sw $t1, 4($sp)
sw $t2, 0($sp)
jal plot_square # Plota quadrado
lw $t2, 0($sp) # Recupera as variáveis temporárias da pilha
lw $t1, 4($sp)
lw $t0, 8($sp)
lw $ra, 12($sp)
addi $sp, $sp, 16
pass0: addi $t1, $t1, 1 # Incrementa j
addi $a0, $a0, SIDE # Incrementa posição de plot em x
addi $t7, $t7, 1 # Incrementa contador
j loop_plot1
sai_plot1: addi $t0, $t0, 1 # Incrementa i
addi $a1, $a1, SIDE # Incrementa posição de plot em y
addi $a0, $a0, -28 # Volta para a posição inicial de plot em x
j loop_plot0
sai_plot0: lw $a0, 0($sp)
lw $a1, 4($sp)
lw $a2, 8($sp)
lw $a3, 12($sp)
addi $sp, $sp, 16
jr $ra
#################################################################################################
######### A rotina abaixo plota o ambiente do jogo.
#################################################################################################
show_initial: addi $sp, $sp, -20
sw $ra, 16($sp)
sw $a3, 12($sp)
sw $a2, 8($sp)
sw $a1, 4($sp)
sw $a0, 0($sp)
#li $a0, WHITE # Limpa a tela
#li $v0, 48
#syscall
#lw $a0, 0($sp)
move $t3, $zero # Inicializa fim_plot_x
li $a3, BLACK # Cor do fundo
move $t0, $a0 # x_inicial = início da área de jogo em x
move $t2, $a0 # início da área de jogo em x
loop0: li $t9, NUMX # tamanho_x
sub $t5, $t9, $t2 # limite_x
sgt $t5, $t0, $t5 # se x > limite_x, sai
bne $t5, $zero, sai0
add $t3, $t3, $t2 # fim_plot_x = x_inicial + largura_area_jogo
addi $t3, $t3, PAR_X1
loop1: bge $t0, $t3, sai1 # se x >= fim_plot_x, sai
li $t1, PAR_Y0 # y_inicial = inicio da area de jogo em y
addi $t5, $t1, PAR_Y1 # fim_plot_y = y_inicial + altura da área de jogo
loop2: bge $t1, $t5, sai2 # se y >= fim_plot_y, sai
mult $t1, $t9 # y*320
mflo $t4
add $t4, $t4, $t0 # y*320 + x
addi $t4, $t4, VGA # endereço inicial + offset calculado
sb $a3, 0($t4) # plota um pixel na tela
addi $t1, $t1, 1 # incrementa o contador
j loop2
sai2: addi $t0, $t0, 1 # incrementa x
j loop1
sai1: add $t0, $t0, $t2 # x_inicial da próxima área de jogo
j loop0
############################################### Plota espaço para a próxima peça
sai0: move $t3, $zero # Inicializa fim_plot_x
li $a3, BLACK # Cor do fundo
move $t0, $a0 # x_inicial = início da área de jogo em x
andi $t7, $s0, 0x000000FF # offset
andi $t8, $s0, 0xFF000000
srl $t8, $t8, 24 # número de jogadores
move $t2, $a0 # início da área de jogo em x
move $t6, $zero
addi $t2, $t2, 21
loop00: beq $t6, $t8, sai00
move $t0, $t2
addi $t3, $t2, 28 # fim_plot_x = x_inicial + largura_area_jogo
loop01: bgt $t0, $t3, sai01 # se x >= fim_plot_x, sai
li $t1, 15 # y_inicial = inicio da area de jogo em y
li $t5, 43 # fim_plot_y = y_inicial + altura da área de jogo
loop02: bge $t1, $t5, sai02 # se y >= fim_plot_y, sai
mult $t1, $t9 # y*320
mflo $t4
add $t4, $t4, $t0 # y*320 + x
addi $t4, $t4, VGA # endereço inicial + offset calculado
sb $a3, 0($t4) # plota um pixel na tela
addi $t1, $t1, 1 # incrementa o contador
j loop02
sai02: addi $t0, $t0, 1 # incrementa x
j loop01
sai01: add $t2, $t2, $t7 # x_inicial da próxima área de jogo
addi $t6, $t6, 1
j loop00
sai00: # Os blocos seguintes plotam os placares
li $a2, PAR_Y0 # pos_y = inicio_area_jogo_y + altura_area_jogo + lado_quadrado
addi $a2, $a2, PAR_Y1
addi $a2, $a2, SIDE
li $t1, NUMX # fim_x
andi $t2, $s0, 0x00FF0000 # limite_x
srl $t2, $t2, 16
sub $t0, $t1, $t2
andi $t1, $s0, 0x00FF0000 # x_inicial = inicio_area_jogo_x
srl $t1, $t1, 16
addi $t1, $t1, SIDE
addi $t1, $t1, SIDE
loop_score: bge $t1, $t0, sai_score # se x >= limite_x, sai
la $a0, PTS # carrega string 'Score'
move $a1, $t1 # plota string
li $a3, 0xFE00
li $v0, 104
syscall
andi $t3, $s0, 0x000000FF # x = x + shift_x
add $t1, $t1, $t3
j loop_score
sai_score: lw $a0, 0($sp)
lw $a1, 4($sp)
lw $a2, 8($sp)
lw $a3, 12($sp)
lw $ra, 16($sp)
addi $sp, $sp, 20
jr $ra
#################################################################################################
######### A rotina abaixo plota a prima peça que vai descer. Recebe en $a2 e $a3 o tipo da
######### peça e a rotação.
#################################################################################################
plot_prox: andi $t0, $s0, 0x000000FF
andi $t1, $s0, 0x00FF0000
srl $t1, $t1, 16
mult $t0, $s3
mflo $t0
add $a0, $t0, $t1
add $a0, $a0, 21
li $a1, 15
addi $sp, $sp, -4
sw $ra, 0($sp)
jal plot
lw $ra, 0($sp)
jr $ra
#################################################################################################
######### Atualiza a pontuação de um jogador. Recebe como argumento em $a0 a pontuação e em
######### $a1 o código do jogador.
#################################################################################################
write_score: addi $sp, $sp, -16 # salva os argumentos na pilha
sw $a3, 12($sp)
sw $a2, 8($sp)
sw $a1, 4($sp)
sw $a0, 0($sp)
li $a2, PAR_Y0 # inicio da área de jogo em y
addi $a2, $a2, PAR_Y1 # y_inicial = inicio_área_jogo_y + altura_área_jogo + 3*lado_quadrado
addi $a2, $a2, SIDE
addi $a2, $a2, SIDE
addi $a2, $a2, SIDE
andi $t2, $s0, 0x00FF0000 # inicio_x = inicio da área de jogo em x
srl $t2, $t2, 16
li $t1, NUMX # fim_x = 320
sub $t0, $t1, $t2 # limite_x = 320 - inicio_area_jogo_x
andi $t3, $s0, 0x000000FF # shift_x
mult $a1, $t3
mflo $t3 # shift_x * nro_jogadores
add $t2, $t2, $t3 # pos_x = inicio_x + shift_x * nro_jogadores + 3 * lado_quadrado
addi $t2, $t2, SIDE
addi $t2, $t2, SIDE
addi $t2, $t2, SIDE
move $a1, $t2
li $a3, 0xFE00
li $v0, 101
syscall # plota a pontuação na tela do jogador
passa_wscore: lw $a0, 0($sp)
lw $a1, 4($sp)
lw $a2, 8($sp)
lw $a3, 12($sp)
addi $sp, $sp, 16
jr $ra
#################################################################################################
######### A rotina abaixo plota uma linha da matriz de jogo. Recebe como argumento a
######### linha que vai ser plotada e o player.
#################################################################################################
plot_line: addi $sp, $sp, -16 # Salva os argumentos na pilha
sw $a3, 12($sp)
sw $a2, 8($sp)
sw $a1, 4($sp)
sw $a0, 0($sp)
sll $t0, $a0, 2
la $t9, LINE_0
add $t0, $t0, $t9 # endereco da linha a ser plotada
lw $t0, 0($t0) # carrega a linha a ser plotada
andi $t3, $s0, 0x00FF0000
srl $t3, $t3, 16
andi $t4, $s0, 0x000000FF
mult $t4, $a1
mflo $t4
add $t3, $t3, $t4
addi $t4, $zero, SIDE # calcula a posição da linha em y
mult $t4, $a0
mflo $t4
addi $a1, $t4, PAR_Y0
move $t1, $zero # inicializa o contador de pixels
loop_line: bge $t1, 70, end_line
andi $t2, $t0, 0x07
srl $t0, $t0, 3
beq $t2, $zero, lcolor_black
beq $t2, 1, lcolor_orange
beq $t2, 2, lcolor_cyan
beq $t2, 3, lcolor_blue
beq $t2, 4, lcolor_purple
beq $t2, 5, lcolor_green
beq $t2, 6, lcolor_red
beq $t2, 7, lcolor_yellow
lcolor_black: li $a3, BLACK
j loop_plot_line
lcolor_red: li $a3, RED
j loop_plot_line
lcolor_cyan: li $a3, CYAN
j loop_plot_line
lcolor_green: li $a3, GREEN
j loop_plot_line
lcolor_yellow: li $a3, YELLOW
j loop_plot_line
lcolor_blue: li $a3, DARK_BLUE
j loop_plot_line
lcolor_purple: li $a3, PURPLE
j loop_plot_line
lcolor_orange: li $a3, ORANGE
loop_plot_line: addi $sp, $sp, -24 # Salva na pilha as variáveis que estão sendo utilizadas
sw $a0, 20($sp)
sw $ra, 16($sp)
sw $t0, 12($sp)
sw $t1, 8($sp)
sw $t2, 4($sp)
sw $t3, 0($sp)
add $a0, $t3, $t1
jal plot_square # Plota quadrado
lw $t3, 0($sp)
lw $t2, 4($sp) # Recupera as variáveis temporárias da pilha
lw $t1, 8($sp)
lw $t0, 12($sp)
lw $ra, 16($sp)
lw $a0, 20($sp)
addi $sp, $sp, 24
addi $t1, $t1, SIDE
j loop_line
end_line: lw $a0, 0($sp)
lw $a1, 4($sp)
lw $a2, 8($sp)
lw $a3, 12($sp)
addi $sp, $sp, 16
jr $ra
#################################################################################################
######### A rotina abaixo plota uma matriz de jogo. Recebe como argumento a primeira e a ultima
######### linha a serem plotadas.
#################################################################################################
plot_matrix: bgt $a0, $a2, fim_plot_mat
addi $sp, $sp, -4
sw $ra, 0($sp)
jal plot_line
lw $ra, 0($sp)
addi $sp, $sp, 4
addi, $a0, $a0, 1
j plot_matrix
fim_plot_mat: jr $ra
#################################################################################################
######### Plota game over
#################################################################################################
game_over: andi $t0, $s0, 0x00FF0000
srl $t0, $t0, 16
andi $t1, $s0, 0x000000FF
mult $t1, $a0
mflo $t1
add $t0, $t0, $t1
addi, $t0, $t0, -1
la $a0, GAME_OVER
move $a1, $t0
addi $a2, $zero, PAR_Y0
addi $a2, $a2, 63
li $a3, 0x00FF
li $v0, 104
syscall
jr $ra
plot_next_piece: