-
Notifications
You must be signed in to change notification settings - Fork 0
/
river-raid.ctl
1733 lines (1733 loc) · 59.7 KB
/
river-raid.ctl
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
> $4000 @start
> $4000
> $4000 COLOR_INHERIT EQU $00
> $4000 COLOR_BLACK EQU $00
> $4000 COLOR_BLUE EQU $01
> $4000 COLOR_RED EQU $02
> $4000 COLOR_MAGENTA EQU $03
> $4000 COLOR_GREEN EQU $04
> $4000 COLOR_CYAN EQU $05
> $4000 COLOR_YELLOW EQU $06
> $4000 COLOR_WHITE EQU $07
> $4000
> $4000 INPUT_INTERFACE_KEYBOARD EQU $00
> $4000 INPUT_INTERFACE_SINCLAIR EQU $01
> $4000 INPUT_INTERFACE_KEMPSTON EQU $02
> $4000 INPUT_INTERFACE_CURSOR EQU $03
> $4000
> $4000 DEMO_MODE_OFF EQU $00
> $4000 DEMO_MODE_ON EQU $01
> $4000
> $4000 GAME_MODE_BIT_TWO_PLAYERS EQU 0
> $4000
> $4000 PLAYER_1 EQU $01
> $4000 PLAYER_2 EQU $02
> $4000
> $4000 SPEED_STOP EQU $01
> $4000 SPEED_SLOW EQU $01
> $4000 SPEED_NORMAL EQU $02
> $4000 SPEED_FAST EQU $04
> $4000
> $4000 CONTROLS_BIT_FIRE EQU 0
> $4000 CONTROLS_BIT_SPEED_DECREASED EQU 1
> $4000 CONTROLS_BIT_SPEED_ALTERED EQU 2
> $4000 CONTROLS_BIT_LOW_FUEL EQU 3
> $4000 CONTROLS_BIT_BONUS_LIFE EQU 4
> $4000 CONTROLS_BIT_EXPLODING EQU 5
> $4000
> $4000 TANK_SHELL_STATE_UNITIALIZED EQU $00
> $4000 TANK_SHELL_MASK_SPEED EQU $07
> $4000 TANK_SHELL_BIT_EXPLODING EQU 5
> $4000 TANK_SHELL_BIT_FLYING EQU 7
> $4000 TANK_SHELL_TRAJECTORY_MAX_STEP EQU $08
> $4000
> $4000 HELICOPTER_MISSILE_STEP EQU $08
> $4000
> $4000 HELICOPTER_ANIMATION_METRONOME_MASK EQU $01
> $4000 HELICOPTER_ANIMATION_METRONOME_VALUE EQU $00
> $4000
> $4000 BALLOON_ANIMATION_METRONOME_MASK EQU $01
> $4000 BALLOON_ANIMATION_METRONOME_VALUE EQU $01
> $4000
> $4000 FIGHTER_POSITION_LEFT_INIT EQU $E8
> $4000 FIGHTER_POSITION_LEFT_LIMIT EQU $00
> $4000 FIGHTER_POSITION_RIGHT_INIT EQU $04
> $4000 FIGHTER_POSITION_RIGHT_LIMIT EQU $E8
> $4000
> $4000 POINTS_SHIP EQU $03
> $4000 POINTS_HELICOPTER_REG EQU $06
> $4000 POINTS_BALLOON EQU $06
> $4000 POINTS_FUEL EQU $08
> $4000 POINTS_FIGHTER EQU $10
> $4000 POINTS_HELICOPTER_ADV EQU $15
> $4000 POINTS_TANK EQU $25
> $4000 POINTS_BRIDGE EQU $50
> $4000
> $4000 OBJECT_HELICOPTER_REG EQU $01
> $4000 OBJECT_SHIP EQU $02
> $4000 OBJECT_HELICOPTER_ADV EQU $03
> $4000 OBJECT_TANK EQU $04
> $4000 OBJECT_FIGHTER EQU $05
> $4000 OBJECT_BALLOON EQU $06
> $4000 OBJECT_FUEL EQU $07
> $4000
> $4000 SLOT_BIT_ROCK EQU $03
> $4000 SLOT_BIT_TANK_ON_BANK EQU $05
> $4000 SLOT_BIT_ORIENTATION EQU $06
> $4000 SLOT_MASK_OBJECT_TYPE EQU $07
> $4000
> $4000 SIZE_LEVEL_SLOTS EQU $0100
> $4000
> $4000 SET_MARKER_EMPTY_SLOT EQU $00
> $4000 SET_MARKER_END_OF_SET EQU $FF
> $4000
> $4000 SPRITE_PLANE_WIDTH_TILES EQU $02
> $4000 SPRITE_PLANE_HEIGHT_PIXELS EQU $08
> $4000 SPRITE_PLANE_FRAME_SIZE EQU SPRITE_PLANE_WIDTH_TILES * SPRITE_PLANE_HEIGHT_PIXELS
> $4000 SPRITE_PLANE_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_YELLOW
> $4000
> $4000 SPRITE_3BY1_ENEMY_WIDTH_TILES EQU $03
> $4000 SPRITE_3BY1_ENEMY_HEIGHT_PIXELS EQU $08
> $4000 SPRITE_3BY1_ENEMY_FRAME_SIZE EQU SPRITE_3BY1_ENEMY_WIDTH_TILES * SPRITE_3BY1_ENEMY_HEIGHT_PIXELS
> $4000 SPRITE_3BY1_ENEMY_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_YELLOW
> $4000
> $4000 SPRITE_SHIP_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_CYAN
> $4000 SPRITE_TANK_ATTRIBUTES EQU COLOR_INHERIT
> $4000 SPRITE_TANK_ON_BANK_ATTRIBUTES EQU COLOR_GREEN
> $4000 SPRITE_FIGHTER_ATTRIBUTES EQU COLOR_INHERIT
> $4000
> $4000 SPRITE_ROTOR_WIDTH_TILES EQU $02
> $4000 SPRITE_ROTOR_HEIGHT_PIXELS EQU $02
> $4000 SPRITE_ROTOR_FRAME_SIZE EQU SPRITE_ROTOR_WIDTH_TILES * SPRITE_ROTOR_HEIGHT_PIXELS
> $4000 SPRITE_ROTOR_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_YELLOW
> $4000
> $4000 SPRITE_BALLOON_WIDTH_TILES EQU $02
> $4000 SPRITE_BALLOON_HEIGHT_PIXELS EQU $10
> $4000 SPRITE_BALLOON_FRAME_SIZE EQU SPRITE_BALLOON_WIDTH_TILES * SPRITE_BALLOON_HEIGHT_PIXELS
> $4000 SPRITE_BALLOON_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_YELLOW
> $4000
> $4000 ; There is only one frame, so it's size is irrelevant.
> $4000 SPRITE_FUEL_STATION_WIDTH_TILES EQU $02
> $4000 SPRITE_FUEL_STATION_HEIGHT_PIXELS EQU $19
> $4000 SPRITE_FUEL_STATION_FRAME_SIZE EQU $0000
> $4000 SPRITE_FUEL_STATION_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_MAGENTA
> $4000
> $4000 SPRITE_ROCK_WIDTH_TILES EQU $03
> $4000 SPRITE_ROCK_HEIGHT_PIXELS EQU $10
> $4000 SPRITE_ROCK_FRAME_SIZE EQU SPRITE_ROCK_WIDTH_TILES * SPRITE_ROCK_HEIGHT_PIXELS
> $4000 SPRITE_ROCK_ATTRIBUTES EQU COLOR_RED<<3|COLOR_GREEN
> $4000
> $4000 SPRITE_MISSILE_WIDTH_TILES EQU $01
> $4000 SPRITE_MISSILE_HEIGHT_PIXELS EQU $08
> $4000 SPRITE_MISSILE_FRAME_SIZE_BYTES EQU SPRITE_MISSILE_WIDTH_TILES * SPRITE_MISSILE_HEIGHT_PIXELS
> $4000 SPRITE_MISSILE_ATTRIBUTES EQU COLOR_BLUE<<3|COLOR_GREEN
> $4000
> $4000 SPRITE_HELICOPTER_MISSILE_WIDTH_TILES EQU $01
> $4000 SPRITE_HELICOPTER_MISSILE_ATTRIBUTES EQU COLOR_INHERIT
> $4000
> $4000 ; Shell sprite is a truncated missile sprite, so the frame size should be calculated
> $4000 ; based on the original height.
> $4000 SPRITE_SHELL_WIDTH_TILES EQU $01
> $4000 SPRITE_SHELL_HEIGHT_PIXELS EQU $01
> $4000 SPRITE_SHELL_FRAME_SIZE_BYTES EQU SPRITE_SHELL_WIDTH_TILES * SPRITE_MISSILE_HEIGHT_PIXELS
> $4000 SPRITE_SHELL_ATTRIBUTES EQU $00
> $4000
> $4000 SPRITE_SHELL_EXPLOSION_WIDTH_TILES EQU $02
> $4000 SPRITE_SHELL_EXPLOSION_HEIGHT_PIXELS EQU $10
> $4000 SPRITE_SHELL_EXPLOSION_FRAME_SIZE_BYTES EQU $0000
> $4000 SPRITE_SHELL_EXPLOSION_ATTRIBUTES EQU $0C
> $4000
> $4000 PLANE_COORDINATE_Y EQU $80
> $4000
> $4000 FUEL_CHECK_INTERVAL EQU $03
> $4000 FUEL_INTAKE_AMOUNT EQU $04
> $4000 FUEL_LEVEL_EMPTY EQU $00
> $4000 FUEL_LEVEL_LOW EQU $C0
> $4000 FUEL_LEVEL_ALMOST_FULL EQU $FC
> $4000 FUEL_LEVEL_FULL EQU $FF
> $4000
> $4000 METRONOME_INTERVAL_CONSUME_FUEL EQU $01
> $4000 METRONOME_INTERVAL_ANIMATE_FUEL EQU $04
> $4000 METRONOME_INTERVAL_1 EQU $01
> $4000
> $4000 INTERACTION_MODE_00 EQU $00
> $4000 INTERACTION_MODE_01 EQU $01
> $4000 INTERACTION_MODE_02 EQU $02
> $4000 INTERACTION_MODE_FUEL EQU $06
> $4000
> $4000 OTHER_MODE_00 EQU $00
> $4000 OTHER_MODE_FUEL EQU $01
> $4000 OTHER_MODE_HIT EQU $02
> $4000 OTHER_MODE_XOR EQU $03
> $4000 OTHER_MODE_HELICOPTER_ADV EQU $04
> $4000
> $4000 TODO_L5EF2_00 EQU $00
> $4000 TODO_L5EF2_01 EQU $01
> $4000
> $4000 VIEWPORT_HEIGHT EQU $88
> $4000
> $4000 ; STRUCTURES
> $4000 ; ----------
> $4000 ;
> $4000 ; OBJECT_DEFINITION ::
> $4000 ;
> $4000 ; Bits 0..2 represent an interactive object type.
> $4000 ; OBJECT_DEFINITION_MASK_INTERACTIVE_TYPE = $07,
> $4000 ;
> $4000 ; Bits 0..1 represent a rock type type.
> $4000 ; OBJECT_DEFINITION_MASK_ROCK_TYPE = $03,
> $4000 ;
> $4000 ; Bit 3 defines whether the slot contains an interactive object (reset)
> $4000 ; or a rock (set).
> $4000 ; OBJECT_DEFINITION_BIT_ROCK = 3,
> $4000 ;
> $4000 ; Bit 4 is unused.
> $4000 ;
> $4000 ; Bit 5 defines a tank location: bridge (unset) or river bank (set).
> $4000 ; OBJECT_DEFINITION_BIT_TANK_LOCATION = 5,
> $4000 ;
> $4000 ; Bit 6 defines object orientation: left (unset) or right (set).
> $4000 ; OBJECT_DEFINITION_BIT_TANK_ORIENTATION = 6,
> $4000 ;
> $4000 ; Bit 7 is unused.
@ $4000 org
@ $4000 equ=KEYBOARD=$02BF
@ $4000 equ=BEEPER=$03B5
@ $4000 equ=CHAN_OPEN=$1601
@ $4000 equ=OUT_NUM_1=$1A1B
@ $4000 equ=PR_STRING=$203C
@ $4000 equ=LAST_K=$5C08
@ $4000 equ=UDG=$5C7B
@ $4000 label=screen_pixels
b $4000 Screen pixels.
b $4000 Screen pixels.
D $4000 #UDGTABLE { #SCR(loading) } TABLE#
@ $5800 label=screen_attributes
b $5800 Screen attributes.
b $5B00
@ $5C78 label=int_counter
g $5C78 Interrupt counter
u $5C79
@ $5CD2 label=start
c $5CD2 The entry point invoked from the BASIC loader
@ $5CD8 nowarn
@ $5CE3 nowarn
c $5D10
@ $5D20 isub=CP DEMO_MODE_ON
c $5D2B
@ $5D35 label=restart
c $5D35 Restart the game
@ $5D3F label=starting_bridges
b $5D3F Array of possible starting bridge values.
R $5D3F Index of list element is specified by the second and third bits of the #R$923A.
R $5D3F The values correspond to the dialog rendered as #R$792A.
@ $5D43 label=L5D43
g $5D43
@ $5D44 label=init_state
c $5D44
$5D44,5 Initialize #R$5F72. Why isn't it $80?
@ $5D52 isub=LD (HL),SET_MARKER_END_OF_SET
@ $5D9F label=decrease_lives_player_2
c $5D9F Decrease player 2 lives
@ $5DA6 label=play
c $5DA6
C $5DB4,2 PAPER 1; INK 4
@ $5DBF isub=LD BC,status_line_2 - status_line_1
@ $5DD0 isub=LD BC,status_line_3 - status_line_2
@ $5DF1 isub=LD A,FUEL_LEVEL_FULL
@ $5E0B isub=LD (HL),SET_MARKER_END_OF_SET
@ $5E32 isub=LD BC,state_score_player_2 - state_score_player_1
@ $5E40 isub=LD BC,L805F - status_line_4
@ $5E76 isub=LD A,SPEED_FAST
@ $5E98 isub=LD A,SPEED_FAST
@ $5EB3 isub=CP PLAYER_2
@ $5ECD isub=CP INPUT_INTERFACE_KEMPSTON
@ $5EEE label=L5EEE
g $5EEE
@ $5EEF label=state_metronome
g $5EEF
@ $5EF0 label=state_bridge_index
g $5EF0 Current player's current bridge modulo 48 (the total number of bridges).
@ $5EF1 label=state_input_readings
g $5EF1 Contains the current readings of the input port (Sinclair, Kempston, Cursor, etc.).
@ $5EF2 label=L5EF2
g $5EF2
@ $5EF3 label=state_plane_missile_coordinates
g $5EF3
@ $5EF4 label=state_plane_missile_x
g $5EF4
@ $5EF5 label=state_other_mode
g $5EF5
@ $5EF6 label=L5EF6
g $5EF6
@ $5EF7 label=L5EF7
g $5EF7
W $5EF7
@ $5EF9 label=L5EF9
g $5EF9
@ $5EFA label=state_island_profile_idx
g $5EFA The value sourced from the first byte of an island definition in #R$C600 and used as a #R$8063 array index.
@ $5EFB label=state_island_byte_2
g $5EFB
@ $5EFC label=state_island_byte_3
g $5EFC
@ $5EFD label=state_island_line_idx
g $5EFD
u $5EFE
@ $5F00 label=viewport_objects
B $5F00,46,3
g $5F00
@ $5F2E label=exploding_fragments
B $5F2E,49,3
g $5F2E
@ $5F5F label=L5F5F
g $5F5F
@ $5F60 label=viewport_ptr
g $5F60 Pointer to a slot from #R$5F00
W $5F60
@ $5F62 label=exploding_fragments_ptr
g $5F62 Pointer to a slot from #R$5F2E
W $5F62
@ $5F64 label=state_speed
g $5F64 Current speed
@ $5F65 label=L5F65
g $5F65
@ $5F66 label=state_fuel
g $5F66 Fuel level
@ $5F67 label=state_input_interface
g $5F67 Control type ($00 - Keyboard, $01 - Sinclair, $02 - Kempston, Other - Cursor)
@ $5F68 label=state_interaction_mode_5F68
g $5F68
@ $5F69 label=L5F69
g $5F69
@ $5F6A label=state_bridge_player_1
g $5F6A Current bridge of player 1
@ $5F6B label=state_bridge_player_2
g $5F6B Current bridge of player 2
@ $5F6C label=L5F6C
g $5F6C
@ $5F6D label=L5F6D
g $5F6D
g $5F6E
g $5F6F
@ $5F70 label=state_y
g $5F70 Current Y coordinate
@ $5F72 label=state_x
g $5F72 Current X coordinate
@ $5F73 label=helicopter_missile_coordinates_ptr
g $5F73 Pointer to the helicopter missile coordinates.
@ $5F75 label=helicopter_missile_state
g $5F75 Helicopter missile state.
@ $5F76 label=state_level_fragment_number
g $5F76 Index of the current element of current level terrain array
@ $5F77 label=state_terrain_profile_number
b $5F77 The first byte of the current #R$9500 element, defines the index of the terrain sprite (see #R$8063).
@ $5F78 label=state_terrain_element_23
g $5F78
@ $5F7A label=state_terrain_extras
g $5F7A
@ $5F7B label=screen_ptr
g $5F7B
W $5F7B
@ $5F7D label=state_terrain_position
g $5F7D Inner array index in the terrain definition.
@ $5F7E label=ptr_scroller
g $5F7E Pointer to the text to be displayed in the scroller.
W $5F7E
u $5F80
@ $5F81 label=L5F81
g $5F81
u $5F82
@ $5F83 label=sp_5F83
g $5F83
W $5F83
@ $5F85 label=tmp_HL
g $5F85
W $5F85
@ $5F87 label=tmp_DE
g $5F87
W $5F87
@ $5F89 label=tmp_BC
g $5F89
W $5F89
@ $5F8B label=L5F8B
g $5F8B
W $5F8B
@ $5F8D label=L5F8D
g $5F8D
W $5F8D
@ $5F8F label=state_plane_missile_coordinates_backup
g $5F8F
W $5F8F
@ $5F91 label=main_loop
c $5F91 Main loop
C $5F91,9 Scan Enter
@ $5FCB isub=CP INPUT_INTERFACE_KEMPSTON
@ $5FD0 isub=CP INPUT_INTERFACE_SINCLAIR
@ $5FD5 isub=CP INPUT_INTERFACE_KEYBOARD
@ $5FDA label=scan_cursor
@ $600A label=scan_kempston
c $600A
@ $6039 label=scan_sinclair
c $6039
@ $6068 label=scan_keyboard
c $6068
C $6068 Scan "O" (LEFT)
C $6071 Scan "P" (RIGHT)
C $607A Scan "2" (UP)
C $6083 Scan "W" (DOWN)
C $608C Scan lower row right (FIRE)
C $6097 Scan lower row left (FIRE)
c $60A5
@ $60A8 isub=CP INTERACTION_MODE_00
@ $60AD isub=LD A,OTHER_MODE_00
c $6124
@ $6136 label=L6136
c $6136
@ $6145 isub=CP OTHER_MODE_00
@ $614A isub=CP OTHER_MODE_FUEL
@ $614F isub=CP OTHER_MODE_HIT
@ $6154 isub=CP OTHER_MODE_XOR
@ $6159 isub=CP OTHER_MODE_HELICOPTER_ADV
@ $615E label=handle_other_mode_xor
c $615E
@ $61A3 isub=LD (HL),SET_MARKER_EMPTY_SLOT
@ $61B3 isub=LD A,POINTS_FIGHTER
@ $61BB label=interact_with_something
c $61BB
@ $61D3 isub=LD A,POINTS_BRIDGE
@ $621F keep
@ $623A isub=CP PLAYER_2
@ $623F label=next_bridge_player_1
@ $6249 label=next_bridge_player_2
c $6249
u $6253
@ $6256 label=fuel
@ $6256 isub=LD A,INTERACTION_MODE_FUEL
c $6256
@ $6268 label=hit_terrain
c $6268 Fighter hits terrain
@ $6274 isub=CP SET_MARKER_EMPTY_SLOT
@ $6279 isub=CP SET_MARKER_END_OF_SET
c $62CE
c $62D4
c $62D7
@ $62DA label=advance_object
c $62DA Increase vertical coordinate of the object by the value of #R$5F64.
R $62DA I:B Current coordinate
R $62DA O:B New coordinate
@ $62E0 label=retract_object
c $62E0 Decrease vertical coordinate of the object by the value of #R$5F64.
R $62E0 I:B Current coordinate
R $62E0 O:B New coordinate
@ $62E8 label=interact_with_something2
c $62E8 Interact with something
@ $62F4 isub=CP SET_MARKER_EMPTY_SLOT
@ $62F9 isub=CP SET_MARKER_END_OF_SET
@ $6301 isub=CP INTERACTION_MODE_FUEL
@ $6324 isub=AND SLOT_MASK_OBJECT_TYPE
@ $6326 isub=CP OBJECT_BALLOON
@ $632B isub=CP OBJECT_FUEL
@ $6361 isub=AND SLOT_MASK_OBJECT_TYPE
@ $6363 isub=CP OBJECT_SHIP
@ $6380 isub=CP INTERACTION_MODE_FUEL
@ $639B isub=CP OBJECT_HELICOPTER_REG
@ $63A0 isub=CP OBJECT_SHIP
@ $63A5 isub=CP OBJECT_HELICOPTER_ADV
@ $63AA isub=CP OBJECT_FIGHTER
@ $63AF isub=CP OBJECT_BALLOON
@ $63B4 isub=CP OBJECT_FUEL
@ $63FC isub=LD A,INTERACTION_MODE_00
c $63FC
@ $6401 isub=LD A,OTHER_MODE_00
@ $6414 label=hit_helicopter_reg
@ $6414 isub=LD A,POINTS_HELICOPTER_REG
c $6414
@ $6423 label=hit_ship
@ $6423 isub=LD A,POINTS_SHIP
c $6423
@ $6444 label=hit_helicopter_adv
@ $6444 isub=LD A,POINTS_HELICOPTER_ADV
c $6444 Hit advanced helicopter
@ $6453 label=hit_fighter
@ $6453 isub=LD A,POINTS_FIGHTER
c $6453 Hit fighter
@ $6462 label=hit_balloon
@ $6462 isub=LD A,POINTS_BALLOON
c $6462
@ $6478 label=interact_with_fuel
c $6478
@ $647B isub=CP INTERACTION_MODE_FUEL
@ $6480 isub=LD A,POINTS_FUEL
c $649E
c $64A1
u $64B4
@ $64BC label=print_bridge
c $64BC
@ $64BF isub=CP PLAYER_2
@ $64CD isub=LD BC,status_line_4 - status_line_3
@ $64E5 label=print_bridge_player_2
c $64E5 Print current bridge for player 2
@ $64EE isub=LD BC,status_line_4 - status_line_3
@ $64F1 label=print_bridge_no_player_2
c $64F1 Print current bridge number for player 2
@ $6506 label=print_space
c $6506 Print space
@ $650A label=handle_no_fuel
c $650A Handle the no fuel situation
@ $6553 isub=CP PLAYER_2
@ $6563 isub=BIT GAME_MODE_BIT_TWO_PLAYERS,A
c $656F
@ $6572 isub=BIT GAME_MODE_BIT_TWO_PLAYERS,A
@ $6577 label=game_over
c $6577 Game Over
c $6587
@ $658A isub=BIT GAME_MODE_BIT_TWO_PLAYERS,A
@ $65A1 ofix=LD DE,$8052
@ $65A4 ofix=LD BC,$0008
c $65AB
c $65BB
c $65CB
c $65DE
@ $65F3 label=handle_right
c $65F3
@ $6602 isub=LD B,PLANE_COORDINATE_Y
@ $6604 isub=LD A,OTHER_MODE_FUEL
@ $6613 isub=LD BC,SPRITE_PLANE_FRAME_SIZE
@ $661C isub=LD E,SPRITE_PLANE_ATTRIBUTES
@ $6621 isub=CP PLAYER_2
$6621,5 Player 2 and ship use the same attributes
@ $6626 isub=LD D,SPRITE_PLANE_HEIGHT_PIXELS
@ $6628 isub=LD A,SPRITE_PLANE_WIDTH_TILES
@ $6642 label=handle_left
c $6642
@ $6651 isub=LD B,PLANE_COORDINATE_Y
@ $6653 isub=LD A,OTHER_MODE_FUEL
@ $6662 isub=LD BC,SPRITE_PLANE_FRAME_SIZE
@ $666B isub=LD E,SPRITE_PLANE_ATTRIBUTES
@ $6670 isub=CP PLAYER_2
$6670,5 Player 2 and ship use the same attributes
@ $6675 isub=LD D,SPRITE_PLANE_HEIGHT_PIXELS
@ $6677 isub=LD A,SPRITE_PLANE_WIDTH_TILES
c $6682
@ $6685 isub=CP INTERACTION_MODE_00
@ $6694 isub=LD A,OTHER_MODE_FUEL
@ $66A4 isub=LD BC,SPRITE_PLANE_FRAME_SIZE
@ $66AD isub=LD E,SPRITE_PLANE_ATTRIBUTES
@ $66B2 isub=CP PLAYER_2
$66B2,5 Player 2 and ship use the same attributes
@ $66B7 isub=LD D,SPRITE_PLANE_HEIGHT_PIXELS
@ $66C4 isub=LD A,SPRITE_PLANE_WIDTH_TILES
@ $66CC label=ld_sprite_plane_banked
c $66CC
@ $66D0 label=advance
c $66D0 Increase #R$5F70 by the value of #R$5F64, set #R$5F64 to the default value and do something with the #R$6BB0 bits.
@ $66E1 isub=LD A,SPEED_NORMAL
c $66EE
@ $66F8 isub=AND VIEWPORT_HEIGHT
@ $66FA isub=CP VIEWPORT_HEIGHT
c $6704
@ $670A isub=LD A,SPEED_FAST
@ $670A label=handle_up
c $670A
@ $6712 isub=SET CONTROLS_BIT_SPEED_ALTERED,(HL)
@ $6714 isub=RES CONTROLS_BIT_SPEED_DECREASED,(HL)
@ $6717 isub=LD A,SPEED_SLOW
@ $6717 label=handle_down
c $6717
@ $671F isub=SET CONTROLS_BIT_SPEED_ALTERED,(HL)
@ $6721 isub=SET CONTROLS_BIT_SPEED_DECREASED,(HL)
@ $6724 label=handle_fire
c $6724
$6739,2 Set CONTROLS_BIT_FIRE
s $673C
@ $673D label=animate_plane_missile
c $673D
@ $677A isub=LD A,OTHER_MODE_HIT
@ $677F isub=LD DE,SPRITE_MISSILE_HEIGHT_PIXELS<<8|SPRITE_MISSILE_ATTRIBUTES
@ $6785 isub=LD BC,SPRITE_MISSILE_FRAME_SIZE_BYTES
@ $6788 isub=LD A,SPRITE_MISSILE_WIDTH_TILES
c $678E
$6791,2 Reset CONTROLS_BIT_FIRE
c $6794
@ $679E isub=CP INTERACTION_MODE_FUEL
@ $67A3 isub=LD A,OTHER_MODE_00
$67E1,2 Reset CONTROLS_BIT_SPEED_DECREASED
c $6831
c $6836
c $683B
c $68A1
c $68B7
@ $68C5 nowarn
c $68C5
@ $68E9 label=init_current_bridge
c $68E9
@ $68EE label=init_current_bridge_loop
@ $6900 isub=CP PLAYER_2
c $6927
s $693B
@ $693C label=handle_terrain_element_1_eq_3
c $693C
@ $6947 label=handle_terrain_element_1_eq_2
c $6947
@ $694D label=increase_bridge_index
c $694D Increase bridge index and handle overflow by resetting to the first bridge.
R $694D O:A Always set to 0
$694D,7 Reset Y-position
$6954,7 Increase bridge index
$695B,2 Check for overflow
@ $6963 label=next_bridge_index_overflow
c $6963
$6963,5 Reset bridge index
@ $696B label=handle_island
c $696B
R $696B I:A The six highest bits of the fourth byte of the terrain element.
@ $6978 label=locate_island_element
@ $697A ofix=JR NZ,$6978
@ $6990 label=render_island_line
c $6990
$6990,7 Next island line.
$6994
@ $69A0 label=L6990_locate_sprite
$69A0,4 Point #REGhl to the element of #R$8063 with the index defined by #R$5EFA.
$69A4,9 Point #REGhl to the profile line with the index defined by #R$5F7D.
c $6A3F
c $6A45
c $6A4A
@ $6A4F label=render_terrain_row
c $6A4F
$6A54,3 Point #REGhl to the #R$9500 array.
$6A57,3 Level terrain array size (64 elements × 4 bytes each)
@ $6A60 label=locate_level_terrain
$6A60,4 Point #REGhl to the element of #R$9500 with the index defined by #R$5EF0.
$6A64,9 Next fragment
$6A6D,5 If it's the last fragment, advance to the next level
$6A72,3 Terrain fragment size (4 bytes)
@ $6A79 label=locate_level_terrain_fragment
$6A79,4 Point #REGhl to the fragment of the current #R$9500 element with the index defined by #R$5F76.
@ $6AA3 label=render_terrain_fragment
@ $6AAF label=locate_terrain_fragment
$6AAF,4 Point #REGhl to the element of #R$8063 with the index defined by #R$5F77.
$6AB3,7 Next line
$6ABA,5 If it's the last line, advance to the next fragment.
$6ABF,6 Point #REGhl to byte of the current terrain fragment defined by #R$5F7D.
$6AC5,4 Load the value of the current terrain row offset into #REGb. The value loaded into #REGc is unused.
$6AC9,1 Load the value of the current terrain profile byte into #REGa.
$6ACA,5 Jump to handling a special terrain fragment.
$6ACF,1 Now #REGa contains the coordinate of the left terrain edge.
$6AD3,2 For some reason, subtract 16 from the coordinate of the left terrain edge.
$6AD5,1 Store the result in #REGd to reuse it in multiple operations with #REGa.
$6ADA,3 Point #REGhl to #R$89F2.
$6ADD,1 Restore the coordinate of the left terrain edge into #REGa.
$6ADE,2 Use only the lowest three bits of the coordinate.
$6AE0,5 Shift the remaining bits right and left effectively discarding the lowest bit and store the result into #REGc. Why not just make AND 6 instead of AND 7 above?
$6AE5,1 Restore the coordinate of the left terrain edge into #REGa.
$6AE6,1 Point #REGhl to the element of #R$89F2 defined by #REGc.
$6AE7,1 Temporarily store the pointer in #REGde.
$6AE8,1 Copy the coordinate of the left terrain edge into #REGc.
$6AE9,3 Point #REGhl screen address of the beginning of the terrain line being currently rendered.
$6AEE,6 Calculate the number of full tiles corresponding to the coordinate of the left terrain edge.
$6AF4,1 Calculate the address where the terrain edge needs to be rendered.
$6AF5,1 Now #REGhl points to the element of #R$89F2 to be rendered, and #REGde contains the address of the screen where it needs to be rendered.
$6AF6,3 Why on earth is the edge represented by two bytes?
$6AF9,2 Copy the bytes. The 0th element of #R$89F2 contains a 10px sprite, the 1th one contains a 12px sprite and so on. So effectively by extracting 16 from the edge coordinate earlier and adding 10 later we are rendering the terrain edge of the size 6px less than defined. Why?
$6AFB,2 Restore #REGde back to the screen address of beginning of the edge.
$6AFD,1 Copy the coordinate of the left terrain edge into #REGb.
$6AFE,6 Again, calculate the number of full tiles corresponding to the coordinate of the left edge.
@ $6B06 label=fill_terrain_left_loop
@ $6B4B label=fill_terrain_right_loop
@ $6B58 label=state_terrain_element_4_eq_1
c $6B58 A=2C-D
R $6B58 I:C TODO: what is the meaning of this parameter?
R $6B58 I:D Left terrain coordinate.
R $6B58 O:A Right terrain coordinate.
@ $6B5E label=state_terrain_element_4_eq_2
c $6B5E A=C+D
R $6B5E I:C River width.
R $6B5E I:D Left terrain coordinate.
R $6B5E O:A Right terrain coordinate.
@ $6B63 label=ld_fragment_canal_adjacent_to_river
c $6B63 Load the sprite and the attributes of the line of the half of the canal adjacent to the river.
@ $6B6B label=ld_fragment_canal_adjacent_to_road
c $6B6B Load the sprite and the attributes of the line of the half of the canal adjacent to the road.
@ $6B73 label=ld_fragment_road
c $6B73 Load the sprite and the attributes of the line of the road and bridge.
@ $6B7B label=handle_special_terrain_fragment
c $6B7B Handle special terrain fragments (pre and post-bridge canal and the road with the bridge) which have different color attributes than the rest of the terrain fragments.
@ $6B8F label=handle_special_terrain_fragment_continue
@ $6BB0 label=state_controls
g $6BB0 Bitmask of the CONTROLS_BIT_* bits containing the current controls and other information.
@ $6BB1 label=pause
c $6BB1 Keep the game paused
$6BB7,5 Loop until anything else than H is pressed
@ $6BBF label=handle_enter
c $6BBF Handle the Enter key pressed
C $6BBF Scan Caps Shift
C $6BC8 Scan Symbol Shift
@ $6BD2 label=select_controls
c $6BD2
@ $6BDB label=int_handler
c $6BDB Non-maskable interrupt handler
$6BE4,6 Check if H was pressed
@ $6BED label=handle_controls
c $6BED
$6BED,5 Check if H was pressed
@ $6BF8 isub=BIT CONTROLS_BIT_FIRE,(HL)
@ $6BFD isub=BIT CONTROLS_BIT_BONUS_LIFE,(HL)
@ $6C05 isub=BIT CONTROLS_BIT_EXPLODING,(HL)
@ $6C0D isub=BIT CONTROLS_BIT_LOW_FUEL,(HL)
$6C13,2 Distill the state down to CONTROLS_BIT_SPEED_DECREASED and CONTROLS_BIT_SPEED_ALTERED.
$6C15,5 Check if only CONTROLS_BIT_SPEED_DECREASED is set.
$6C1A,5 Check if only CONTROLS_BIT_SPEED_ALTERED is set.
$6C1F,5 Check if both bits are set.
@ $6C24 label=int_return
c $6C24 Return from the non-maskable interrupt handler
u $6C2B
@ $6C30 label=state_bit4_counter
g $6C30 Bit4 frame counter
@ $6C31 label=do_bonus_life
c $6C31 Do something about bit4
@ $6C52 label=bit4_finish
c $6C52 Finish doing something about bit4
$6C5A,2 Reset CONTROLS_BIT_BONUS_LIFE
c $6C5D
@ $6C7A label=explosion_counter
g $6C7A Explosion frame counter
@ $6C7B label=beep_explosion
c $6C7B Render explosion
@ $6CAD label=explosion_render_finish
c $6CAD Finish rendering explosion
@ $6CB5 isub=RES CONTROLS_BIT_EXPLODING,(HL)
c $6CB8
c $6CD6
@ $6CF4 label=do_low_fuel
c $6CF4 Render the low fuel signal
@ $6D17 label=demo
c $6D17
C $6D23,2 PAPER 1; INK 4
@ $6D2E isub=LD BC,status_line_2 - status_line_1
@ $6D48 isub=LD BC,L805F - status_line_4
c $6DDD
@ $6DEB label=init_starting_bridge
c $6DEB
c $6DEB
c $6DEB Initializes the starting bridge based on the value of #R$923A using #R$5D3F for the lookup.
$6DEE,2 Shift the game mode right discarding the bit corresponding to the number of players and leaving the ones corresponding to the starting bridge.
$6DF0,3 Point to the beginning of the list
$6DF3,4 Advance to the element corresponding to the game mode.
$6DF7,1 Get the starting bridge number
@ $6DFF label=consume_fuel
c $6DFF
@ $6E02 isub=AND METRONOME_INTERVAL_CONSUME_FUEL
@ $6E0E isub=AND FUEL_CHECK_INTERVAL
@ $6E16 isub=CP FUEL_LEVEL_EMPTY
@ $6E1B isub=AND FUEL_LEVEL_LOW
@ $6E40 label=add_fuel
c $6E40
@ $6E49 isub=AND FUEL_LEVEL_ALMOST_FULL
@ $6E4B isub=CP FUEL_LEVEL_ALMOST_FULL
@ $6E5C isub=ADD A,FUEL_INTAKE_AMOUNT
@ $6E61 isub=AND FUEL_LEVEL_LOW
@ $6E86 label=register_low_fuel
c $6E86 Register low fuel level
$6E89,2 Set CONTROLS_BIT_LOW_FUEL
@ $6E8C label=register_sufficient_fuel
c $6E8C Register sufficient fuel level
$6E8F,2 Reset CONTROLS_BIT_LOW_FUEL
@ $6E92 label=signal_fuel_level_excessive
c $6E92
@ $6E9C label=explode_fragment
c $6E9C Explode a single fragment
R $6E9C I:BC Pointer to the fragment to explode.
@ $6E9F isub=SET CONTROLS_BIT_EXPLODING,(HL)
$6EA1,2 Reset CONTROLS_BIT_FIRE
@ $6EAB label=add_object_to_set
c $6EAB Adds object bytes to the set in thefollowing order: C, B, D.
R $6EAB I:B Mostly $00
R $6EAB I:C Object X-position
R $6EAB I:D Object definition
R $6EAB I:HL Pointer to #R$5F00
@ $6EAC isub=CP SET_MARKER_EMPTY_SLOT
@ $6EB1 isub=CP SET_MARKER_END_OF_SET
@ $6EBC label=write_object_to_set
c $6EBC
c $6EBC
R $6EBC I:A Current value at the address
R $6EBC I:B Mostly $00
R $6EBC I:C Object X-position
R $6EBC I:D Object definition
R $6EBC I:HL Pointer to the element of #R$5F00
@ $6EC1 isub=CP SET_MARKER_END_OF_SET
@ $6EC5 isub=LD (HL),SET_MARKER_END_OF_SET
@ $6EC8 label=render_explosions
c $6EC8
@ $6ED5 isub=CP SET_MARKER_EMPTY_SLOT
@ $6EDA isub=CP SET_MARKER_END_OF_SET
@ $6EF4 isub=AND VIEWPORT_HEIGHT
@ $6EF6 isub=CP VIEWPORT_HEIGHT
@ $6F30 isub=LD A,OTHER_MODE_00
@ $6F63 label=ld_sprite_explosion_f1
c $6F63 Load frame 1 of the explosion sprite.
R $6F63 O:DE Pointer to the sprite.
@ $6F67 label=ld_sprite_explosion_f2
c $6F67 Load frame 2 of the explosion sprite.
R $6F67 O:DE Pointer to the sprite.
@ $6F6B label=ld_sprite_explosion_f3
c $6F6B Load frame 3 of the explosion sprite.
R $6F6B O:DE Pointer to the sprite.
@ $6F6F label=ld_sprite_explosion_erasure
c $6F6F Load explosion erasure sprite.
R $6F6F O:DE Pointer to the sprite.
@ $6F73 label=init_exploding_fragments_ptr
c $6F73
c $6F7A
@ $6F80 isub=LD A,OTHER_MODE_00
@ $6F80 label=next_row
c $6F80 This routine gets called when the screen scrolls by another fragment
@ $6F88 isub=LD DE,SIZE_LEVEL_SLOTS
@ $6F91 label=locate_level
$6F91,4 Have #REGhl point to the level defined by #REGa
@ $6FAB isub=BIT SLOT_BIT_ROCK,D
@ $6FB1 isub=AND SLOT_MASK_OBJECT_TYPE
@ $6FB3 isub=CP OBJECT_FUEL
@ $6FBB label=render_rock
c $6FBB Render rock
R $6FBB I:D Some info (probably, sprite array index)
R $6FBB I:E Some info (probably, position)
@ $6FBC isub=AND SLOT_MASK_OBJECT_TYPE
@ $6FC2 isub=LD BC,SPRITE_ROCK_FRAME_SIZE
@ $6FC8 label=locate_rock_element
@ $6FDD isub=LD A,SPRITE_ROCK_WIDTH_TILES
@ $6FDF isub=LD DE,SPRITE_ROCK_HEIGHT_PIXELS<<8|SPRITE_ROCK_ATTRIBUTES
@ $6FE6 label=ld_enemy_sprites_right
c $6FE6 Load array of arrays of enemy headed right sprites.
R $6FE6 O:HL Pointer to the array of arrays of sprites.
c $6FEA
@ $6FF6 label=render_enemy
@ $6FF6 isub=CP OBJECT_BALLOON
c $6FF6 Render enemy
R $6FF6 I:A Object type
R $6FF6 I:D Object definition
R $6FF6 I:E Object X-position
@ $6FFB isub=CP OBJECT_FIGHTER
@ $7000 isub=CP OBJECT_TANK
@ $7016 isub=LD BC,SPRITE_3BY1_ENEMY_FRAME_SIZE
@ $7019 isub=LD E,SPRITE_3BY1_ENEMY_ATTRIBUTES
@ $701C isub=AND SLOT_MASK_OBJECT_TYPE
@ $701E isub=CP OBJECT_SHIP
@ $7023 isub=CP OBJECT_FIGHTER
@ $7028 isub=CP OBJECT_TANK
@ $702D isub=LD A,SPRITE_3BY1_ENEMY_WIDTH_TILES
@ $702F isub=LD D,SPRITE_3BY1_ENEMY_HEIGHT_PIXELS
@ $7038 isub=LD E,SPRITE_SHIP_ATTRIBUTES
@ $7038 label=ld_attributes_ship
c $7038 Load ship screen attributes.
R $7038 O:E Attributes
@ $703B isub=LD E,SPRITE_FIGHTER_ATTRIBUTES
@ $703B label=ld_attributes_fighter
c $703B Load fighter screen attributes.
R $703B O:E Attributes
@ $703E isub=LD E,SPRITE_TANK_ATTRIBUTES
@ $703E label=ld_attributes_tank
c $703E Load tank screen attributes.
R $703E O:E Attributes
@ $7040 isub=BIT SLOT_BIT_TANK_ON_BANK,D
@ $7043 isub=LD E,SPRITE_TANK_ON_BANK_ATTRIBUTES
@ $7046 label=blending_mode_xor_nop
c $7046
@ $7048 nowarn
$7048,3 Put "XOR B" into #R$8C3C
@ $704D nowarn
$704D,3 Put "NOP" into #R$8C1B
@ $7051 label=render_fuel
c $7051 Render fuel station
R $7051 I:E X position
@ $7060 isub=LD BC,SPRITE_FUEL_STATION_FRAME_SIZE
@ $7063 isub=LD A,SPRITE_FUEL_STATION_WIDTH_TILES
@ $7065 isub=LD DE,SPRITE_FUEL_STATION_HEIGHT_PIXELS<<8|SPRITE_FUEL_STATION_ATTRIBUTES
@ $706C label=render_balloon
c $706C Render balloon
R $706C I:E X position
@ $7072 isub=LD A,OTHER_MODE_00
@ $7082 isub=LD BC,SPRITE_BALLOON_FRAME_SIZE
@ $7085 isub=LD A,SPRITE_BALLOON_WIDTH_TILES
@ $7087 isub=LD DE,SPRITE_BALLOON_HEIGHT_PIXELS<<8|SPRITE_BALLOON_ATTRIBUTES
@ $708E label=operate_viewport_objects
@ $708E isub=LD A,OTHER_MODE_00
c $708E
@ $70A0 isub=CP SET_MARKER_EMPTY_SLOT
@ $70A5 isub=CP SET_MARKER_END_OF_SET
@ $70B1 isub=AND VIEWPORT_HEIGHT
@ $70B3 isub=CP VIEWPORT_HEIGHT
@ $70B9 isub=AND SLOT_MASK_OBJECT_TYPE
@ $70BB isub=CP OBJECT_HELICOPTER_ADV
@ $70C9 isub=CP INTERACTION_MODE_01
@ $70E9 isub=AND SLOT_MASK_OBJECT_TYPE
@ $70EB isub=CP OBJECT_FIGHTER
@ $70F0 isub=CP OBJECT_BALLOON
@ $70F5 isub=CP OBJECT_FUEL
@ $70FA isub=CP OBJECT_TANK
@ $7104 label=operate_ship_or_helicopter
c $7104 Ship or helicopter operation routine.
N $7104 Animates the helicopter rotor on each other metronome tick. Advances the object by 2 pixels on each metrinome tick until it approaches the bank closer than 16 pixels, then inverts the object orientation.
@ $7107 isub=AND HELICOPTER_ANIMATION_METRONOME_MASK
@ $7109 isub=CP HELICOPTER_ANIMATION_METRONOME_VALUE
@ $710E isub=BIT SLOT_BIT_ORIENTATION,D
@ $7113 label=ship_or_helicopter_left_advance
c $7113
@ $7128 label=operate_ship_or_helicopter_continue
@ $713E isub=LD BC,SPRITE_3BY1_ENEMY_FRAME_SIZE
@ $7141 isub=LD E,SPRITE_3BY1_ENEMY_ATTRIBUTES
@ $7144 isub=AND SLOT_MASK_OBJECT_TYPE
@ $7146 isub=CP OBJECT_SHIP
@ $714B isub=LD A,SPRITE_3BY1_ENEMY_WIDTH_TILES
@ $714D isub=LD D,SPRITE_3BY1_ENEMY_HEIGHT_PIXELS
@ $7155 isub=LD C,FIGHTER_POSITION_LEFT_INIT
@ $7155 label=fighter_left_reset
c $7155
@ $7158 label=operate_fighter
c $7158 Fighter operation routine.
N $7158 Advances the fighter by 4 pixels on each metronome tick and renders it using the XOR blending mode. When a fighter reaches the screen margin, resets its position.
@ $715C isub=BIT SLOT_BIT_ORIENTATION,D
@ $7161 label=fighter_left_advance
@ $7166 isub=CP FIGHTER_POSITION_LEFT_LIMIT
@ $716B label=operate_fighter_continue
@ $717B isub=LD BC,SPRITE_3BY1_ENEMY_FRAME_SIZE
@ $7181 isub=LD A,OTHER_MODE_XOR
@ $7186 isub=LD DE,SPRITE_3BY1_ENEMY_HEIGHT_PIXELS<<8|SPRITE_FIGHTER_ATTRIBUTES
@ $7192 label=fighter_right_advance
c $7192
@ $7197 isub=CP FIGHTER_POSITION_RIGHT_LIMIT
@ $719F isub=LD C,FIGHTER_POSITION_RIGHT_INIT
@ $719F label=fighter_right_reset
c $719F
c $71A2
@ $71A5 isub=AND METRONOME_INTERVAL_1
@ $71A7 isub=CP METRONOME_INTERVAL_1
@ $71FE isub=ADD A,SPRITE_SHELL_EXPLOSION_ATTRIBUTES
@ $7201 isub=LD BC,SPRITE_SHELL_EXPLOSION_FRAME_SIZE_BYTES
@ $7204 isub=LD D,SPRITE_SHELL_EXPLOSION_HEIGHT_PIXELS
@ $7206 isub=LD A,SPRITE_SHELL_EXPLOSION_WIDTH_TILES
@ $720E label=finish_tank_shell_explosion
c $720E
@ $721C isub=RES TANK_SHELL_BIT_EXPLODING,A
c $7224
@ $7225 isub=CP OBJECT_BALLOON
@ $722D isub=AND BALLOON_ANIMATION_METRONOME_MASK
@ $722F isub=CP BALLOON_ANIMATION_METRONOME_VALUE
@ $7235 isub=AND SLOT_MASK_OBJECT_TYPE
@ $7237 isub=CP OBJECT_HELICOPTER_REG
@ $723C isub=CP OBJECT_HELICOPTER_ADV
@ $7248 label=ld_sprite_helicopter_rotor_right
c $7248
R $7248 O:HL Pointer to the sprite
@ $724C label=animate_object
c $724C
@ $724D isub=AND SLOT_MASK_OBJECT_TYPE
@ $724F isub=CP OBJECT_HELICOPTER_REG
@ $7254 isub=CP OBJECT_HELICOPTER_ADV
@ $7259 label=animate_helicopter
c $7259
@ $7265 isub=BIT SLOT_BIT_ORIENTATION,D
@ $727D isub=LD DE,SPRITE_ROTOR_HEIGHT_PIXELS<<8|SPRITE_ROTOR_ATTRIBUTES
@ $7280 isub=LD BC,SPRITE_ROTOR_FRAME_SIZE
@ $7283 isub=LD A,SPRITE_ROTOR_WIDTH_TILES
c $728B
@ $7290 isub=LD A,TODO_L5EF2_01
@ $7290 label=ld_L5EF2_1
c $7290
@ $7296 label=operate_tank
c $7296
R $7296 I:D OBJECT_DEFINITION
@ $7299 isub=AND METRONOME_INTERVAL_1
@ $729B isub=CP METRONOME_INTERVAL_1
@ $72A6 isub=BIT SLOT_BIT_TANK_ON_BANK,D
@ $72D2 isub=LD BC,SPRITE_3BY1_ENEMY_FRAME_SIZE
@ $72D8 isub=LD A,SPRITE_3BY1_ENEMY_WIDTH_TILES
@ $72DA isub=LD DE,SPRITE_3BY1_ENEMY_HEIGHT_PIXELS<<8|SPRITE_TANK_ATTRIBUTES
@ $72E6 label=blenging_mode_xor_xor
c $72E6
@ $72E8 nowarn
$72E8,3 Put "XOR B" into #R$8C1B
@ $72EB nowarn
$72EB,3 Put "XOR B" into #R$8C3C
@ $72EF label=blenging_mode_or_or
c $72EF
@ $72F1 nowarn
$72F1,3 Put "OR B" into #R$8C1B
@ $72F4 nowarn
$72F4,3 Put "OR B" into #R$8C3C
@ $72F8 label=invert_tank_offset_delta
c $72F8 Decreases the value of XYZ stored in #REGc by $20. Called if the tank is oriented left in order to compensate for the previous operation of adding $10.
R $72F8 I:C Previous value of XYZ.
R $72F8 O:C New value of XYZ.
c $72FD
@ $7302 label=operate_tank_on_bank
c $7302
R $7302 I:D OBJECT_DEFINITION
@ $730A isub=BIT SLOT_BIT_ORIENTATION,D
@ $731D isub=BIT TANK_SHELL_BIT_FLYING,A
@ $7322 isub=BIT TANK_SHELL_BIT_EXPLODING,A
@ $7327 isub=CP TANK_SHELL_STATE_UNITIALIZED
@ $732C isub=RES TANK_SHELL_BIT_EXPLODING,A
@ $732E isub=SET TANK_SHELL_BIT_FLYING,A
@ $7337 isub=BIT SLOT_BIT_ORIENTATION,D
@ $7343 label=init_tank_shell_state
c $7343 Initialize tank shell state.
R $7343 I:D OBJECT_DEFINITION
R $7343 O:A Shell state with the speed and orientation bits initialized.
$7348,4 Copy the orientation bit from the object definition to the shell state.
@ $7349 isub=AND 1<<SLOT_BIT_ORIENTATION
$734C,5 Derive the speed from the interrupt counter (sort of a PRNG).
$7353,1 Make sure the speed is never zero.
c $7358
c $735E
@ $7361 isub=CP TODO_L5EF2_01
c $7380
@ $7383 label=tank_shell_state
g $7383
@ $7384 label=tank_shell_trajectory_step
g $7384
@ $7385 label=tank_shell_coordinates
g $7385
W $7385
@ $7387 label=invert_shell_coordinate_delta
c $7387
@ $738E label=invert_helicopter_missle_offset
c $738E Invert the previously calculated helicopter missile offset for right-oriented objects.
@ $738F isub=ADD A,HELICOPTER_MISSILE_STEP*2
@ $7393 label=operate_helicopter_missile
c $7393 Operates helicopter missile.