Prev: 52299 Up: Map Next: 52322
52301: Use Fuel
Used by the routines at DrainFuel, AddFuel and ReadControls.
Adds an amount to the fuel level, to use up some fuel (a positive amount) or to put some in (a negative one), keeping the high byte between 66 and 190.
Input
DE Amount
UseFuel 52301 LD HL,(52299) The fuel level.
52304 ADD HL,DE Add the amount.
52305 LD A,H The high byte is the row of the top of the fuel.
52306 CP 190 Carry on if that row is still on the gauge.
52308 JR C,UseFuel_Upper
52310 LD H,190 Otherwise the tank is empty.
UseFuel_Upper 52312 CP 66 Carry on if the tank is not fuller than full.
52314 JR NC,UseFuel_Store
52316 LD H,66 Otherwise the tank is full.
UseFuel_Store 52318 LD (52299),HL Write the new fuel level.
52321 RET Return.
Prev: 52299 Up: Map Next: 52322