Prev: 7155 Up: Map Next: 716B
7158: Fighter operation routine
Operates fighter jets that fly horizontally across the screen. Fighters move 4 pixels per frame and wrap around when reaching screen edges. Uses XOR blending mode for rendering.
  • Moves 4 pixels per frame (faster than ships/helicopters)
  • Left-facing: decrements X, wraps at $00 to $E8
  • Right-facing: increments X, wraps at $E8 to $04
  • Sets COLLISION_MODE_FIGHTER for collision detection
Input
B Y position
C X position
D Object definition byte
operate_fighter 7158 LD ($8B0A),BC Store current position to previous_object_coordinates for rendering.
715C BIT 6,D Check orientation: if bit 6 clear (right-facing), jump to fighter_right_advance.
715E JP Z,fighter_right_advance
fighter_left_advance 7161 DEC C Move left 4 pixels (DEC C × 4). If C == 0, reset via fighter_left_reset.
7162 DEC C
7163 DEC C
7164 DEC C
7165 LD A,C
7166 CP $00
7168 CALL Z,fighter_left_reset
Prev: 7155 Up: Map Next: 716B