| Routines

FBA0: Deal with ERIC when he's falling to the floor to land on his feet

Used by the routine at F7AD when bit 3 at 7FED is set (by the routine at FB03 or FB3C).
FBA0 | LD HL,$7FF3 | 7FF3 holds ERIC's main action timer
FBA3 | DEC (HL) | Is it time to deal with ERIC yet?
FBA4 | RET NZ | Return if not
FBA5 | EX DE,HL |
FBA6 | LD HL,$D202 | Point HL at byte 0x02 of ERIC's buffer
FBA9 | INC (HL) | Increment ERIC's y-coordinate temporarily (for testing purposes)
FBAA | CALL $774F | Has ERIC reached the floor yet?
FBAD | JR NZ,$FBC4 | Jump if not
FBAF | CP $11 | This is the y-coordinate of the bottom floor
FBB1 | DEC HL | Point HL at byte 0x01 of ERIC's buffer
FBB2 | JR Z,$FBB9 | Jump if ERIC has landed on the bottom floor
FBB4 | LD A,(HL) | A=ERIC's x-coordinate
FBB5 | CP $5F | This is the x-coordinate of the rightmost end of the boys' skool
FBB7 | JR NC,$FBC3 | Jump if ERIC is outside the boys' skool (and therefore cannot land on the top or middle floors)
FBB9 | EX DE,HL | Reset all of ERIC's status flags at 7FED and 7FFB, indicating that ERIC has landed safely
FBBA | LD L,$ED
FBBC | LD (HL),$00
FBBE | LD L,$FB
FBC0 | LD (HL),$00
FBC2 | EX DE,HL
FBC3 | INC L | L=0x02
FBC4 | DEC (HL) | Restore ERIC's y-coordinate (we've finished testing)
FBC5 | CALL $61B4 | Update the SRB for ERIC's current animatory state and location
FBC8 | INC D | Increment ERIC's y-coordinate (i.e. make him drop one level)
FBC9 | JP $F317 | Update ERIC's location, update the SRB, and reset ERIC's main action timer at 7FF3 to 6