Prev: B9F4 Up: Map Next: BC3E
BB69: Setup for road handling perhaps split related
Used by the routine at main_loop.
road_handling_setup BB69 LD A,($A268) Return if (var_a267 & $FF00) is zero
BB6C AND A
BB6D RET Z
BB6E LD A,($A249) A = fork_taken - 1
BB71 DEC A
BB72 JR Z,road_handling_setup_0 Jump if A is zero (right fork taken)
Set up left route.
BB74 LD DE,$FC01 DE = $FC01 (super super hard left?, 1?)
BB77 PUSH DE
BB78 LD HL,$E2D9
BB7B LD ($A276),HL road_leftside_ptr = roadsplit_leftobjs
BB7E LD HL,$E2D5 road_rightside_ptr = roadsplit_rightobjs
BB81 LD ($A274),HL
BB84 LD HL,$E2E7 road_lanes_ptr = something_lanes_2
BB87 LD ($A272),HL
BB8A LD HL,$0000 Self modified by $C035 to be the left route's hazards data
BB8D LD DE,$0000 Self modified by $BF73 to be the left route's rightside data
BB90 LD BC,$0000 Self modified by $BFBC to be the left route's leftside data
BB93 EXX
BB94 LD HL,$0000 Self modified by $BE5C to be the left route's curvature data
BB97 LD DE,$0000 Self modified by $BEAE to be the left route's height data
BB9A LD BC,$0000 Self modified by $BEF9 to be the left route's lanes data
BB9D LD A,$40 A = 64 offset into road buffer
BB9F JR ml27_bbcc Jump to ml27_bbcc
Set up right route.
road_handling_setup_0 BBA1 LD DE,$0403 DE = $0403 (super super hard right?, 3?)
BBA4 PUSH DE
BBA5 LD HL,$E2D5 road_leftside_ptr = roadsplit_rightobjs
BBA8 LD ($A276),HL
BBAB LD HL,$E2D9 road_rightside_ptr = roadsplit_leftobjs
BBAE LD ($A274),HL
BBB1 LD HL,$E2F3 road_lanes_ptr = something_lanes_3
BBB4 LD ($A272),HL
BBB7 LD HL,$0000 Self modified by $C03D to be the right route's hazards data
BBBA LD DE,$0000 Self modified by $BF73 to be the right route's rightside data
BBBD LD BC,$0000 Self modified by $BFC4 to be the right route's leftside data
BBC0 EXX
BBC1 LD HL,$0000 Self modified by $BE62 to be the right route's curvature data
BBC4 LD DE,$0000 Self modified by $BEB6 to be the right route's height data
BBC7 LD BC,$0000 Self modified by $BF01 to be the right route's lanes data
BBCA LD A,$20 A = 32 offset into road buffer
ml27_bbcc BBCC LD ($BE6D),HL Self modify rm_curvature_one_command handler
BBCF LD ($BEBF),DE Self modify rm_height_one_command handler
BBD3 LD ($BF0A),BC Self modify rm_lanes_one_command handler
BBD7 EXX
BBD8 LD ($BFCD),BC Self modify rm_leftside_one_command handler
BBDC LD ($BF84),DE Self modify rm_rightside_one_command handler
BBE0 LD ($C046),HL Self modify rm_hazards_one_command handler
BBE3 LD HL,$E2DD road_curvature_ptr = something_curvature
BBE6 LD ($A26E),HL
BBE9 LD HL,$E2E2 road_height_ptr = something_height
BBEC LD ($A270),HL
BBEF LD HL,$E2D2 road_hazard_ptr = something_hazards
BBF2 LD ($A278),HL
BBF5 POP DE
BBF6 LD C,A C = A
BBF7 LD A,($A240) Load road_buffer_offset into A [as byte]
BBFA LD L,A HL = $EE00 | A -- curvature data [unsure why the code does this when road_buffer_offset seems to be the right value]
BBFB LD H,$EE
BBFD LD B,$20 Set the 32 bytes at HL to D
road_handling_setup_1 BBFF LD (HL),D
BC00 INC L
BC01 DJNZ road_handling_setup_1
BC03 ADD A,$40 Set the 32 bytes at HL + 64 to E
BC05 LD L,A
BC06 LD B,$20
road_handling_setup_2 BC08 LD (HL),E
BC09 INC L
BC0A DJNZ road_handling_setup_2
BC0C ADD A,C Zero the 32 bytes at HL + 64 + C
BC0D LD L,A
BC0E LD E,B
BC0F LD B,$20
road_handling_setup_3 BC11 LD (HL),E
BC12 INC L
BC13 DJNZ road_handling_setup_3
BC15 XOR A curvature_byte = 0
BC16 LD C,A
BC17 LD ($A242),A
BC1A LD ($A243),A height_byte = 0
BC1D LD ($A244),A leftside_byte = 0
BC20 LD ($A245),A rightside_byte = 0
BC23 LD ($A246),A hazards_byte = 0
BC26 LD ($A247),A lanes_counter_byte = 0
BC29 LD ($A269),A var_a269 = 0
BC2C LD ($A249),A fork_taken = 0
BC2F LD ($A265),A split_road = 0
BC32 INC A no_objects_counter = 1
BC33 LD ($A185),A
BC36 LD ($A16D),A var_a16d = 1
BC39 LD ($A267),BC var_a267 = 0 [B & C are zero here]
BC3D RET Return
Prev: B9F4 Up: Map Next: BC3E