-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkernel.asm
1605 lines (1381 loc) · 43.3 KB
/
kernel.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
org 0x7e00
jmp 0x0000:start
data:
;tela Menu
titulo db 'TAMAGOTCHI', 0
jogar db 'jogar (1)', 0
instrucoes db 'instrucoes (2)', 0
creditos db 'creditos (3)', 0
;tela Instruções
instrucoes2 db 'INSTRUCOES', 0
texto1 db 'Existem 3 tipos de vida, que decrescem acada 3 segundos', 0
texto2 db '1. Alimentar aumenta 1 coracao e diminui 1 gota', 0
texto3 db '2. Passear aumenta 1 carinha feliz e diminui 1 gota', 0
texto4 db '3. Dar banho aumenta 1 gota e diminui 1 carinha feliz', 0
texto5 db '4. Dormir aumenta 1 carinha feliz e diminui 1 coracao', 0
texto6 db 'Se alguma vida acabar ou extrapolar, o tamagotchi morre', 0
alimenta db 'Q - alimentar', 0
passea db 'W - passear', 0
dorme db 'E - nanar', 0
banho db 'R - banho', 0
;tela Créditos
creditos2 db 'CREDITOS', 0
day db 'Dayane Lira (dls6)', 0
aninha db 'Ana Leticia (alas3)', 0
alice db 'Alice Oliveira (aoqb)', 0
vic db 'Victoria Luisi (vlsc)', 0
;tela Nome
escolhaNome db 'Escolha o nome (ate 15 digitos): ', 0
nome_max_len equ 15
nome: resb nome_max_len+1
;tela Cor
escolhaCor db 'Escolha a cor do seu tamagotchi:', 0
azul db 'azul (1)', 0
rosa db 'rosa (2)', 0
verde db 'verde (3)', 0
;tela GameOver
gameOver db 'GAME OVER X_X', 0
;variáveis
cor db 0
qualTamagotchi db 0
qtVidas db 0
qtHappy db 0
qtGotas db 0
timerFake db 0
voltarMenu db 'Aperte enter pra voltar pro menu', 0
tamagotchi db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 13, 00, 13, 00, 00, 00, 00, 00, 15, 15, 15, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 13, 00, 13, 00
db 13, 13, 13, 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 13, 13, 13, 00
db 00, 13, 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 13, 00, 00
db 00, 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 15, 13, 13, 15, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 00
db 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15
db 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15
db 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15
db 00, 00, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 15, 00
db 00, 00, 00, 00, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
tamagotchi2 db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00, 00
db 13, 00, 13, 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00, 00
db 13, 13, 13, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 13, 00, 13
db 00, 13, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 13, 13, 13
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 13, 00
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 15, 13, 15, 13, 13, 13, 13, 15, 13, 15, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 15, 13, 13, 15, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00
db 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15
db 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15
db 00, 15, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 00
db 00, 00, 00, 00, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 15, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
tamagotchiMorto db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 15, 15, 04, 04, 04, 04, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 15, 13, 04, 04, 13, 13, 04, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 15, 13, 04, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 04, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 04, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 04, 13, 15, 13, 15, 13, 13, 13, 04, 15, 13, 15, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 00, 15, 13, 04, 13, 13, 15, 13, 13, 13, 13, 13, 04, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 04, 13, 13, 13, 15, 13, 13, 13, 13, 13, 04, 15, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 04, 13, 13, 15, 13, 15, 13, 13, 13, 13, 15, 04, 15, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 04, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 04, 13, 13, 13, 13, 13, 13, 15, 15, 13, 13, 04, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 00, 15, 04, 13, 13, 13, 13, 13, 13, 15, 13, 13, 15, 13, 13, 04, 13, 13, 13, 13, 13, 15, 00, 00
db 00, 15, 13, 04, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 15, 15, 00
db 15, 13, 13, 04, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 13, 13, 15
db 15, 13, 13, 04, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 13, 15
db 15, 15, 13, 04, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 13, 13, 13, 13, 15
db 00, 00, 15, 04, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 13, 13, 15, 15, 15, 00
db 00, 00, 04, 04, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 04, 15, 04, 04, 00, 00
db 00, 04, 04, 04, 04, 04, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 04, 04, 04, 04, 04, 00
db 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04
db 00, 00, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 00
db 00, 00, 00, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 00, 00
db 00, 00, 00, 00, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 04, 00, 00, 00, 00
vida db 00, 00, 13, 13, 00, 00, 00, 13, 13, 00, 00
db 00, 13, 13, 13, 13, 00, 13, 13, 13, 13, 00
db 13, 13, 15, 15, 13, 13, 13, 13, 13, 13, 13
db 13, 13, 15, 13, 13, 13, 13, 13, 13, 13, 13
db 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
db 00, 13, 13, 13, 13, 13, 13, 13, 13, 13, 00
db 00, 00, 13, 13, 13, 13, 13, 13, 13, 00, 00
db 00, 00, 00, 13, 13, 13, 13, 13, 00, 00, 00
db 00, 00, 00, 00, 13, 13, 13, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 13, 00, 00, 00, 00, 00
vida1 db 00, 00, 00, 13, 13, 13, 13, 00, 00, 00, 00
db 00, 00, 13, 13, 13, 13, 13, 13, 00, 00, 00
db 00, 13, 13, 13, 13, 13, 13, 13, 13, 00, 00
db 13, 13, 13, 00, 13, 13, 00, 13, 13, 13, 00
db 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 00
db 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 00
db 13, 13, 13, 00, 13, 13, 00, 13, 13, 13, 00
db 00, 13, 13, 13, 00, 00, 13, 13, 13, 00, 00
db 00, 00, 13, 13, 13, 13, 13, 13, 00, 00, 00
db 00, 00, 00, 13, 13, 13, 13, 00, 00, 00, 00
vida2 db 00, 00, 00, 00, 00, 13, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 13, 13, 13, 00, 00, 00, 00
db 00, 00, 00, 13, 13, 13, 13, 13, 00, 00, 00
db 00, 00, 13, 13, 13, 13, 13, 13, 13, 00, 00
db 00, 13, 13, 13, 13, 13, 13, 13, 13, 13, 00
db 00, 13, 13, 13, 13, 13, 13, 13, 13, 13, 00
db 00, 13, 13, 15, 13, 13, 13, 13, 13, 13, 00
db 00, 13, 13, 15, 13, 13, 13, 13, 13, 13, 00
db 00, 00, 13, 13, 15, 15, 13, 13, 13, 00, 00
db 00, 00, 00, 13, 13, 13, 13, 13, 00, 00, 00
comida db 00, 00, 00, 00, 00, 00, 00, 00, 06, 00, 00
db 00, 00, 00, 02, 10, 10, 00, 06, 00, 00, 00
db 00, 00, 02, 02, 02, 02, 06, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 06, 00, 00, 00, 00, 00
db 00, 00, 04, 04, 04, 04, 04, 04, 04, 00, 00
db 00, 04, 12, 12, 12, 04, 12, 12, 04, 04, 00
db 00, 12, 15, 15, 12, 12, 12, 12, 12, 04, 00
db 04, 15, 15, 12, 12, 12, 12, 12, 12, 04, 04
db 04, 12, 12, 12, 12, 12, 12, 12, 12, 04, 04
db 04, 12, 12, 12, 12, 12, 12, 12, 12, 04, 04
db 00, 12, 12, 12, 12, 12, 12, 12, 04, 04, 00
db 00, 04, 12, 12, 12, 12, 12, 04, 04, 04, 00
db 00, 00, 04, 04, 04, 04, 04, 04, 04, 00, 00
db 00, 00, 00, 04, 04, 00, 04, 04, 00, 00, 00
arvore db 00, 00, 10, 10, 10, 00, 10, 10, 10, 00, 00
db 00, 10, 10, 10, 10, 02, 10, 10, 10, 10, 00
db 00, 10, 10, 10, 10, 10, 02, 10, 10, 10, 00
db 10, 10, 02, 10, 10, 10, 10, 10, 02, 10, 10
db 00, 02, 10, 10, 10, 10, 10, 10, 10, 02, 00
db 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
db 00, 02, 10, 02, 10, 10, 10, 10, 10, 02, 00
db 00, 10, 02, 10, 02, 10, 10, 10, 02, 10, 00
db 00, 00, 10, 06, 10, 06, 10, 06, 10, 00, 00
db 00, 00, 00, 10, 06, 10, 06, 10, 00, 00, 00
db 00, 00, 00, 00, 06, 06, 06, 00, 00, 00, 00
db 00, 00, 00, 00, 06, 06, 06, 00, 00, 00, 00
db 00, 00, 00, 00, 06, 06, 06, 00, 00, 00, 00
db 00, 00, 00, 00, 06, 06, 06, 00, 00, 00, 00
db 00, 00, 00, 00, 06, 06, 06, 00, 00, 00, 00
db 00, 00, 00, 00, 06, 06, 06, 00, 00, 00, 00
db 00, 00, 00, 06, 06, 06, 06, 06, 00, 00, 00
db 00, 00, 06, 06, 06, 06, 06, 06, 06, 00, 00
dormindo db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 07, 07, 07, 07, 07, 07, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 07, 08, 08, 08, 08, 08, 08, 08, 07, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 07, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 07, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 07, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 07, 08, 08, 07, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 07, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 07, 08, 08, 07, 00, 00, 00, 00
db 00, 00, 00, 00, 07, 15, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 15, 08, 08, 07, 00, 15, 00
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 07, 08, 07, 15, 15, 15
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 07, 15, 15, 15
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 15, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 15, 13, 13, 15, 13, 13, 13, 13, 15, 13, 13, 15, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 15, 15, 13, 13, 13, 13, 13, 13, 15, 15, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 00, 00
db 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00
db 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00
db 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00
db 00, 00, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 15, 00, 00
db 00, 00, 00, 00, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
banheira db 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 00, 15, 15, 01, 15, 15, 15, 15, 15, 15, 00, 00, 00, 00, 00, 00, 00, 00
db 00, 01, 00, 00, 00, 00, 00, 15, 13, 13, 01, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 01, 00, 00
db 00, 01, 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 01, 13, 13, 13, 13, 15, 00, 00, 00, 01, 00, 00
db 00, 00, 00, 01, 00, 15, 01, 13, 13, 13, 13, 13, 13, 01, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 01, 15, 13, 01, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 01, 13, 15, 00, 00, 01, 00
db 00, 00, 00, 15, 13, 13, 13, 13, 15, 13, 13, 13, 13, 13, 13, 15, 13, 13, 01, 13, 13, 15, 00, 01, 00
db 00, 00, 00, 15, 13, 13, 13, 15, 13, 15, 13, 13, 13, 13, 15, 13, 15, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 01, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 01, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00, 00
db 00, 00, 15, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 00, 00
db 08, 08, 08, 08, 13, 13, 13, 13, 13, 13, 15, 13, 13, 15, 13, 13, 13, 13, 13, 13, 13, 08, 08, 08, 08
db 08, 08, 08, 07, 01, 01, 01, 13, 13, 13, 13, 15, 15, 13, 13, 13, 13, 13, 08, 08, 08, 07, 08, 08, 08
db 08, 08, 07, 07, 07, 01, 01, 01, 08, 08, 08, 08, 08, 08, 01, 01, 01, 01, 01, 07, 07, 07, 07, 08, 08
db 00, 00, 08, 07, 07, 07, 01, 07, 07, 07, 07, 07, 07, 07, 01, 01, 01, 01, 07, 07, 07, 07, 08, 00, 00
db 00, 00, 00, 08, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 01, 01, 07, 07, 07, 07, 08, 00, 00, 00
db 00, 00, 00, 08, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 01, 07, 07, 07, 07, 08, 00, 00, 00
db 00, 00, 00, 00, 08, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 08, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 08, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 08, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 08, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 08, 00, 00, 00, 00, 00, 00
db 00, 00, 00, 00, 00, 00, 00, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 00, 00, 00, 00, 00, 00, 00
; tamanho do corpo do tamagotchi x_x
tamagotchiW dw 25
tamagotchiH dw 25
; posicao do tamagotchi vivo na tela
tamagotchiX dw 80
tamagotchiY dw 270
; posicao do tamagotchi falecido na tela
tamagotchiMortoX dw 85
tamagotchiMortoY dw 290
; tamanho do <3
vidaW dw 11
vidaH dw 10
; posição X das vidas
vida1X dw 239
vida2X dw 252
vida3X dw 265
vida4X dw 278
vida5X dw 291
; posição Y das vidas
vidaY dw 2
vida1Y dw 14
vida2Y dw 26
;tamanho e posição dos objetos
comidaW dw 11
comidaH dw 14
comidaX dw 130
comidaY dw 60
banheiraW dw 25
banheiraH dw 25
banheiraX dw 80
banheiraY dw 270
arvoreW dw 11
arvoreH dw 25
arvoreX dw 260
arvoreY dw 70
dormindoW dw 26
dormindoH dw 29
dormindoX dw 80
dormindoY dw 265
; informações que a funcao drawAnything vai usar, porque assim pra qualquer desenho a gente chama ela
; so precisa setar esses valores pra imagem que a gente quiser colocar
; drawX e Y sao a posicao x e y na tela
drawX dw 0
drawY dw 0
; spriteW e H sao a largura e altura do desenho
spriteW dw 0
spriteH dw 0
; o desenho
currentSprite dw 0
start:
xor ax, ax
mov ds, ax
mov es, ax
call modoVideoCor
call telaMenu
jmp .espera
;ler ordem do usuário
.espera:
call lerChar
cmp al, '1'
je telaNome
cmp al, '2'
je telaInstrucoes
cmp al, '3'
je telaCreditos
jmp .espera
telaMenu:
;setando quantidade de vidas pra 5 e a cor default do tamagotchi
mov ah, 5
mov [qtVidas], ah
mov ah, 5
mov [qtHappy], ah
mov ah, 5
mov [qtGotas], ah
mov ah, 0
mov [cor], ah
;desenhar o tamagotchi
call drawTamagotchi
;como a gente limpa todos os registradores depois de draw, tem que setar tudo de novo
mov bl, 0xd ; aqui a cor da letra
call corLetra
;posicionar título
mov dl, 15
mov dh, 4
call andarEspaco
mov si, titulo
call printString
;posicionar jogar
mov dl, 15
mov dh, 15
call andarEspaco
mov si, jogar
call printString
;posicionar instruções
sub dl, 2
add dh, 2
call andarEspaco
mov si, instrucoes
call printString
;posicionar creditos
add dl, 1
add dh, 2
call andarEspaco
mov si, creditos
call printString
ret
telaNome:
call limparTela
call modoVideoCor
call drawTamagotchi
mov bl, 0xd ; aqui a cor da letra
call corLetra
; posicionar a texto de escolher nome
mov dl, 5
mov dh, 4
call andarEspaco
mov si, escolhaNome
call printString
; posicionar onde vai ler o nome
mov dh, 5
call pularLinha
mov dl, 5
call andarEspaco
call lerString
call telaCor
jmp telaJogo
telaCor:
call limparTela
call modoVideoCor
mov bl, 0xd ; aqui a cor da letra
call corLetra
mov dl, 3
mov dh, 4
call andarEspaco
mov si, escolhaCor
call printString
call drawTamagotchi
;como a gente limpa todos os registradores depois de draw, tem que setar tudo de novo
mov bl, 9 ; aqui a cor da letra azul
call corLetra
;posicionar azul
add dl, 15
add dh, 15
call andarEspaco
mov si, azul
call printString
mov bl, 13 ; aqui a cor da letra rosa
call corLetra
;posicionar rosa
add dh, 3
call andarEspaco
mov si, rosa
call printString
;fazer verde
mov bl, 10
call corLetra
sub dl, 1 ; posiciona a string e printa
add dh, 3
call andarEspaco
mov si, verde
call printString
; ler entrada e comparar
call lerChar
cmp al, '1'
je .azul
cmp al, '2'
je .rosa
cmp al, '3'
je .verde
;.verde:
mov ah, 8
mov [cor], ah
ret
.azul:
mov ah, 9
mov [cor], ah
ret
.rosa:
mov ah, 13
mov [cor], ah
ret
.verde:
mov ah, 2
mov [cor], ah
ret
telaJogo:
;desenhar a tela do jogo
call limparTela
call modoVideoCor
call drawTamagotchi
call drawVidas
call drawHappys
call drawGotas
mov bl, [cor] ; aqui a cor da letra
call corLetra
mov dl, 2
mov dh, 0
call andarEspaco
mov si, nome
call printString
mov si, alimenta
mov dl, 5
mov dh, 17
call andarEspaco
call printString
mov si, passea
mov dl, 5
mov dh, 19
call andarEspaco
call printString
mov si, dorme
mov dl, 24
mov dh, 17
call andarEspaco
call printString
mov si, banho
mov dl, 24
mov dh, 19
call andarEspaco
call printString
; setar timer
call timer
jmp loopJogo
mexeBicho:
mov ah, [timerFake] ; pra nao repetir a mesma coisa dentro do mesmo segundo
cmp dh, ah ; vou ver se eu já printei naquele segundo
je .continua
mov [timerFake], dh ; se n printei, agr eu vou salvar o tempo no timerFake e desenhar o bicho por cima do outro
call drawTamagotchi
.continua:
ret
loopJogo:
call verTempo
call mexeBicho
cmp dh, 3 ;dh é onde fica os segundos
jge .diminuirVidas
call verSeTemEntrada
jz loopJogo ;se for 0 (ou seja, não tem entrada), volta pro loop
call lerChar ;se não for 0, ele vê qual é o char
cmp al, 'q'
je .alimenta
cmp al, 'w'
je .passea
cmp al, 'e'
je .dorme
cmp al, 'r'
je .banho
jmp loopJogo
.alimenta:
call .aumentarVida
call .diminuirVida2
jmp telaAlimenta
.passea:
call .aumentarVida1
call .diminuirVida2
mov ax, 260 ;reseta a posicao da arvore pra printar certo dps
mov [arvoreX], ax
jmp telaPassea
.dorme:
call .aumentarVida1
call .diminuirVida
jmp telaDorme
.banho:
call .aumentarVida2
call .diminuirVida1
jmp telaBanho
.diminuirVidas:
call .diminuirVida
call .diminuirVida1
call .diminuirVida2
jmp telaJogo
.aumentarVida:
mov ah, [qtVidas]
add ah, 1
cmp ah, 6
je telaGameOver
mov [qtVidas], ah
ret
.aumentarVida1:
mov ah, [qtHappy]
add ah, 1
cmp ah, 6
je telaGameOver
mov [qtHappy], ah
ret
.aumentarVida2:
mov ah, [qtGotas]
add ah, 1
cmp ah, 6
je telaGameOver
mov [qtGotas], ah
ret
.diminuirVida:
mov ah, [qtVidas]
sub ah, 1
cmp ah, 0
je telaGameOver
mov [qtVidas], ah
ret
.diminuirVida1:
mov ah, [qtHappy]
sub ah, 1
cmp ah, 0
je telaGameOver
mov [qtHappy], ah
ret
.diminuirVida2:
mov ah, [qtGotas]
sub ah, 1
cmp ah, 0
je telaGameOver
mov [qtGotas], ah
ret
telaAlimenta:
call limparTela
call modoVideoCor
call drawTamagotchi
call drawMaca
call drawVidas
call drawHappys
call drawGotas
mov bl, [cor] ; aqui a cor da letra
call corLetra
mov dl, 2
mov dh, 0
call andarEspaco
mov si, nome
call printString
mov si, alimenta
mov dl, 5
mov dh, 17
call andarEspaco
call printString
mov si, passea
mov dl, 5
mov dh, 19
call andarEspaco
call printString
mov si, dorme
mov dl, 24
mov dh, 17
call andarEspaco
call printString
mov si, banho
mov dl, 24
mov dh, 19
call andarEspaco
call printString
call timer
jmp .espera
.espera:
mov ah, 02h ; escolhe a funcao de ler o tempo do sistema
int 1aH ; interrupcao que lida com o tempo do sistema
cmp dh, 2
je telaJogo
jmp .espera
telaPassea:
mov ah, 0 ;resetar o timer
mov [timerFake], ah
call limparTela
call modoVideoCor
call drawTamagotchi
call drawPassea
call drawVidas
call drawHappys
call drawGotas
mov bl, [cor] ; aqui a cor da letra
call corLetra
mov dl, 2
mov dh, 0
call andarEspaco
mov si, nome
call printString
mov si, alimenta
mov dl, 5
mov dh, 17
call andarEspaco
call printString
mov si, passea
mov dl, 5
mov dh, 19
call andarEspaco
call printString
mov si, dorme
mov dl, 24
mov dh, 17
call andarEspaco
call printString
mov si, banho
mov dl, 24
mov dh, 19
call andarEspaco
call printString
call timer
jmp .espera
.espera:
mov ah, 02h ; escolhe a funcao de ler o tempo do sistema
int 1aH ; interrupcao que lida com o tempo do sistema
mov ah, [timerFake] ; pra nao repetir a mesma coisa enquanto nao mudar de segundo
cmp dh, ah
je .ignora
mov [timerFake], dh
call erasePassea ; esse erase ele só pinta um quadrado preto do tamanho do desenho anterior pra nao ter q printar a tela inteira dnv
mov ax, [arvoreX]
sub ax, 45 ;vou mover pra esquerda, entao diminuo 45 da posicao X da arvore
mov [arvoreX], ax
call drawPassea
.ignora:
cmp dh, 5
je telaJogo
jmp .espera
telaDorme:
call limparTela
call modoVideoCor
call drawDormindo
call drawVidas
call drawHappys
call drawGotas
mov bl, [cor] ; aqui a cor da letra
call corLetra
mov dl, 2
mov dh, 0
call andarEspaco
mov si, nome
call printString
mov si, alimenta
mov dl, 5
mov dh, 17
call andarEspaco
call printString
mov si, passea
mov dl, 5
mov dh, 19
call andarEspaco
call printString
mov si, dorme
mov dl, 24
mov dh, 17
call andarEspaco
call printString
mov si, banho
mov dl, 24
mov dh, 19
call andarEspaco
call printString
call timer
jmp .espera
.espera:
mov ah, 02h ; escolhe a funcao de ler o tempo do sistema
int 1aH ; interrupcao que lida com o tempo do sistema
cmp dh, 2
je telaJogo
jmp .espera
telaBanho:
call limparTela
call modoVideoCor
call drawBanho
call drawVidas
call drawHappys
call drawGotas
mov bl, [cor] ; aqui a cor da letra
call corLetra
mov dl, 2
mov dh, 0
call andarEspaco
mov si, nome
call printString
mov si, alimenta
mov dl, 5
mov dh, 17
call andarEspaco
call printString
mov si, passea
mov dl, 5
mov dh, 19
call andarEspaco
call printString
mov si, dorme
mov dl, 24
mov dh, 17
call andarEspaco
call printString
mov si, banho
mov dl, 24
mov dh, 19
call andarEspaco
call printString
call timer
jmp .espera
.espera:
mov ah, 02h ; escolhe a funcao de ler o tempo do sistema
int 1aH ; interrupcao que lida com o tempo do sistema
cmp dh, 2
je telaJogo
jmp .espera
telaInstrucoes:
call limparTela
call modoVideoCor
call corLetra
mov si, instrucoes2
mov dl, 15
mov dh, 1
call andarEspaco
call printString
mov si, texto1
mov dl, 0
mov dh, 3
call andarEspaco
call printString
mov si, texto2
mov dl, 1
mov dh, 6
call andarEspaco
call printString
mov si, texto3
mov dl, 1
mov dh, 9
call andarEspaco
call printString
mov si, texto4
mov dl, 1
mov dh, 12
call andarEspaco
call printString
mov si, texto5
mov dl, 1
mov dh, 15
call andarEspaco
call printString
mov si, texto6
mov dl, 0
mov dh, 19
call andarEspaco
call printString
mov si, voltarMenu
mov dl, 4
mov dh, 23
call andarEspaco
call printString
mov ax, 0
.esperaEnter:
mov ah, 0
int 16h
cmp al, 13
jne esperaEnter
jmp start
telaCreditos:
call limparTela
call modoVideoCor
mov bl, 0xd ; aqui a cor da letra
call corLetra
mov si, creditos2
mov dl, 16
mov dh, 4
call andarEspaco
call printString
mov si, alice
mov dl, 10
mov dh, 13
call andarEspaco
call printString
mov si, aninha
mov dl, 11
mov dh, 15
call andarEspaco
call printString
mov si, day
mov dl, 11
mov dh, 17
call andarEspaco
call printString
mov si, vic
mov dl, 10
mov dh, 19
call andarEspaco
call printString
mov si, voltarMenu
mov dl, 4
mov dh, 22
call andarEspaco
call printString
call drawTamagotchi
esperaEnter:
mov ah, 0
int 16h
cmp al, 13
jne esperaEnter
jmp start
telaGameOver:
call limparTela
call modoVideoCor
mov bl, [cor] ; aqui a cor da letra
call corLetra
mov si, gameOver
;isso aqui eh pra posicionar a string, pode mudar
mov dl, 14
mov dh, 7
call andarEspaco
call printString
mov si, voltarMenu
mov dl, 4
mov dh, 18
call andarEspaco
call printString
call drawTamagotchiMorto
jmp .espera
.espera:
call lerChar
cmp al, 13
jne .espera
call limparTela
jmp start
drawAnything:
call clearRegistradores ; zero tudo porque vou usar muita coisa
push 0a000h
pop es ; isso aqui eh pra deixar o [es] no inicio da tela e eu vou usar esse es pra printar os pixels
mov ax, [drawY]
mov bx, 320 ; 320 eh a quantidade de pixels na linha
mul bx ; vai fazer ax * bx, resultado guardado em [dx][ax]
add ax, [drawX] ; agr adiciona quantos pixels da posicao x
mov di, ax ;o ax vai ser a posiçao do primeiro pixel que a gente vai printar, entao vamo salvar em di
xor cx,cx ;zero tudo menos o dx, porque vou usar o di
xor ax,ax
xor bx,bx
mov si, [currentSprite] ;si guarda/aponta o sprite que vamo desenhar
.printLinha:
lodsb ;vai pegar oq ta na si, que no caso eh o sprite
cmp al, 13
jne .pulaCor
mov al, [cor] ; cor branca pro pixel
.pulaCor:
mov [es:di], al ;es+deslocamento = primeiro pixel da tela + quantos pixels eu vou pular pra chegar no lugar q eu quero e al tem a cor que eu vou colocar. esse eh o print
inc di ; incremendo o di pra ser a proxima posicao do pixel que vai ser printado
inc cx ; incremento o contador de colunas
cmp cx, [spriteW] ; imprimiu a primeira linha do desenho?
jne .printLinha ; se nao terminou continua imprimindo
.proxLinha:
xor cx, cx ; zera o contador de colunas
sub di, [spriteW] ; subtrai as colunas pra voltar pro começo da linha
add di, 320 ; vai pra linha abaixo
inc bx ; incrementa quantas linhas printou
cmp bx, [spriteH] ; terminei de printar as linhas?