Prev: 754C Up: Map Next: 75A2
758A: Clip fuel station height to viewport
Called when the fuel station extends past the viewport bottom. Calculates the visible portion height by subtracting the overflow from the full height.
  • Input: B = Y position, D = full height ($19)
  • Calculates: overflow = (Y + height) - VIEWPORT_HEIGHT
  • Output: D = visible height = height - overflow
Input
B Y position of fuel station
D Full sprite height ($19 = 25 pixels)
Output
D Clipped height (visible portion only)
handle_fuel_off_viewport 758A LD H,$00 Calculate overflow: HL = (Y + height) - $90.
758C LD L,B
758D LD BC,$0019
7590 ADD HL,BC
7591 LD BC,$0090
7594 OR A
7595 SBC HL,BC
7597 LD B,$00 Calculate visible height: D = $19 - overflow.
7599 LD C,L
759A LD H,$00
759C LD L,D
759D OR A
759E SBC HL,BC
75A0 LD D,L
75A1 RET
Prev: 754C Up: Map Next: 75A2