Prev: 27911 Up: Map Next: 28019
27922: Routine at 6D12
Used by the routine at 27291.
27922 LD C,0 C=0.
27924 LD A,(24077) A=Speed.
27927 RLA
27928 RL C
27930 RLA
27931 RL C
27933 LD HL,24112 HL=Unknown.
27936 ADD A,(HL)
27937 LD (HL),A
27938 LD A,C
Working backwards, add onto the odometer.
27939 LD B,3 B=3 (counter - miles are stored in three bytes).
CalcMiles 27941 DEC HL Decrease the pointer to the miles counter held by HL by one.
27942 ADC A,(HL) Adds A to the miles byte held at HL.
27943 DAA
27944 LD (HL),A Write A to HL.
27945 LD A,0 Reset A to 0 while maintaining the carry flag.
27947 DJNZ CalcMiles Decrease counter by one and loop back to CalcMiles until counter is zero.
27949 LD A,(24180) L=24180.
27952 LD L,A
27953 LD A,(24110) A=24110.
27956 CP L
27957 JR Z,27968
27959 LD (24180),A
27962 LD BC,16 BC=0016.
27965 CALL AddPointsToScore Call AddPointsToScore.
27968 LD HL,(24069) HL=PlayerMapPosition.
Check fuel.
27971 LD A,(24075) If Fuel level is not zero then jump to 27990.
27974 AND A
27975 JR NZ,27990
Handle being out of fuel.
27977 LD A,(24077) A=Speed.
27980 CP 51
27982 JR C,27997
27984 DEC A
27985 LD (24077),A
27988 JR 28004 Jump to 28004.
Check temperature.
27990 LD A,(24076) A=Temperature.
27993 CP 160
27995 JR NC,27977
27997 CALL ReadInputAccelerate Call ReadInputAccelerate.
28000 BIT 3,A
28002 JR Z,HandlerCanAccelerate
28004 CALL ReadInputBrake Call ReadInputBrake.
28007 BIT 2,A
28009 JR NZ,HandlerAccelerate_0
28011 LD A,(24077) A=Speed.
28014 SUB 16
28016 JR NC,HandlerAccelerate
28018 XOR A A=0.
Prev: 27911 Up: Map Next: 28019