Prev: A7F3 Up: Map Next: A8CD
A89C: Returns the lanes that cars can spawn in
Return $0101 and cars only appear in the leftmost lane. $0102 (1st and 2nd, mainly 2nd). $0104 first three lanes. $0304 - third and fourth lanes.
Input
C Buffer offset
Output
BC TBD
get_spawn_lanes A89C LD A,($A240) A = [current buffer offset] + 66 + C (wrapping around)
A89F ADD A,$42
A8A1 ADD A,C
A8A2 LD L,A A = $EE00[A]
A8A3 LD H,$EE
A8A5 LD A,(HL)
A8A6 AND A Set flags
A8A7 LD BC,$0104 BC = $0104
A8AA RET Z Return if zero
A8AB LD E,A E = A preserve
A8AC AND $C1 A &= $C1
A8AE CP $C1 CP $C1
A8B0 RET Z Return if zero
A8B1 CP $41 CP $41
A8B3 LD BC,$0103 BC = $0103
A8B6 RET Z Return if zero
A8B7 LD A,E A = (E & $82) << 1
A8B8 AND $82
A8BA ADD A,A
A8BB JR NC,get_spawn_lanes_0 Jump to get_spawn_lanes_0 if didn't carry
A8BD LD BC,$0204 BC = $0204
A8C0 RET NZ Return if non-zero
A8C1 LD BC,$0103 BC = $0103
A8C4 RET Return
get_spawn_lanes_0 A8C5 LD BC,$0102 BC = $0102
A8C8 RET Z Return if zero
A8C9 LD BC,$0304 BC = $0304
A8CC RET Return
Prev: A7F3 Up: Map Next: A8CD