-
Notifications
You must be signed in to change notification settings - Fork 10
/
chipquarium.8o
1420 lines (1093 loc) · 31.6 KB
/
chipquarium.8o
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
# Chipquarium
# Copyright 2016 Matthew Mikolay
# For licensing info, please see accompanying LICENSE file.
# See github.com/mattmikolay/chip-8 or mattmik.com for more info.
:alias stat_poop vB # Tank dirtiness
:alias state_val1 v0 # State-dependent value (use varies with game_state)
:alias state_val2 v5 # State-dependent value (use varies with game_state)
:alias game_state v4 # Game state
:alias fish_level v6 # Fish level
:alias fish_dir v7 # Direction of the fishy
:alias fish_x v8 # x coordinate of the fishy
:alias fish_y v9 # y coordinate of the fishy
:alias scratch_1 v1 # Scratch register 1
:alias scratch_2 v2 # Scratch register 2
:alias event_timer v3
:alias hunger_stat va
:alias happy_stat vd
:alias stamina_stat vc
:alias health_stat ve
:const LEVEL_SMALL 0x00
:const LEVEL_MEDIUM 0x01
:const LEVEL_LARGE 0x02
:const LEVEL_VICTORY 0x03
:const DIRECTION_LEFT 0x00
:const DIRECTION_RIGHT 0x01
:const STATE_SWIMMING 0x00
:const STATE_FEEDING 0x01
:const STATE_SLEEPING 0x02
:const STATE_PLAYING 0x03
:const STATE_RPSEND 0x06
:const STATE_STATS 0x04
:const STATE_DEAD 0x05
:const MAX_HEALTH 255
:const MAX_HUNGER 100
:const MAX_STAMINA 0x64
:const MAX_HAPPINESS 100
:const GAME_ROCK 0x01
:const GAME_PAPER 0x02
:const GAME_SCISSORS 0x03
: main
# Display the title screen to the user
draw_title_screen
draw_ground
scratch_1 := key
draw_title_screen
# Default to the swimming state
game_state := STATE_SWIMMING
# Event timer will begin at zero and count up
event_timer := 0x00
# Set stat defaults
stat_poop := 0x00
health_stat := MAX_HEALTH
hunger_stat := 20
happy_stat := 0x40
stamina_stat := MAX_STAMINA
# At the start, the fish should point toward the right
fish_dir := DIRECTION_RIGHT
# Begin with a small fish!
fish_level := LEVEL_SMALL
: event_loop
# If fish health hits zero, the game is over
if health_stat == 0x00 then
end_game
# If fish is level 3, the user has won
if fish_level == LEVEL_VICTORY then
jump win_game
if game_state == STATE_SWIMMING begin
# Choose a random x offset in [1,4] for the fish
scratch_1 := random 0b00000011
# If fish is facing right, increase x coordinate
if fish_dir == DIRECTION_RIGHT begin
fish_x += scratch_1
fish_x += 1
# If fish is facing left, decrease x coordinate
else
fish_x -= scratch_1
fish_x += -1
end
# Choose a random y coordinate in [6,21] for the fish
fish_y := random 0x0F
fish_y += 6
# Draw the fish sprite at the newly calculated position
draw_fish
end
if game_state == STATE_SLEEPING begin
i := sprite_sleep_bubbles_2
sprite state_val1 state_val2 6
scratch_2 += -1
# If done sleeping...
if scratch_2 == 0x00 begin
# Erase sleeping bubbles
i := sprite_sleep_bubbles_1
sprite state_val1 state_val2 6
# Return to swimming state
game_state := STATE_SWIMMING
end
end
if game_state == STATE_RPSEND begin
# End the minigame
if state_val2 == 0x00 begin
# Clear screen and redraw ground, poop, and fish
clear
draw_ground
draw_poop
draw_fish
# Transition to swimming state
game_state := STATE_SWIMMING
end
# Decrease minigame timer
state_val2 += -1
end
if game_state == STATE_PLAYING begin
if state_val2 == 10 begin
i := sprite_thinking_dots_1
scratch_1 := 37
scratch_2 := 11
sprite scratch_1 scratch_2 1
end
if state_val2 == 8 begin
i := sprite_thinking_dots_2
scratch_1 := 37
scratch_2 := 11
sprite scratch_1 scratch_2 1
end
if state_val2 == 6 begin
i := sprite_thinking_dots_3
scratch_1 := 37
scratch_2 := 11
sprite scratch_1 scratch_2 1
end
# Decide the fish's move
if state_val2 == 4 begin
# Erase thinking dots
i := sprite_thinking_dots_all
scratch_1 := 37
scratch_2 := 11
sprite scratch_1 scratch_2 1
# scratch_1 will store fish's selection, a random number in [1,3]
scratch_1 := random 0x01
scratch_2 := random 0x01
scratch_1 += scratch_2
scratch_1 += 0x01
# Update fish stats based upon game outcome
if state_val1 == GAME_SCISSORS begin
if scratch_1 == GAME_PAPER then
happy_stat += 2
if scratch_1 == GAME_ROCK then
happy_stat += -1
end
if state_val1 == GAME_ROCK begin
if scratch_1 == GAME_PAPER then
happy_stat += -1
if scratch_1 == GAME_SCISSORS then
happy_stat += 2
end
if state_val1 == GAME_PAPER begin
if scratch_1 == GAME_SCISSORS then
happy_stat += -1
if scratch_1 == GAME_ROCK then
happy_stat += 2
end
# Confirm happiness is within bounds
if happy_stat == 255 then
happy_stat := 0x00
state_val1 := MAX_HAPPINESS
state_val1 -= happy_stat
if vf == 0x00 then
happy_stat := MAX_HAPPINESS
load_rps_sprite
# Temporarily use state_val1 to save fish's selection
state_val1 := scratch_1
# Draw fish's selection
scratch_1 := 36
scratch_2 := 8
sprite scratch_1 scratch_2 7
# If fish chose scissors, the scissors image consists of two sprites
if state_val1 == GAME_SCISSORS begin
scratch_1 := 44
i := sprite_scissors_2
sprite scratch_1 scratch_2 6
end
game_state := STATE_RPSEND
end
# Decrease minigame timer
state_val2 += -1
end
if game_state == STATE_FEEDING begin
# scratch_1 will store x offset of fish, moving in direction of food
# scratch_2 will store y offset of fish, moving in direction of food
scratch_1 := 0x00
scratch_2 := 0x00
# If fish is not at top of screen, move fish closer to food vertically
if fish_y != 0x06 then
scratch_2 := -1
# If fish's x coordinate does not equal the x coordinate of the food...
if fish_x != state_val1 begin
# Move fish closer to food horizontally
scratch_1 := fish_x
scratch_1 =- state_val1
scratch_1 := vf
if scratch_1 == 0 then
scratch_1 := -1
end
# Erase the fish sprite at its current location
draw_fish
fish_x += scratch_1
fish_y += scratch_2
# Update fish's direction based upon where it's moving
fish_dir := DIRECTION_LEFT
if scratch_1 == 0x01 then
fish_dir := DIRECTION_RIGHT
draw_fish
# If both x and y offset of the fish equal zero
scratch_1 |= scratch_2
if scratch_1 == 0x00 begin
# Erase food sprite and return to swimming state
i := sprite_food
sprite state_val1 state_val2 6
game_state := STATE_SWIMMING
end
end
scratch_1 := 30
delay := scratch_1
loop
check_key
scratch_1 := delay
while scratch_1 != 0x00
again
if game_state == STATE_SWIMMING begin
# Erase the fish sprite at its current location
draw_fish
update_direction
# Increment the event timer
event_timer += 0x01
check_event_timer
end
jump event_loop
: win_game
clear
draw_win_screen
: idle
jump idle
##########################################################################
# Checks the event timer and updates accordingly. The fish's stats and the
# tank's dirtiness are updated as time passes.
##########################################################################
: check_event_timer
# Level up if happiness stat is high enough and enough game time has passed
if event_timer == 0x00 begin
# If happy_stat > 72
scratch_1 := 72
scratch_1 -= happy_stat
if vf == 0x00 then
if fish_level != LEVEL_VICTORY then
fish_level += 0x01
end
# Decrease stamina
scratch_1 := 0x02
stamina_stat -= scratch_1
if vf == 0 then
stamina_stat := 0x00
# Increase hunger
if hunger_stat != MAX_HUNGER then
hunger_stat += 0x01
# Decrease health and happiness if fish is too hungry (hunger > 80)
scratch_1 := 80
scratch_1 =- hunger_stat
if vf == 0x01 begin
if health_stat != 0x00 then
health_stat += -1
if happy_stat != 0x00 then
happy_stat += -1
end
# Decrease health and happiness if tank is too dirty (more than five poops)
scratch_1 := 0b11111000
scratch_1 &= stat_poop
if scratch_1 == 0b11111000 begin
if health_stat != 0x00 then
health_stat += -1
if happy_stat != 0x00 then
happy_stat += -1
end
# Event: Add a poop to the bottom of the tank
if stat_poop != 0b11111111 begin
scratch_1 := 0b00001111
scratch_1 &= event_timer
if scratch_1 == 0b0001111 begin
draw_poop
stat_poop >>= stat_poop
stat_poop += 0b10000000
draw_poop
end
end
return
##############################################################
# Checks if a key has been pressed and handles it accordingly.
##############################################################
: check_key
if game_state == STATE_SWIMMING begin
# Play minigame if 'B' key is pressed
scratch_2 := 0x0B
if scratch_2 key begin
# The fish cannot play if stamina is zero
if stamina_stat == 0x00 then
return
draw_fish
# Move the fish to the right edge of the screen, facing left
fish_x := 48
fish_y := 16
fish_dir := DIRECTION_LEFT
draw_fish
draw_minigame_field
# state_val1 will store user's rock/paper/scissors selection
state_val1 := GAME_ROCK
draw_rps_selection
# state_val2 will store time until the fish decides
state_val2 := 14
# Transition to play state
game_state := STATE_PLAYING
end
# Clean tank if 'C' key is pressed
scratch_2 := 0x0C
if scratch_2 key begin
# Clean a single poop
draw_poop
stat_poop <<= stat_poop
draw_poop
return
end
# Sleep if 'D' key is pressed
scratch_2 := 0x0D
if scratch_2 key begin
# state_val1 will temporarily store bubbles x
state_val1 := fish_x
state_val1 += -1
# Shift bubbles to the right if the fish is facing right
if fish_dir == DIRECTION_RIGHT begin
state_val1 += 6
# Adjust bubble x based upon fish width
if fish_level == LEVEL_MEDIUM then
state_val1 += 4
if fish_level == LEVEL_LARGE then
state_val1 += 10
end
# state_val2 will temporarily store bubbles y
state_val2 := fish_y
state_val2 += -6
# Draw sleep bubbles above the fish
i := sprite_sleep_bubbles_1
sprite state_val1 state_val2 6
# Transition to sleeping state and reset stamina
game_state := STATE_SLEEPING
stamina_stat := MAX_STAMINA
# Use scratch_2 to keep track of how long to stay sleeping
scratch_2 := 0x0A
return
end
# Show stats if 'E' key is pressed
scratch_2 := 0x0E
if scratch_2 key begin
# Transition to stats display state
game_state := STATE_STATS
clear
draw_stats_text
return
end
# Feed fish if 'F' key is pressed
scratch_2 := 0x0F
if scratch_2 key begin
# The fish cannot be fed if stamina is zero
if stamina_stat == 0x00 then
return
# Choose random x location in [16, 47] for fish food
# state_val1 and state_val2 will temporarily store food x and y
state_val1 := random 0b11111
state_val1 += 16
state_val2 := 0x00
i := sprite_food
sprite state_val1 state_val2 6
# Transition to feeding state and reset hunger
game_state := STATE_FEEDING
hunger_stat := 0x00
return
end
end
if game_state == STATE_STATS begin
# Wait for any key press to leave the stats screen
scratch_1 := key
# Clear screen and redraw ground, poop, and fish
clear
draw_ground
draw_poop
draw_fish
# Transition to swimming state
game_state := STATE_SWIMMING
end
if game_state == STATE_PLAYING begin
# Navigate up among possible rock/paper/scissors options
scratch_2 := 0x02
if scratch_2 key begin
draw_rps_selection
state_val1 += 1
if state_val1 == 0x04 then
state_val1 := GAME_ROCK
draw_rps_selection
end
# Navigate down among possible rock/paper/scissors options
scratch_2 := 0x08
if scratch_2 key begin
draw_rps_selection
state_val1 += -1
if state_val1 == 0x00 then
state_val1 := GAME_SCISSORS
draw_rps_selection
end
end
return
##########################################################################
# Updates the fish's direction, if the fish has hit one of the boundaries.
##########################################################################
: update_direction
# Check for fish at right edge of screen
scratch_1 := fish_x
scratch_1 += 16
scratch_2 := 0b11000000
scratch_1 &= scratch_2
if scratch_1 != 0x00 then
fish_dir := DIRECTION_LEFT
# Check for fish at left edge of screen
scratch_1 := fish_x
scratch_2 := 0b11111000
scratch_1 &= scratch_2
if scratch_1 == 0x00 then
fish_dir := DIRECTION_RIGHT
return
###########################################################################
# Ends the game, preventing further user interaction. Rest in peace, fishy.
###########################################################################
: end_game
# If the fish has already gone to fishy heaven, there's nothing to do
if game_state == STATE_DEAD then
return
game_state := STATE_DEAD
# Draw an upside-down fish at the top of the tank
fish_y := 0x00
fish_dir := DIRECTION_RIGHT
draw_flipped_fish
# Draw a RIP message
i := sprite_rip_1
scratch_1 := 52
scratch_2 := 23
sprite scratch_1 scratch_2 5
i := sprite_rip_2
scratch_1 := 60
sprite scratch_1 scratch_2 5
return
#############################################################################
# Draws the rock/paper/scissors minigame field. The field consists of a box
# indicating the user's selection; up and down arrows; and the fish's thought
# bubble.
#############################################################################
: draw_minigame_field
scratch_1 := 8
scratch_2 := 10
# Draw left half of box indicating user's selection
i := sprite_box_left
sprite scratch_1 scratch_2 11
# Draw right half of box indicating user's selection
scratch_1 := 16
i := sprite_box_right
sprite scratch_1 scratch_2 11
# Draw up arrow
scratch_1 := 12
scratch_2 := 6
i := sprite_up_arrow
sprite scratch_1 scratch_2 3
# Draw down arrow
scratch_2 := 22
i := sprite_down_arrow
sprite scratch_1 scratch_2 3
# Draw left half of the fish's thought bubble
scratch_1 := 34
scratch_2 := 6
i := sprite_bubble_left
sprite scratch_1 scratch_2 11
# Draw right half of the fish's thought bubble
scratch_1 := 42
i := sprite_bubble_right
sprite scratch_1 scratch_2 12
return
##############################################################################
# Draws the sprite corresponding to the user's selection at this moment in the
# rock/paper/scissors minigame.
##############################################################################
: draw_rps_selection
scratch_1 := state_val1
load_rps_sprite
scratch_1 := 10
scratch_2 := 12
sprite scratch_1 scratch_2 7
# The scissors image consists of two sprites
if state_val1 == GAME_SCISSORS begin
scratch_1 := 18
i := sprite_scissors_2
sprite scratch_1 scratch_2 6
end
return
###############################################################################
# Loads the i register with the sprite corresponding to the user's selection at
# this moment in the rock/paper/scissors minigame.
###############################################################################
: load_rps_sprite
i := sprite_rock
if scratch_1 == GAME_SCISSORS then
i := sprite_scissors_1
if scratch_1 == GAME_PAPER then
i := sprite_paper
return
#########################
# Draws the title screen.
#########################
: draw_title_screen
scratch_1 := 0
scratch_2 := 4
state_val1 := 4
i := title_screen_data
loop
sprite scratch_1 scratch_2 4
scratch_1 += 8
if scratch_1 == 64 begin
scratch_1 := 0
scratch_2 += 4
end
i += state_val1
if scratch_2 != 28 then
again
return
###########################
# Draws the victory screen.
###########################
: draw_win_screen
scratch_1 := 0
scratch_2 := 0
state_val1 := 8
i := win_screen_data
loop
sprite scratch_1 scratch_2 8
scratch_1 += 8
if scratch_1 == 64 begin
scratch_1 := 0
scratch_2 += 8
end
i += state_val1
if scratch_2 != 32 then
again
return
####################################
# Draws the bottom of the fish tank.
####################################
: draw_ground
i := sprite_ground
scratch_2 := 31
scratch_1 := 0
loop
sprite scratch_1 scratch_2 1
scratch_1 += 8
if scratch_1 != 64 then
again
return
############################################################
# Draws a row of fish droppings at the bottom of the screen.
############################################################
: draw_poop
i := sprite_poop
# x coordinate of poop sprite
state_val1 := 0
# y coordinate of poop sprite
state_val2 := 29
scratch_1 := stat_poop
loop
scratch_1 <<= scratch_1
if vF != 0x00 then
sprite state_val1 state_val2 2
state_val1 += 8
if scratch_1 != 0x00 then
again
return
########################################################
# Draws the fish sprite on the screen at fish_x, fish_y.
# The fish's size will depend upon its level.
########################################################
: draw_fish
if fish_level == LEVEL_SMALL then
draw_small_fish
if fish_level == LEVEL_MEDIUM then
draw_medium_fish
if fish_level == LEVEL_LARGE then
draw_large_fish
return
###################################################################
# Draws an upside-down fish sprite on the screen at fish_x, fish_y.
# The fish's size will depend upon its level.
###################################################################
: draw_flipped_fish
if fish_level == LEVEL_SMALL then
draw_small_fish
if fish_level == LEVEL_MEDIUM then
draw_medium_flipped_fish
if fish_level == LEVEL_LARGE then
draw_large_flipped_fish
return
#######################################################
# Draws text describing the fish's stats on the screen.
#######################################################
: draw_stats_text
scratch_2 := 4
i := sprite_hunger_text_1
sprite scratch_2 scratch_2 5
scratch_1 := 12
i := sprite_hunger_text_2
sprite scratch_1 scratch_2 5
scratch_1 := 20
i := sprite_hunger_text_3
sprite scratch_1 scratch_2 5
scratch_2 := 13
scratch_1 := 4
i := sprite_happy_text_1
sprite scratch_1 scratch_2 5
scratch_1 := 12
i := sprite_happy_text_2
sprite scratch_1 scratch_2 5
scratch_1 := 20
i := sprite_happy_text_3
sprite scratch_1 scratch_2 5
scratch_2 := 22
scratch_1 := 4
i := sprite_stamina_text_1
sprite scratch_1 scratch_2 5
scratch_1 := 12
i := sprite_stamina_text_2
sprite scratch_1 scratch_2 5
scratch_1 := 20
i := sprite_stamina_text_3
sprite scratch_1 scratch_2 5
scratch_1 := 28
i := sprite_stamina_text_4
sprite scratch_1 scratch_2 5
# Store BCD of hunger stat
i := bcd_address_1
scratch_1 := hunger_stat
bcd scratch_1
i := bcd_address_1
load v0
i := hex v0
scratch_1 := 46
scratch_2 := 4
sprite scratch_1 scratch_2 5
i := bcd_address_2
load v0
i := hex v0
scratch_1 := 51
sprite scratch_1 scratch_2 5
i := bcd_address_3
load v0
i := hex v0
scratch_1 := 56
sprite scratch_1 scratch_2 5
# Store BCD of happy stat
i := bcd_address_1
scratch_1 := happy_stat
bcd scratch_1
i := bcd_address_1
load v0
i := hex v0
scratch_1 := 46
scratch_2 := 13
sprite scratch_1 scratch_2 5
i := bcd_address_2
load v0
i := hex v0
scratch_1 := 51
sprite scratch_1 scratch_2 5
i := bcd_address_3
load v0
i := hex v0
scratch_1 := 56
sprite scratch_1 scratch_2 5
# Store BCD of stamina stat
i := bcd_address_1
scratch_1 := stamina_stat
bcd scratch_1
i := bcd_address_1
load v0
i := hex v0
scratch_1 := 46
scratch_2 := 22
sprite scratch_1 scratch_2 5
i := bcd_address_2
load v0
i := hex v0
scratch_1 := 51
sprite scratch_1 scratch_2 5
i := bcd_address_3
load v0
i := hex v0
scratch_1 := 56
sprite scratch_1 scratch_2 5
return
########################################################
# Draws a small fish sprite on screen at fish_x, fish_y.
########################################################
: draw_small_fish
i := sprite_small_fish_left
if fish_dir == DIRECTION_RIGHT then
i := sprite_small_fish_right
sprite fish_x fish_y 3
return
#########################################################
# Draws a medium fish sprite on screen at fish_x, fish_y.
#########################################################
: draw_medium_fish
i := sprite_medium_fish_left
if fish_dir == DIRECTION_RIGHT then
i := sprite_medium_fish_right
sprite fish_x fish_y 4
return
#####################################################################
# Draws a medium upside-down fish sprite on screen at fish_x, fish_y.
#####################################################################