Prev: 9D17 Up: Map Next: 9D51
9D2E: Calculate overtake bonus
Bonus is 200 for each overtaken car, reset on crashes.
Input
Used by the routine at main_loop.
I:A Iterations (number of sequential overtakes to consider)
calc_overtake_bonus 9D2E LD A,($A22B) If allow_overtake_bonus is zero then return
9D31 AND A
9D32 RET Z
9D33 LD B,A B = A -- iterations / no. of overtakes
9D34 LD HL,$A13C Point HL at overtake_bonus
Increment bonus by 2 up to a max of 128.
cob_overtake_loop 9D37 LD A,(HL) A = *HL + 2
9D38 ADD A,$02
9D3A DAA BCD correction
9D3B CP $80 If A >= 128 then A = 128 [80 in BCD]
9D3D JR C,calc_overtake_bonus_0
9D3F LD A,$80
calc_overtake_bonus_0 9D41 LD (HL),A *HL = A
9D42 EXX Bank
Set bonus to N * 100.
9D43 LD E,A Set middle digits
9D44 XOR A Clear low digit
9D45 LD D,A Clear top two digits
9D46 CALL bonus Call bonus
9D49 EXX Unbank
9D4A DJNZ cob_overtake_loop Loop while B > 0
9D4C XOR A Clear allow_overtake_bonus
9D4D LD ($A22B),A
9D50 RET Return
Prev: 9D17 Up: Map Next: 9D51