-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.asm
10360 lines (10359 loc) · 171 KB
/
main.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
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 4.1.0 #12072 (MINGW32)
;--------------------------------------------------------
.module main
.optsdcc -mgbz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _main
.globl _init_scorpboss_gun
.globl b_demo_end_screen
.globl _demo_end_screen
.globl b_game_over_menu
.globl _game_over_menu
.globl b_stage_intro_screen
.globl _stage_intro_screen
.globl b_main_menu
.globl _main_menu
.globl b_init_stage_road
.globl _init_stage_road
.globl _hUGE_mute_channel
.globl _hUGE_dosound
.globl _hUGE_init
.globl _fill_bkg_rect
.globl _set_sprite_data
.globl _set_win_tile_xy
.globl _set_win_tiles
.globl _set_win_data
.globl _set_bkg_tiles
.globl _set_bkg_data
.globl _wait_vbl_done
.globl _set_interrupts
.globl _disable_interrupts
.globl _enable_interrupts
.globl _waitpad
.globl _joypad
.globl _add_LCD
.globl _add_VBL
.globl _remove_LCD
.globl _remove_VBL
.globl _menuidx
.globl _explcord
.globl _numkills
.globl _plgun
.globl _gradient
.globl _slope
.globl _precfctr
.globl _chmutedcyccnt
.globl _isapressed
.globl _holeendx
.globl _holestartx
.globl _jumpstarty
.globl _ascendflg
.globl _fallinholeflg
.globl _iframeflg
.globl _iframecnt
.globl _lockmvmnt
.globl _pllives
.globl _machptr
.globl _crntenemy
.globl _pl
.globl _machines
.globl _abtncnt
.globl _prjcnt
.globl _pjctptr
.globl _crntpjct
.globl _projectiles
.globl _checktile
.globl _oamidx
.globl _plspeed
.globl _cloudposx
.globl _sceneryposx
.globl _roadposx
.globl _sitr
.globl _citr
.globl _i
.globl _nextcamtileidx
.globl _camtileidx
.globl _roadbuildidx
.globl _stagenum
.globl _crntstage
.globl _lvlplacptr
.globl _lvlobjscnt
.globl _bossclearflg
.globl _stageclearflg
.globl _holeflg
.globl _stageidx
.globl _enprops
.globl _stingprops
.globl _scorpgunprops
.globl _plprops
.globl _genexplcord
.globl _mutecycnum
.globl _jumphalflimy
.globl _jumplimity
.globl _expldur
.globl _pliframeprd
.globl _enlimit
.globl _abtncooldown
.globl _screenmaxy
.globl _screenmaxx
.globl _screenminy
.globl _screenminx
.globl _pjctllimit
.globl _machinedimswh
.globl _blanktile
.globl _lockedoamtiles
.globl _roadboundy
.globl _plgroundspeed
.globl _jumpspeed
.globl _roadscrspeed
.globl _stnamelengths
.globl _stagenames
.globl _stages
.globl _stage1objs
.globl _stage1road
.globl _roadlanesy
.globl _get_OAM_free_tile_idx
.globl _custom_delay
.globl _incr_oam_sprite_tile_idx
.globl _itr_enemies_ptr
.globl _incr_projectile_counter
.globl _itr_projectile_ptr
.globl _found_free_projectile_space
.globl _get_tile_idx
.globl _clear_all_sprites
.globl _init_stage_bgk
.globl _set_machine_tile
.globl _set_machine_sprite_tiles
.globl _place_machine
.globl _init_player
.globl _respawn_player
.globl _init_machine_props
.globl _init_scorpboss
.globl _collides_with_sidewalk
.globl _is_inside_x_bounds
.globl _move_machine
.globl _move_player
.globl _move_enemy
.globl _incr_bkg_x_coords
.globl _scroll_stage_bkg
.globl _place_stage_obj
.globl _build_stage
.globl _build_road
.globl _build_hole
.globl _manage_hole_props
.globl _manage_projectiles
.globl _manage_machines
.globl _manage_sound_chnls
.globl _manage_player
.globl _get_horiz_dist
.globl _set_projctl_comm_prop
.globl _fire_bullet
.globl _fire_bigbullet
.globl _fire_laser
.globl _drop_bomb
.globl _get_prjctl_x_aimed
.globl _get_prjctl_y_aimed
.globl _is_obj_inside_screen
.globl _is_alive
.globl _destroy_projectile
.globl _init_explosion
.globl _move_projectile
.globl _explode_machine
.globl _anim_explode_boss
.globl _destroy_machine
.globl _take_damage
.globl _add_to_player_shield
.globl _check_iframes
.globl _check_projectile_collsn
.globl _check_player_machine_collsn
.globl _anim_jump
.globl _exec_enemy_pattern
.globl _exec_rider_pattern
.globl _exec_drone_pattern
.globl _exec_missile_pattern
.globl _exec_turret_pattern
.globl _exec_bomber_pattern
.globl _exec_mine_pattern
.globl _cooldown_enemy
.globl _hud_init
.globl _hud_upd_shield
.globl _hud_upd_lives
.globl _hud_draw_pause
.globl _hud_clear_pause
.globl _hud_draw_gun
.globl _init_game
.globl _init_stage
.globl _stage_loop
.globl _scorpboss_loop
.globl _pause_game
.globl _clear_all_projectiles
.globl _anim_stage_start
.globl _anim_stage_end
.globl _anim_blackout_loop
.globl _anim_reverse_blackout_loop
.globl _anim_blackout
.globl _anim_reverse_blackout
.globl _mute_music_pl_chnl
.globl _upd_mute_chnl_cycles
.globl _se_fall_in_hole
.globl _se_fire_bullet
.globl _se_fire_laser
.globl _se_drop_bomb
.globl _se_explode
.globl _se_get_hit
.globl _se_jump
.globl _se_pause
.globl _se_wpn_upgrd
.globl _play_stage
.globl _play_boss
.globl _mute_song
.globl _unmute_song
.globl _play_song
.globl _stop_song
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
_stageidx::
.ds 1
_holeflg::
.ds 1
_stageclearflg::
.ds 1
_bossclearflg::
.ds 1
_lvlobjscnt::
.ds 1
_lvlplacptr::
.ds 2
_crntstage::
.ds 2
_stagenum::
.ds 1
_roadbuildidx::
.ds 1
_camtileidx::
.ds 1
_nextcamtileidx::
.ds 1
_i::
.ds 1
_citr::
.ds 1
_sitr::
.ds 1
_roadposx::
.ds 1
_sceneryposx::
.ds 1
_cloudposx::
.ds 1
_plspeed::
.ds 1
_oamidx::
.ds 1
_checktile::
.ds 1
_projectiles::
.ds 64
_crntpjct::
.ds 2
_pjctptr::
.ds 2
_prjcnt::
.ds 1
_abtncnt::
.ds 1
_machines::
.ds 102
_pl::
.ds 2
_crntenemy::
.ds 2
_machptr::
.ds 2
_pllives::
.ds 1
_lockmvmnt::
.ds 1
_iframecnt::
.ds 1
_iframeflg::
.ds 1
_fallinholeflg::
.ds 1
_ascendflg::
.ds 1
_jumpstarty::
.ds 1
_holestartx::
.ds 1
_holeendx::
.ds 1
_isapressed::
.ds 1
_chmutedcyccnt::
.ds 4
_precfctr::
.ds 1
_slope::
.ds 2
_gradient::
.ds 2
_plgun::
.ds 1
_numkills::
.ds 1
_explcord::
.ds 10
_menuidx::
.ds 1
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;main.c:76: const Stage * crntstage = stages; // Current stage pointer
ld hl, #_crntstage
ld (hl), #<(_stages)
inc hl
ld (hl), #>(_stages)
;main.c:123: UINT8 chmutedcyccnt[] = {255, 255, 255, 255}; // Used to mute a sound channel for a number of cycles
ld hl, #_chmutedcyccnt
ld (hl), #0xff
ld hl, #(_chmutedcyccnt + 0x0001)
ld (hl), #0xff
ld hl, #(_chmutedcyccnt + 0x0002)
ld (hl), #0xff
ld hl, #(_chmutedcyccnt + 0x0003)
ld (hl), #0xff
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
;main.c:266: void custom_delay(UINT8 cycles) NONBANKED {
; ---------------------------------
; Function custom_delay
; ---------------------------------
_custom_delay::
;main.c:267: for(citr = 0; citr < cycles; citr++) {
ld hl, #_citr
ld (hl), #0x00
00103$:
ld a, (#_citr)
ldhl sp, #2
sub a, (hl)
ret NC
;main.c:268: wait_vbl_done();
call _wait_vbl_done
;main.c:267: for(citr = 0; citr < cycles; citr++) {
ld hl, #_citr
inc (hl)
;main.c:270: }
jr 00103$
;main.c:307: void clear_all_sprites() NONBANKED {
; ---------------------------------
; Function clear_all_sprites
; ---------------------------------
_clear_all_sprites::
;main.c:308: for(i = 0; i != 40; i++) {
ld hl, #_i
ld (hl), #0x00
00104$:
;main.c:309: set_sprite_tile(i, 0);
ld hl, #_i
ld c, (hl)
;F:/Game_Boy_Dev_Tools/gbdk/include/gb/gb.h:1145: shadow_OAM[nb].tile=tile;
ld h, #0x00
ld l, c
add hl, hl
add hl, hl
ld de, #_shadow_OAM
add hl, de
inc hl
inc hl
ld (hl), #0x00
;main.c:310: move_sprite(i, 0, 0);
ld hl, #_i
ld c, (hl)
;F:/Game_Boy_Dev_Tools/gbdk/include/gb/gb.h:1218: OAM_item_t * itm = &shadow_OAM[nb];
ld h, #0x00
ld l, c
add hl, hl
add hl, hl
ld de, #_shadow_OAM
add hl, de
;F:/Game_Boy_Dev_Tools/gbdk/include/gb/gb.h:1219: itm->y=y, itm->x=x;
ld a, #0x00
ld (hl+), a
ld (hl), #0x00
;main.c:308: for(i = 0; i != 40; i++) {
ld hl, #_i
inc (hl)
ld a, (hl)
sub a, #0x28
jr NZ, 00104$
;main.c:312: wait_vbl_done();
;main.c:313: }
jp _wait_vbl_done
;main.c:316: void init_stage_bgk() NONBANKED {
; ---------------------------------
; Function init_stage_bgk
; ---------------------------------
_init_stage_bgk::
;main.c:317: if(crntstage->hasclouds) {
ld hl, #_crntstage + 1
dec hl
ld a, (hl+)
ld e, a
ld d, (hl)
ld hl, #0x000b
add hl, de
ld a, (hl)
or a, a
jp Z, 00102$
;main.c:318: SWITCH_ROM_MBC1(2);
ld a, #0x02
ldh (__current_bank+0),a
ld hl, #0x2000
ld (hl), #0x02
;main.c:319: set_bkg_data(20, 13, cloudtiles);
ld hl, #_cloudtiles
push hl
ld de, #0x0d14
push de
call _set_bkg_data
add sp, #4
;main.c:320: set_bkg_tiles(0, 0, 32, 1, cloudmap);
ld hl, #_cloudmap
push hl
ld de, #0x0120
push de
xor a, a
push af
inc sp
xor a, a
push af
inc sp
call _set_bkg_tiles
add sp, #6
;main.c:317: if(crntstage->hasclouds) {
ld hl, #_crntstage
ld a, (hl+)
ld c, a
ld d, (hl)
;main.c:321: SWITCH_ROM_MBC1(crntstage->stagebank);
ld a, c
add a, #0x0c
ld e, a
jr NC, 00111$
inc d
00111$:
ld a, (de)
ldh (__current_bank+0),a
ld a, (de)
ld (#0x2000),a
;main.c:317: if(crntstage->hasclouds) {
ld hl, #_crntstage + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
;main.c:322: set_bkg_data(61, crntstage->bkgtilesnum, crntstage->bkgtiles);
ld hl, #0x0006
add hl, bc
ld a, (hl+)
ld h, (hl)
ld l, a
ld a, c
add a, #0x08
ld c, a
jr NC, 00112$
inc b
00112$:
ld a, (bc)
push hl
ld d,a
ld e,#0x3d
push de
call _set_bkg_data
add sp, #4
;main.c:323: set_bkg_tiles(0, 1, 32, 9, crntstage->bkgmap);
ld hl, #_crntstage + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
ld hl, #0x0009
add hl, bc
ld a, (hl+)
ld c, a
ld b, (hl)
push bc
ld de, #0x0920
push de
ld a, #0x01
push af
inc sp
xor a, a
push af
inc sp
call _set_bkg_tiles
add sp, #6
ret
00102$:
;main.c:321: SWITCH_ROM_MBC1(crntstage->stagebank);
ld hl, #0x000c
add hl, de
ld c, l
ld b, h
;main.c:325: SWITCH_ROM_MBC1(crntstage->stagebank);
ld a, (bc)
ldh (__current_bank+0),a
ld a, (bc)
ld (#0x2000),a
;main.c:317: if(crntstage->hasclouds) {
ld hl, #_crntstage + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
;main.c:326: set_bkg_data(20, crntstage->bkgtilesnum, crntstage->bkgtiles);
ld hl, #0x0006
add hl, bc
ld a, (hl+)
ld h, (hl)
ld l, a
ld a, c
add a, #0x08
ld c, a
jr NC, 00113$
inc b
00113$:
ld a, (bc)
push hl
ld d,a
ld e,#0x14
push de
call _set_bkg_data
add sp, #4
;main.c:327: set_bkg_tiles(0, 0, 32, 10, crntstage->bkgmap);
ld hl, #_crntstage + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
ld hl, #0x0009
add hl, bc
ld a, (hl+)
ld c, a
ld b, (hl)
push bc
ld de, #0x0a20
push de
xor a, a
push af
inc sp
xor a, a
push af
inc sp
call _set_bkg_tiles
add sp, #6
;main.c:329: }
ret
;main.c:528: void scroll_stage_bkg() NONBANKED {
; ---------------------------------
; Function scroll_stage_bkg
; ---------------------------------
_scroll_stage_bkg::
;main.c:529: switch(LYC_REG) {
ldh a, (_LYC_REG+0)
or a, a
jr Z, 00101$
cp a, #0x08
jr Z, 00102$
sub a, #0x50
jr Z, 00103$
ret
;main.c:530: case 0x00:
00101$:
;main.c:531: move_bkg(cloudposx, 0);
ld a, (#_cloudposx)
ldh (_SCX_REG+0),a
;F:/Game_Boy_Dev_Tools/gbdk/include/gb/gb.h:826: SCX_REG=x, SCY_REG=y;
ld a, #0x00
ldh (_SCY_REG+0),a
;main.c:532: LYC_REG = 0x08;
ld a, #0x08
ldh (_LYC_REG+0),a
;main.c:533: break;
ret
;main.c:534: case 0x08:
00102$:
;main.c:535: move_bkg(sceneryposx, 0);
ld a, (#_sceneryposx)
ldh (_SCX_REG+0),a
;F:/Game_Boy_Dev_Tools/gbdk/include/gb/gb.h:826: SCX_REG=x, SCY_REG=y;
ld a, #0x00
ldh (_SCY_REG+0),a
;main.c:536: LYC_REG = 0x50;
ld a, #0x50
ldh (_LYC_REG+0),a
;main.c:537: break;
ret
;main.c:538: case 0x50:
00103$:
;main.c:539: move_bkg(roadposx, 0);
ld a, (#_roadposx)
ldh (_SCX_REG+0),a
;F:/Game_Boy_Dev_Tools/gbdk/include/gb/gb.h:826: SCX_REG=x, SCY_REG=y;
ld a, #0x00
ldh (_SCY_REG+0),a
;main.c:540: LYC_REG = 0x00;
ld a, #0x00
ldh (_LYC_REG+0),a
;main.c:542: }
;main.c:543: }
ret
;main.c:1176: void init_game() NONBANKED {
; ---------------------------------
; Function init_game
; ---------------------------------
_init_game::
;main.c:1177: plspeed = plgroundspeed;
ld a, (#_plgroundspeed)
ld (#_plspeed),a
;main.c:1178: pllives = 3;
ld hl, #_pllives
ld (hl), #0x03
;main.c:1179: plgun = 0;
ld hl, #_plgun
ld (hl), #0x00
;main.c:1180: iframecnt = 0;
ld hl, #_iframecnt
ld (hl), #0x00
;main.c:1181: }
ret
;main.c:1184: void init_stage(UBYTE hasscenery, UBYTE hasscroll) NONBANKED {
; ---------------------------------
; Function init_stage
; ---------------------------------
_init_stage::
add sp, #-4
;main.c:1185: roadposx = sceneryposx = cloudposx = iframeflg = 0;
ld hl, #_iframeflg
ld (hl), #0x00
ld hl, #_cloudposx
ld (hl), #0x00
ld hl, #_sceneryposx
ld (hl), #0x00
ld hl, #_roadposx
ld (hl), #0x00
;main.c:1186: oamidx = 0;
ld hl, #_oamidx
ld (hl), #0x00
;main.c:1187: prjcnt = abtncnt = 0;
ld hl, #_abtncnt
ld (hl), #0x00
ld hl, #_prjcnt
ld (hl), #0x00
;main.c:1188: crntpjct = projectiles;
ld hl, #_crntpjct
ld (hl), #<(_projectiles)
inc hl
ld (hl), #>(_projectiles)
;main.c:1189: crntenemy = machines + 1;
ld hl, #_crntenemy
ld (hl), #<((_machines + 0x0011))
inc hl
ld (hl), #>((_machines + 0x0011))
;main.c:1190: ascendflg = 1;
ld hl, #_ascendflg
ld (hl), #0x01
;main.c:1191: lockmvmnt = 0; // Allowing free movement
ld hl, #_lockmvmnt
ld (hl), #0x00
;main.c:1192: holestartx = 255;
ld hl, #_holestartx
ld (hl), #0xff
;main.c:1193: holeendx = 0;
ld hl, #_holeendx
ld (hl), #0x00
;main.c:1194: isapressed = 0;
ld hl, #_isapressed
ld (hl), #0x00
;main.c:1195: numkills = 0;
ld hl, #_numkills
ld (hl), #0x00
;main.c:1197: stageidx = holeflg = fallinholeflg = 0;
ld hl, #_fallinholeflg
ld (hl), #0x00
ld hl, #_holeflg
ld (hl), #0x00
ld hl, #_stageidx
ld (hl), #0x00
;main.c:1198: lvlplacptr = crntstage->enlayout;
ld hl, #_crntstage + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
inc bc
inc bc
inc bc
ld l, b
ld e, c
ld d, l
ld a, (de)
ld hl, #_lvlplacptr
ld (hl+), a
inc de
ld a, (de)
ld (hl), a
;main.c:1200: roadbuildidx = 0; // Resetting the road index
ld hl, #_roadbuildidx
ld (hl), #0x00
;main.c:1201: if(hasscenery) {
ldhl sp, #6
ld a, (hl)
or a, a
jr Z, 00102$
;main.c:1202: init_stage_bgk();
call _init_stage_bgk
jr 00103$
00102$:
;main.c:1204: fill_bkg_rect(0, 0, 32, 10, 0x00);
xor a, a
ld d,a
ld e,#0x0a
push de
ld a, #0x20
push af
inc sp
xor a, a
push af
inc sp
xor a, a
push af
inc sp
call _fill_bkg_rect
add sp, #5
00103$:
;main.c:1206: init_stage_road();
ld e, #b_init_stage_road
ld hl, #_init_stage_road
call ___sdcc_bcall_ehl
;main.c:1208: if(hasscroll) {
ldhl sp, #7
ld a, (hl)
or a, a
jr Z, 00105$
;main.c:1209: STAT_REG = 0x45;
ld a, #0x45
ldh (_STAT_REG+0),a
;main.c:1210: LYC_REG = 0x00;
ld a, #0x00
ldh (_LYC_REG+0),a
;main.c:1211: remove_LCD(scroll_stage_bkg);
ld hl, #_scroll_stage_bkg
push hl
call _remove_LCD
add sp, #2
;main.c:1212: disable_interrupts();
call _disable_interrupts
;main.c:1213: add_LCD(scroll_stage_bkg);
ld hl, #_scroll_stage_bkg
push hl
call _add_LCD
add sp, #2
;main.c:1214: enable_interrupts();
call _enable_interrupts
;main.c:1215: set_interrupts(VBL_IFLAG | LCD_IFLAG);
ld a, #0x03
push af
inc sp
call _set_interrupts
inc sp
00105$:
;main.c:1218: SWITCH_ROM_MBC1(2);
ld a, #0x02
ldh (__current_bank+0),a
ld hl, #0x2000
ld (hl), #0x02
;main.c:1219: set_sprite_data(0, 1, blanktile);
ld hl, #_blanktile
push hl
ld a, #0x01
push af
inc sp
xor a, a
push af
inc sp
call _set_sprite_data
add sp, #4
;main.c:1220: set_sprite_data(1, 16, playerspritetiles);
ld hl, #_playerspritetiles
push hl
ld de, #0x1001
push de
call _set_sprite_data
add sp, #4
;main.c:1221: set_sprite_data(17, 4, projectiletiles);
ld hl, #_projectiletiles
push hl
ld de, #0x0411
push de
call _set_sprite_data
add sp, #4
;main.c:1222: set_sprite_data(21, 24, enemyspritetiles);
ld hl, #_enemyspritetiles
push hl
ld de, #0x1815
push de
call _set_sprite_data
add sp, #4
;main.c:1223: set_sprite_data(45, 1, misctiles);
ld hl, #_misctiles
push hl
ld de, #0x012d
push de
call _set_sprite_data
add sp, #4
;main.c:1224: SWITCH_ROM_MBC1(1);
ld a, #0x01
ldh (__current_bank+0),a
ld hl, #0x2000
ld (hl), #0x01
;main.c:1225: init_player();
call _init_player
;main.c:1227: for(pjctptr = projectiles; pjctptr <= projectiles + pjctllimit; pjctptr++) { // Initialization of projectiles
ld hl, #_pjctptr
ld a, #<(_projectiles)
ld (hl+), a
ld (hl), #>(_projectiles)
00111$:
ld hl, #_pjctllimit
ld l, (hl)
ld h, #0x00
add hl, hl
add hl, hl
add hl, hl
ld de, #_projectiles
add hl, de
ld c, l
ld b, h
ld hl, #_pjctptr
ld a, c
sub a, (hl)
inc hl
ld a, b
sbc a, (hl)
jr C, 00106$
;main.c:1228: pjctptr->oam = NULL;
ld hl, #_pjctptr + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
ld hl, #0x0006
add hl, bc
xor a, a
ld (hl+), a
ld (hl), a
;main.c:1227: for(pjctptr = projectiles; pjctptr <= projectiles + pjctllimit; pjctptr++) { // Initialization of projectiles
ld hl, #_pjctptr
ld a, (hl)
add a, #0x08
ld (hl+), a
ld a, (hl)
adc a, #0x00
ld (hl), a
jr 00111$
00106$:
;main.c:1232: for(machptr = machines + 1; machptr <= machines + enlimit; machptr++) {
ld hl, #_machptr
ld (hl), #<((_machines + 0x0011))
inc hl
ld (hl), #>((_machines + 0x0011))
00114$:
ld hl, #_enlimit
ld c, (hl)
ld b, #0x00
ld l, c
ld h, b
add hl, hl
add hl, hl
add hl, hl
add hl, hl
add hl, bc
ld de, #_machines
add hl, de
ld c, l
ld b, h
ld hl, #_machptr
ld a, c
sub a, (hl)
inc hl
ld a, b
sbc a, (hl)
jr C, 00107$
;main.c:1233: machptr->shield = machptr->explcount = machptr->cyccount = machptr->type = 0;
ld hl, #_machptr + 1
dec hl
ld a, (hl+)
ld c, a
ld b, (hl)
ld hl, #0x000b
add hl, bc
inc sp
inc sp
push hl
ld hl, #0x0007
add hl, bc
push hl
ld a, l
ldhl sp, #4
ld (hl), a
pop hl
ld a, h
ldhl sp, #3
ld (hl), a
ld hl, #0x0008
add hl, bc
ld e, l
ld d, h
ld hl, #0x000c
add hl, bc
ld (hl), #0x00
xor a, a
ld (de), a
pop bc
pop hl
push hl
push bc
ld (hl), #0x00
pop hl
push hl
ld (hl), #0x00
ld hl, #_machptr + 1
dec hl
ld a, (hl+)
ld e, a
ld d, (hl)
;main.c:1234: machptr->x = machptr->y = machptr->width = machptr->height = 0;
ld c, e
ld b, d
inc bc
push de
;c
ld hl, #0x0002
add hl, de
pop de
inc sp
inc sp
push hl
push de
;c
ld hl, #0x0005
add hl, de
pop de
push hl
ld a, l
ldhl sp, #4
ld (hl), a
pop hl
ld a, h
ldhl sp, #3
ld (hl), a
ld hl, #0x0006
add hl, de
ld (hl), #0x00
ldhl sp, #2
ld a, (hl+)
ld h, (hl)
ld l, a
ld (hl), #0x00
pop hl
push hl
ld (hl), #0x00
xor a, a
ld (bc), a
;main.c:1232: for(machptr = machines + 1; machptr <= machines + enlimit; machptr++) {
ld hl, #_machptr
ld a, (hl)
add a, #0x11
ld (hl+), a
ld a, (hl)