Prev: 6DFF Up: Map Next: 6E86
6E40: Add fuel during refueling
Adds FUEL_INTAKE_AMOUNT (4 units) per frame while plane is over a fuel depot. At 50fps, this equals ~200 units/second. A full refuel from empty takes ~1.3 seconds.
  • Checks state_plane_sprite_bank == 4, but this is always $00 at call time (set to $04 only after render completes) — effectively dead code
  • Plays high-pitched refuel sound via ROM BEEPER
  • If fuel almost full ($FC), plays tank full sound via signal_fuel_level_excessive
  • Clears low fuel warning when fuel becomes sufficient
add_fuel 6E40 LD A,($5F69) Check state_plane_sprite_bank == 4 (dead code: always $00 at call time).
6E43 CP $04
6E45 RET Z
6E46 LD A,($5F66) Check if fuel almost full (AND $FC == $FC). If so, jump to signal_fuel_level_excessive for tank full sound.
6E49 AND $FC
6E4B CP $FC
6E4D JP Z,signal_fuel_level_excessive
6E50 LD DE,$0007 Play refueling sound: BEEPER with DE=$0007, HL=$0333.
6E53 LD HL,$0333
6E56 CALL $03B5
6E59 LD A,($5F66) Add 4 to fuel level. If now sufficient (AND $C0 != 0), call register_sufficient_fuel to clear low fuel warning.
6E5C ADD A,$04
6E5E LD ($5F66),A
6E61 AND $C0
6E63 CP $00
6E65 CALL NZ,register_sufficient_fuel
update_fuel_gauge_refuel 6E68 LD A,($5F66) Calculate gauge position: B = $A8, C = (fuel >> 2) + $3F.
6E6B LD B,$A8
6E6D SRL A
6E6F SRL A
6E71 ADD A,$3F
6E73 LD C,A
6E74 CALL calculate_pixel_address Compute screen address.
6E77 LD A,$08 Loop counter: 8 rows.
6E79 LD D,$C6 Draw 8 rows of fuel gauge with pattern $C6 (filled). Increment H each row.
draw_fuel_gauge_refuel_loop 6E7B PUSH AF
6E7C CALL calculate_fuel_gauge_offset
6E7F INC H
6E80 POP AF
6E81 DEC A
6E82 JP NZ,draw_fuel_gauge_refuel_loop
6E85 RET
Prev: 6DFF Up: Map Next: 6E86