-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxroads2.asm
4802 lines (4017 loc) · 122 KB
/
xroads2.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
* = $0801
!zone constants
DEFAULT_PLAYER_SHIELDS = 3
DEFAULT_PLAYER_MOVE_COOLDOWN = 2
DEFAULT_PLAYER_FIRE_COOLDOWN = 6
POWEREDUP_PLAYER_MOVE_COOLDOWN = 1
POWEREDUP_PLAYER_FIRE_COOLDOWN = 4
SHIELD_SPAR_COLOR = 1
FIRE_SPAR_COLOR = 2
SPEED_SPAR_COLOR = 6
SPARS_TO_WIN_LEVEL = 5
NO_EXTRA_SPAR_SPAWN_CHANCE = $c8
MAX_EXTRA_SPAWNED_SPARS = 5
MAX_PLAYER_SHIELDS = 9
UNENCRYPTED_SCROLLTEXT_CHARACTERS = 96
TOTAL_SCROLLTEXT_CHARACTERS = UNENCRYPTED_SCROLLTEXT_CHARACTERS + 19
NUMBER_TO_PETSCII_ADJUSTMENT = $30
PLAYER_SCORE_DIGITS = 8
INITIAL_SPAR_COUNT = 5
!zone mod_flags
pristine = 1 ; Set to exactly rebuild original crossroads 2.prg .
!ifndef pristine {
always_show_credits = 1 ; Compile out checks for type-in or compute mag and always show credits.
minimum_escalation = 9 ; Set minimum escalation to make early levels faster.
remove_dead_code = 1 ; Remove several examples of unreachable code.
spawn_keys = 1
;show_timing_info = 1
}
!zone internal_values
; Critical character codes.
c_empty = $20
c_spar = $3f
c_player = $40
; Facing directions.
dir_down = 0
dir_up = 1
dir_right = 2
dir_left = 3
; Enemy types.
et_egghead = 0
et_vacuum = 1
et_tagteam1 = 2
et_tagteam2 = 3
et_mutant = 4
et_lemonshark = 5
et_skull = 6
et_chomper = 7
et_monkey = 8
et_rubberhead1 = 9
et_thrower = 10
et_archer = 11
et_dog = 12
et_rubberhead2 = 13
et_flea = 14
et_lion = 15
et_player = 16
et_bullet = 17
et_worm = 18
et_spear = 19
; Special enemy IDs.
eid_last_player = $1
eid_first_enemy = $0c
; Offset $7FF for BC4
!zone hardware_addresses
; C64 Hardware addresses.
ram_rom_mapping = $01
jiffy255_clock = $a1
jiffy_clock = $a2
pressed_key_code = $cb
stack = $0100
screen = $0400
vic_sprite_pointer_array = $07f8
character_rom_base = $d000 ; When mapped by ram_rom_mapping
vic_sprite_coord_array = $d000
vic_sprite_x_hibits = $d010
vic_sprite_enable = $d015
vic_screen_control_2 = $d016
vic_sprite_double_height = $d017
vic_select_buffers = $d018
vic_sprite_color_array = $d027
vic_sprite_priority_bits = $d01b
vic_sprite_double_width = $d01d
vic_border_color = $d020
vic_background_color = $d021
vic_extra_bg_col_3 = $d024
sid_voice1_high_freq = $d401
sid_voice1_control = $d404
sid_voice1_att_dec = $d405
sid_voice3_low_freq = $d40e
sid_voice3_high_freq = $d40f
sid_voice3_control = $d412
sid_volume_filter = $d418
sid_voice3_oscillator_ro = $d41b
colors = $d800
port_2_joystick = $dc00
port_1_joystick = $dc01
cia_timer_control = $dc0e
; OS ROUTINE
output_string_at_yyaa_until_zero_or_quote = $ab1e
sound_buffer = $1f46
!zone "Game data"
copy_of_character_rom = $2800
udgs_base = $2a00
; Explosion status bytes; arrays of 8 bytes, one per possible explosion.
explosion_or_implosion = $4020
explosion_status = $4028
explosion_count_up_array = $4030
explosion_base_sprite_pointer = $4040
explosion_sprite_pointer_offset = $4048
exploding_entity_index = $4058
game_status_flags = $4060
; AI/Vision buffers - arrays of 4 bytes, one per facing.
vision_char_seen_indir = $4061
vision_dist_seen_indir = $4065
vision_saw_friendly_flag = $4069
ai_direction_votes = $406d
ai_fire_bullet_in_direction_score= $407f
slot_udg_loaded_into = $4096
vision_entityId_seen_indir = $40ae
; Entity maps. Entities 0 and 1 are player, 2-12 are player bullets, 13+ are enemies.
; Each is an array of 255 values, although it is unlikely 255 entities would be viable.
entity_enemy_type = $4100 ; Index into enemy type lists.
entity_base_charno = $4200
entity_bullet_type = $4300 ; Type of bullet we fire. If MSB set, we _are_ a bullet.
entity_color_and_flags= $4400 ; Four bits color, four bits AI flags.
entity_status_byte = $4500 ; See bitmap below.
entity_shields = $4600 ; Number of shields entity has.
p2_shields = $4601
entity_upd_cooldown = $4700 ; Frequency with which entity is updated.
entity_vision_distance= $4800 ; Number of squares vision routine scans ahead.
entity_data_cdlow = $4900
entity_type_fired_me = $4a00
entity_bullet_speed = $4b00 ; Frequency with which entity's bullets are updated.
entity_score_awarded = $4c00 ; Score value for entity.
entity_upd_countdown = $4d00 ; Used to count down loops until next update.
entity_x_coords = $4e00 ; X coordinate.
entity_y_coords = $4f00 ; Y coordinate.
entity_spars_eaten = $5000 ; How many spars entity has eaten and should drop on death.
entity_facing = $5100 ; Direction being faced
screen_line_address_lowbytes = $6000 ; Array of screen line addresses built during initialization.
screen_line_address_highbytes = $6019
player_1_score_digits = $6040 ; Player 1, player 2, and high score in BCD.
player_2_score_digits = $6048
high_score_digits = $6050
; Entity_id_buffer: 2D array the same size as screen, where each byte holds the entity-id of the
; entity that was most recently in that cell. Note that they are not cleared when the entity moves
; on, because this should only be used when a collision is confirmed on the screen.
entity_id_buffer = $c000
; It's a 6502 game. It loves zero page global variables.
temp_entity_x_coord = $03
last_facing_for_joystick_position = $04
processing_entity_number = $05
proposed_entity_x_coord = $07
proposed_entity_y_coord = $08
entity_number_that_hit_player = $09
last_enemy_processed = $0d
p1_lives = $11
p2_lives = $12
p1_shields_copy = $14
p2_shields_copy = $15
last_entity_killed_by_overpopulation = $39
enemy_sweep_count = $3c ; How many times enemy update looped in last 4-jiffy period.
escalation = $3f ; Target number of enemy updates in 4-jiffy period, increases with time.
difficulty = $41 ; Number of times enemy update loop repeats before waiting.
udg_number_to_load = $44
interrupt_counter = $46 ; Number of times ISR has run.
level_units_b = $47
max_enemy_entity = $48
player_move_cooldown_counter = $49 ;
level_number_byte = $4b
oldest_bullet_entity_id = $4c
player_fire_cooldown_counter = $4e
spar_animation_timer = $52
player_sound_flag = $66
spars_spawned_by_0d33 = $6b
fast_updates_count = $6c
show_credits = $6d
enemies_left_to_spawn = $6e
extra_enemies_spawnable = $8e
player_has_ticked = $a8
player_move_cooldown = $aa
level_bcd_tens = $b0
level_bcd_units = $b1
udg_slot_to_load_to = $b9
player_fire_cooldown = $be
current_map_color = $c3
current_wall_character = $c4
last_processed_explosion = $c9
current_spar_frame = $ca
extra_enemy_spawn_chance = $d7
; Entity status byte layout
; Bit 8/sign = 1 = entity is between squares
; Bit 6/$20 = 1 = immune to damage
esb_frozen = $40 ; ( If set, $1572 and $185d jump out of entity's loop before processing. )
esb_invulnerable = $20 ; ( If set, $1c17 and $1c50 skip steps that would reduce entity's shield. )
esb_brave = $10 ; ( If set, $15fb skips applying direction penalty for sighted entities. )
esb_randomdirbumps = $08 ; ( If set, $1622 bumps current direction and randoms when critical seen. )
esb_secondframe = $04 ; ( If set, $1292 offsets character used for entity. )
esb_bullet_chance_mask = $03 ; ( Masked off at $166d and a random 2-bit value is subtracted; if it goes
; negative, fire. )
; Color flags (high byte)
; Bit 6 = invisible
csf_aggressive = $40 ; ( If 1, $165b adds proximity bonus when non-vacuum entity seen )
csf_visible = $20 ; ( If 0, $1273 sets drawing color to 0 )
csf_collects_spars = $10 ; ( If 1, $15db applies direction votes when spars seen )
;to "xroads2.d64", d64
!to "xroads2.prg", cbm
!basic entry
!zone character_graphics
first_frames:
;Egghead
!byte %##..###.
!byte %.#.#..##
!byte %.#.###..
!byte %.#.#....
!byte %..####..
!byte %...#####
!byte %..##.##.
!byte %..#...##
;Vacuum
!byte %..###...
!byte %.##.##..
!byte %.####..#
!byte %..##..##
!byte %.#######
!byte %..###.##
!byte %###.##.#
!byte %.#..#...
; Tagteam 1
!byte %#.##....
!byte %#.#..###
!byte %.#####.#
!byte %..##.###
!byte %######..
!byte %..###.##
!byte %.##.##..
!byte %.#...##.
; Tagteam 2
!byte %........
!byte %##...###
!byte %#....#.#
!byte %#.######
!byte %######..
!byte %...#####
!byte %.##.##..
!byte %.#...##.
; Mutant
!byte %........
!byte %..##....
!byte %..#.....
!byte %..##.###
!byte %.#####..
!byte %..##....
!byte %###.#...
!byte %.#...##.
; Lemonshark
!byte %.######.
!byte %##..####
!byte %#####...
!byte %####....
!byte %#####...
!byte %.#######
!byte %###..##.
!byte %#....###
; Skull
!byte %..####..
!byte %.###..#.
!byte %########
!byte %##.#.#.#
!byte %##......
!byte %##.#.#.#
!byte %.#######
!byte %.##...##
; Chomper
!byte %#####...
!byte %#.#####.
!byte %##.#.#.#
!byte %##......
!byte %##.#.#.#
!byte %.######.
!byte %####....
!byte %#..##...
; Monkey
!byte %##...###
!byte %#...##.#
!byte %#.######
!byte %######..
!byte %########
!byte %###.##..
!byte %##...##.
!byte %##....##
; Rubberhead 1
!byte %########
!byte %#...####
!byte %########
!byte %..####..
!byte %.######.
!byte %.######.
!byte %###.###.
!byte %#....###
; THrower
!byte %....###.
!byte %.#..#...
!byte %###.###.
!byte %.#..##..
!byte %.#######
!byte %.#..###.
!byte %.#.####.
!byte %.#.#..##
; Archer
!byte %###...##
!byte %##...#.#
!byte %###.#..#
!byte %########
!byte %###.#..#
!byte %###..#.#
!byte %##....##
!byte %###.....
; Dog
!byte %........
!byte %........
!byte %........
!byte %#.......
!byte %.#...##.
!byte %.#######
!byte %.#####..
!byte %.#...##.
; Rubberhead 2
!byte %..####..
!byte %..#..##.
!byte %..####..
!byte %..#.....
!byte %..#.....
!byte %..####..
!byte %.#.####.
!byte %.#...##.
; Flea
!byte %.#......
!byte %.#......
!byte %#.......
!byte %#.###...
!byte %#.#.####
!byte %.####...
!byte %..######
!byte %..##.##.
; Lion
!byte %###.....
!byte %#...####
!byte %#...#..#
!byte %########
!byte %######..
!byte %########
!byte %##....#.
!byte %#.....##
; Player
!byte %..###...
!byte %..###...
!byte %..##....
!byte %.#######
!byte %#.#####.
!byte %.##.#...
!byte %##..###.
!byte %###.##..
; Bullet
!byte %........
!byte %........
!byte %........
!byte %..####..
!byte %..####..
!byte %........
!byte %........
!byte %........
; Worm
!byte %........
!byte %........
!byte %.#...#..
!byte %#.#.#.#.
!byte %#.#.#.#.
!byte %...#...#
!byte %........
!byte %........
; Spear
!byte %........
!byte %........
!byte %......#.
!byte %########
!byte %......#.
!byte %........
!byte %........
!byte %........
second_frames:
!byte %.#..###.
!byte %.#.#..##
!byte %#..#####
!byte %.#.##...
!byte %..######
!byte %...####.
!byte %....#...
!byte %....##..
!byte %..###...
!byte %.##.##..
!byte %.#####.#
!byte %..##..##
!byte %########
!byte %..##..##
!byte %..#....#
!byte %..##....
!byte %..##....
!byte %#.#..###
!byte %.###.#.#
!byte %..##.###
!byte %.#####..
!byte %#.##....
!byte %...#....
!byte %...##...
!byte %........
!byte %.....###
!byte %##...#.#
!byte %#.######
!byte %######..
!byte %..###.##
!byte %...#....
!byte %...##...
!byte %........
!byte %..##....
!byte %..#.....
!byte %..#####.
!byte %.####...
!byte %..##....
!byte %..#.....
!byte %..##....
!byte %.######.
!byte %##..####
!byte %########
!byte %####....
!byte %########
!byte %.#######
!byte %..##....
!byte %..###...
!byte %..####..
!byte %.###..#.
!byte %#######.
!byte %########
!byte %##.#.#.#
!byte %########
!byte %.#######
!byte %...###..
!byte %#####...
!byte %#.#####.
!byte %########
!byte %##.#.#.#
!byte %########
!byte %.######.
!byte %.##.....
!byte %.###....
!byte %..#..###
!byte %.##.##.#
!byte %#..#####
!byte %########
!byte %..######
!byte %..####..
!byte %..##....
!byte %..###...
!byte %########
!byte %####...#
!byte %########
!byte %..####..
!byte %.######.
!byte %.######.
!byte %..###...
!byte %..####..
!byte %.#..###.
!byte %###.#...
!byte %.#..###.
!byte %.#..##..
!byte %.######.
!byte %.#..###.
!byte %.#..##..
!byte %....###.
!byte %###...##
!byte %##...#.#
!byte %###.#..#
!byte %########
!byte %###.#..#
!byte %###..#.#
!byte %####..##
!byte %#..##...
!byte %........
!byte %........
!byte %........
!byte %#.......
!byte %#....##.
!byte %########
!byte %.#####..
!byte %..###...
!byte %..####..
!byte %..#..#..
!byte %..#####.
!byte %..#.##..
!byte %..#.....
!byte %..####..
!byte %...#....
!byte %...##...
!byte %........
!byte %..##....
!byte %.#......
!byte %#.###...
!byte %#.#.####
!byte %.####...
!byte %..######
!byte %...##...
!byte %..#.....
!byte %###.####
!byte %#...#..#
!byte %########
!byte %#####...
!byte %########
!byte %.#..##..
!byte %.##.#...
!byte %..###...
!byte %..###...
!byte %..##....
!byte %.#######
!byte %.###.##.
!byte %..##....
!byte %..##....
!byte %..###...
!byte %........
!byte %........
!byte %........
!byte %..####..
!byte %..####..
!byte %........
!byte %........
!byte %........
!byte %........
!byte %........
!byte %...#...#
!byte %#.#.#.#.
!byte %#.#.#.#.
!byte %.#...#..
!byte %........
!byte %........
!byte %........
!byte %........
!byte %......#.
!byte %########
!byte %......#.
!byte %........
!byte %........
!byte %........
walls:
!byte %##.##.##
!byte %##....##
!byte %..####..
!byte %#.####.#
!byte %#.####.#
!byte %..####..
!byte %##....##
!byte %##.##.##
!byte %##.##.##
!byte %###..###
!byte %.######.
!byte %#.####.#
!byte %#.####.#
!byte %.######.
!byte %###..###
!byte %##.##.##
!byte %.######.
!byte %#......#
!byte %#......#
!byte %#......#
!byte %#......#
!byte %#......#
!byte %#......#
!byte %.######.
!byte %.##..##.
!byte %#.#..#.#
!byte %##....##
!byte %...##...
!byte %...##...
!byte %##....##
!byte %#.#..#.#
!byte %.##..##.
!byte %.######.
!byte %#......#
!byte %#..##..#
!byte %#.#..#.#
!byte %#.#..#.#
!byte %#..##..#
!byte %#......#
!byte %.######.
!byte %###..###
!byte %#.#..#.#
!byte %##.##.##
!byte %..#..#..
!byte %..#..#..
!byte %##.##.##
!byte %#.#..#.#
!byte %###..###
!byte %##.##.##
!byte %#..##..#
!byte %..####..
!byte %########
!byte %########
!byte %..####..
!byte %#..##..#
!byte %##.##.##
!byte %.######.
!byte %##....##
!byte %#.####.#
!byte %#.####.#
!byte %#.####.#
!byte %#.####.#
!byte %##....##
!byte %.######.
mod_base = $2fc0
* = $098d
!zone main_program
entry:
; Set up to use the SID as a fake random number generator.
lda #$ff ; Set high frequency on both bytes
sta sid_voice3_low_freq
sta sid_voice3_high_freq
lda #$80 ; Enable noise wave
sta sid_voice3_control
lda #$01
sta $02 ; Unused position in zero page
lda #$c0
sta self_mod_sta_base_address_lo ; self modifying
lda #$2f
sta self_mod_sta_base_address_hi ; self modifying
lda #$03
sta $06 ; Unused position in zero page
; Accumulate several arrays in screen space??
; $400 array - 10 + rand(3)
; $480 array - 8 + rand (3)
label_09ac
ldx #$31
generate_random_arrays_loop
; $400 array - 10 + rand(3)
jsr load_two_low_bits_of_osc3_to_accumulator
clc
adc #$0a
sta screen, x
; $480 array - 8 + rand(3)
jsr load_two_low_bits_of_osc3_to_accumulator
adc #$08
sta screen+$80, x
; Generate a random number that is either 0, 1, or $ff.
loop_until_first_array_not_3
jsr load_two_low_bits_of_osc3_to_accumulator
cmp #$03
beq loop_until_first_array_not_3
cmp #$02
bne first_random_not_2
lda #$ff
; Put it in $500 array at current position
first_random_not_2
sta screen+$100, x
; Generate another random
label_09cf
jsr load_two_low_bits_of_osc3_to_accumulator
bne label_09db
; If it's not zero, check that its counterpart in the $500
; array is also not zero, and regenerate it if it is.
tay
lda screen+$100, x
beq loop_until_first_array_not_3
tya
label_09db
; If it's 3, reject it and generate again.
cmp #$03
beq label_09cf
; If it's 2, make it $ff.
cmp #$02
bne label_09e5
lda #$ff
label_09e5
sta screen+$180, x
; Result: $500 and $580 are now sequences of random values that are
; 0, 1, or ff; and where $500's is non zero if $580's is.
lda sid_voice3_oscillator_ro
and #$0f ; Random value 0-15..
adc #$05 ; +5.
sta screen+$200, x ; Identical in $600 and $680 arrays.
sta screen+$280, x
dex
bpl generate_random_arrays_loop
; ------------------ Random seeding loop ends here
lda #$1a
sta $fb
label_09fc
jsr inc_and_clear_smb_64bytes
label_09ff
ldx #$31
label_0a01
dec screen+$280, x
bpl label_0a20
lda screen+$200, x
sta screen+$280, x
; Add each value in $500 array to parallel value in $400 array.
lda screen, x
clc
adc screen+$100, x
sta screen, x
; Add each value in $580 array to parallel value in $480 array.
lda screen+$80, x
clc
adc screen+$180, x
sta screen+$80, x
label_0a20
lda $06 ; This was set to 3 above.
bne label_0a55
lda screen, x
bmi label_0a55
pha
and #$07
tay
pla
lsr
lsr
lsr
sta $fc
lda onebit_masks_zero_is_msb, y
sta $fd
lda screen+$80, x
bmi label_0a55
asl
clc
adc screen+$80, x
adc $fc
tay
jsr self_modified_lda_plus_y
ora $fd
pha
stx temp_entity_x_coord
tya
tax
pla
jsr self_modified_sta_plus_x
ldx temp_entity_x_coord
label_0a55
dex
bpl label_0a01
dec $06
bpl label_09ff
lda #$03
sta $06
dec $fb
bmi label_0a67
jmp label_09fc
label_0a67
dec $02
bmi label_0a6e
jmp label_09ac
label_0a6e
lda #$00
sta cia_timer_control
sta show_credits
!ifdef always_show_credits {
inc show_credits
}
lda #%01110011
sta ram_rom_mapping ; Make character ROM visible at d000
ldx #$ec
; Copy character shapes from ROM to $2800
copy_character_rom
lda character_rom_base-1, x
sta copy_of_character_rom-1, x
lda character_rom_base+$eb, x ; VICII register image??
sta copy_of_character_rom+$eb, x
dex
bne copy_character_rom
ldx #$3f
.load_walls
lda walls, x
sta copy_of_character_rom+$130, x
dex
bpl .load_walls
lda #%01110111
sta ram_rom_mapping ; Make I/O visible at d000
lda #$01
sta cia_timer_control
lda #$1a
sta vic_select_buffers
!ifndef always_show_credits {
; Determine if the credits should be shown. Because Compute! magazine removed programmer's names from
; published programs, the credits are hidden and only displayed if the program is running from Compute!'s
; consumer disk loader or from a typed in program - not if it's running from a raw image, as the
; publishers would check.
lda vic_extra_bg_col_3
cmp #$f6 ; Check for BG col $f6 - this is presumably set by the Compute! disk loader.
bne .no_compute_loader
inc show_credits ; If set, credits will be shown.
.no_compute_loader
lda program_end ; Check for a 0 at the end of the program. This was because Compute! padded
bne .no_type_in ; their listings for type in programs with zeroes at the end.
inc show_credits ; If set, credits will be shown.
.no_type_in
}
lda #$01
sta $fc
label_0ab7
jsr inc_and_clear_smb_64bytes
ldy $fc
lda #$0f
jsr label_0d58
ldy #$00
lda #$10
jsr label_0d58
ldy #$00
lda #$11
jsr label_0d58
inc $fc
lda $fc
cmp #$0a
bcc label_0ab7
lda #$cc
sta vic_screen_control_2 ; Set 40 column screen width
lda #$ff
sta vic_sprite_enable ; Enable all sprites
lda #$00
sta vic_background_color ; Background color
sta vic_border_color ; Border color
sta vic_sprite_priority_bits ; Sprite priority register
sta vic_sprite_double_width ; Sprite double width
sta vic_sprite_double_height ; Sprite double height
sta $d0cd ; Register image??
ldx #$07
.clear_explosions_and_highscore
lda #$00
sta explosion_status, x
sta high_score_digits, x
dex
bpl .clear_explosions_and_highscore