![]()  | 
Routines | 
| Prev: 28019 | Up: Map | Next: 28363 | 
| 
 
Used by the routine at HandlerAccelerate.
 
 | 
||||
| 28210 | EX DE,HL | |||
| 28211 | AND A | |||
| 28212 | SBC HL,DE | |||
| 28214 | SBC A,0 | |||
| 28216 | JR NZ,HandlerAccelerate_4 | |||
| 28218 | EX AF,AF' | |||
| 28219 | LD A,H | |||
| 28220 | CP 128 | |||
| 28222 | JR C,HandlerAccelerate_8 | |||
| 28224 | EX AF,AF' | |||
| 28225 | JR HandlerAccelerate_4 | |||
| 
 
This entry point is used by the routine at HandlerAccelerate.
 
 | 
||||
| 28227 | LD A,(24133) | |||
| 28230 | AND A | |||
| 28231 | JR Z,28244 | |||
| 28233 | DEC A | |||
| 28234 | LD (24133),A | |||
| 28237 | JR Z,28241 | |||
| 28239 | LD A,2 | |||
| 28241 | LD (24135),A | |||
| 28244 | CALL ReadInputLR | Call ReadInputLR. | ||
| 28247 | LD HL,(24080) | |||
| 28250 | LD E,24 | |||
| 28252 | BIT 1,A | |||
| 28254 | JP Z,28278 | |||
| 28257 | BIT 0,A | |||
| 28259 | JP Z,28268 | |||
| 28262 | LD E,0 | E=0. | ||
| 28264 | JR HandlerFuel | Jump to HandlerFuel. | ||
| 28266 | LD E,24 | E=24. | ||
| 28268 | LD D,0 | D=0. | ||
| 28270 | ADD HL,DE | |||
| 28271 | LD (24080),HL | |||
| 28274 | JR HandlerFuel | Jump to HandlerFuel. | ||
| 28276 | LD E,24 | E=24. | ||
| 28278 | LD D,0 | D=0. | ||
| 28280 | AND A | |||
| 28281 | SBC HL,DE | |||
| 28283 | LD (24080),HL | |||
| 
 
Don't "use fuel" on every frame. This routine uses the last two bits of the GameTimer (i.e. a number between 0-3) to only process every fourth frame.
 
 | 
||||
| HandlerFuel | 28286 | LD A,(24105) | A=GameTimer. | |
| 28289 | AND %00000011 | Keep only bits 0-1. | ||
| 28291 | JR NZ,HandlerTemperatureGauge | If the result is not zero then jump to HandlerTemperatureGauge. | ||
| 
 
Handles "using" fuel.
 
 | 
||||
| 28293 | LD A,(24077) | B=0 C=Speed. | ||
| 28296 | LD C,A | |||
| 28297 | LD B,0 | |||
| 28299 | LD HL,(24074) | HL=Fuel_LSB. | ||
| 
 
A higher speed uses more fuel.
 
 | 
||||
| 28302 | SBC HL,BC | HL=HL (fuel) - BC (speed). | ||
| 28304 | JR C,FuelSkipWrite | If there's "carry" (i.e. if the player has run out of fuel) jump to FuelSkipWrite. | ||
| 28306 | LD (24074),HL | Write HL to Fuel_LSB. | ||
| FuelSkipWrite | 28309 | CP 176 | If the current speed is more than 176 (top speed) jump to TemperatureMaxSpeed. | |
| 28311 | JR NC,TemperatureMaxSpeed | |||
| 28313 | CP 96 | Compare current speed with 96. | ||
| 
 
Handle the temperature gauge.
 
 | 
||||
| HandlerTemperatureGauge | 28315 | LD A,(24076) | A=Temperature. | |
| 28318 | JR C,TemperatureDrop | If there's carry set (this could be either from 28313 or 28289) then jump to TemperatureDrop. | ||
| DrawTemperatureGauge | 28320 | LD HL,20834 | HL=20834 (screen location). | |
| 28323 | CALL DrawGaugeLine | Call DrawGaugeLine. | ||
| 
 
Handle the fuel gauge.
 
 | 
||||
| 28326 | LD A,(24075) | A=Fuel_MSB. | ||
| 28329 | LD HL,20770 | HL=20770 (screen location). | ||
| 28332 | JP DrawGaugeLine | Jump to DrawGaugeLine. | ||
| 
 
Handle the temperature gauge at maximum speed.
 
 | 
||||
| TemperatureMaxSpeed | 28335 | LD A,(24076) | A=Temperature. | |
| 
 
Check if the temperature is already at the upper limit.
 
 | 
||||
| 28338 | CP 192 | If the current temperature is more than 192 jump to DrawTemperatureGauge. | ||
| 28340 | JR NC,DrawTemperatureGauge | |||
| 
 
Go ahead and increase the temperature...
 
 | 
||||
| 28342 | INC A | Increment A by one. | ||
| UpdateTemperature | 28343 | LD (24076),A | Write the updated A (temperature) back to Temperature. | |
| 28346 | JR DrawTemperatureGauge | Jump to DrawTemperatureGauge. | ||
| 
 
Handles dropping the temperature gauge.
 
 | 
||||
| TemperatureDrop | 28348 | AND A | If the current temperature is at zero jump to DrawTemperatureGauge. | |
| 28349 | JR Z,DrawTemperatureGauge | |||
| 28351 | DEC A | Decrease A (temperature) by one. | ||
| 28352 | JR UpdateTemperature | Jump to UpdateTemperature. | ||
| 
 
This entry point is used by the routine at HandlerAccelerate.
 
 | 
||||
| 28354 | LD B,5 | B=5. | ||
| 28356 | SRL H | |||
| 28358 | RR L | |||
| 28360 | DJNZ 28356 | Decrease counter by one and loop back to 28356 until counter is zero. | ||
| 28362 | RET | Return. | ||
| Prev: 28019 | Up: Map | Next: 28363 |