Prev: CC4B Up: Map Next: CC62
CC4D: 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 42 and BE.
Input
DE Amount
UseFuel CC4D LD HL,($CC4B) The fuel level.
CC50 ADD HL,DE Add the amount.
CC51 LD A,H The high byte is the row of the top of the fuel.
CC52 CP $BE Carry on if that row is still on the gauge.
CC54 JR C,UseFuel_Upper
CC56 LD H,$BE Otherwise the tank is empty.
UseFuel_Upper CC58 CP $42 Carry on if the tank is not fuller than full.
CC5A JR NC,UseFuel_Store
CC5C LD H,$42 Otherwise the tank is full.
UseFuel_Store CC5E LD ($CC4B),HL Write the new fuel level.
CC61 RET Return.
Prev: CC4B Up: Map Next: CC62