Prev: 873C Up: Map Next: 8876
87DC: Sets up the stage
Input
HL Address of 14 bytes of set up data to be copied to road_pos onwards.
set_up_stage 87DC PUSH HL Preserve data pointer
Zero $EE00..$EEFF and reset road_buffer_offset to $EE00.
87DD LD HL,$EE00
87E0 LD ($A240),HL
87E3 LD D,H
87E4 LD E,$01
87E6 LD (HL),L
87E7 LD BC,$00FF
87EA LDIR
87EC XOR A A = 0
Copy 47 bytes of saved game state at saved_game_state to var_a16d.
87ED LD HL,$A13E
87F0 LD DE,$A16D
87F3 LD BC,$002F
87F6 LDIR
Zero 208 bytes at $A19C onwards (hazard_1 onwards).
87F8 LD H,D
87F9 LD L,E
87FA INC DE
87FB LD (HL),A
87FC LD BC,$00CF
87FF LDIR
8801 POP HL Restore data pointer
Copy the 14 bytes of set up data passed in to road_pos (road_pos, road_curvature_ptr, etc.)
8802 LD BC,$000E
8805 LDIR
Pre-shift the backdrop image.
8807 CALL pre_shift_backdrop
Set backdrop position values in the <road drawing table TBD>.
880A LD HL,$E34B $E34B = 8 -- perhaps a relative value
880D LD (HL),$08
880F INC L
8810 LD (HL),A $E34C = 0
8811 INC L
8812 LD (HL),A $E34D = 0
NOP some things TBD.
8813 LD HL,$8F82 $8F82 = NOP (instruction)
8816 LD (HL),A
8817 INC HL
8818 LD (HL),A $8F83 = NOP (instruction)
8819 INC HL
881A LD (HL),A $8F84 = NOP (instruction)
NOP the 6 instruction bytes at $8FA4: the helicopter and tunnel drawing calls.
881B LD HL,$8FA4
881E LD B,$06
set_up_stage_0 8820 LD (HL),A
8821 INC HL
8822 DJNZ set_up_stage_0
...
8824 LD ($C059),A Self modify "LD (HL),x" at C058 to x = 0
Reset car jump counter.
8827 LD ($B064),A Self modify "LD A,x" at move_hero_car to x = 0
882A LD HL,($5D10) Set $A191 to the perp's car LOD
882D LD ($A191),HL
Zero $EE00..$EEFF and reset road_buffer_offset to $EE00 [duplicates work from earlier].
8830 LD HL,$EE00
8833 LD ($A240),HL
8836 LD D,H
8837 LD E,$01
8839 LD (HL),L
883A LD BC,$00FF
883D LDIR
Run the map reader 32 times [enough to draw the screen?]
883F LD B,$20 32 iterations
sus_loop 8841 PUSH BC Preserve BC
8842 LD HL,$A23F Address of fast_counter == road_buffer_offset - 1 since rm_cycle_buffer_offset will INC HL [why not call an instruction later?]
8845 CALL rm_cycle_buffer_offset Call rm_cycle_buffer_offset
8848 POP BC Restore BC
8849 DJNZ sus_loop Loop
Disallow spawning.
884B XOR A Clear allow_spawning
884C LD ($A254),A
Set up screen.
884F LD A,$F8 Reverse transition
8851 CALL setup_transition Call setup_transition
8854 CALL clear_screen_set_attrs Call clear_screen_set_attrs
8857 LD HL,$5820 Point HL at left light's attributes
885A CALL sus_clear_lights
885D LD HL,$583B Point HL at right light's attributes then FALL THROUGH
Clear the lights' BRIGHT bit.
sus_clear_lights 8860 LD C,$04 4 rows
set_up_stage_1 8862 LD B,$05 5 columns
set_up_stage_2 8864 RES 6,(HL) Clear BRIGHT bit
8866 INC L
8867 DJNZ set_up_stage_2
8869 LD A,L
886A ADD A,$1B
886C LD L,A
886D DEC C
886E JR NZ,set_up_stage_1
Exit, updating the scoreboard. [This must happen twice since this block is CALLed.]
8870 CALL silence_audio_hook Call silence_audio_hook
8873 JP update_scoreboard Exit via update_scoreboard
Prev: 873C Up: Map Next: 8876