| Routines

62574: 'F' pressed - fire catapult

The address of this routine is found in the table of keypress handling routines at 26752. It is called from the main loop at 26471 when 'F', 'C' or '0' (zero) is pressed.
Input
DE | ERIC's coordinates
62574 | LD A,(43874) | A=x-coordinate of ERIC's catapult pellet
62577 | RLCA | Is ERIC's catapult pellet already airborne?
62578 | RET NC | Return if so
62579 | LD BC,2049 | B=8 (ERIC raising catapult), C=1 (bit 0 set)
62582 | LD A,24 | This will initialise the catapult-firing action timer at 32758 to 24
This entry point is used by the routine at 62610 with A=18, B=10 (ERIC raising fist), C=2 (bit 1 set); and by the routine at 62617 with A=16, B=12 (ERIC with arm raised), C=4 (bit 2 set).
62584 | LD HL,32763 | 32763 holds ERIC's status flags
62587 | BIT 7,(HL) | Is ERIC sitting or lying down?
62589 | RET NZ | Return if so (ERIC can't fire, jump or hit while sitting or lying down)
62590 | LD (HL),C | Otherwise set the appropriate bit in 32763
62591 | LD L,246 | Initialise the action timer at 32758
62593 | LD (HL),A
62594 | PUSH BC | Save ERIC's next animatory state temporarily
62595 | LD H,172 | 172=ERIC
62597 | CALL 25108 | Update the SRB for ERIC's current animatory state
62600 | POP BC | Restore ERIC's next animatory state to B
62601 | LD L,102 | Store ERIC's current animatory state in byte 102 of his buffer
62603 | LD (HL),A
62604 | AND 128 | A=ERIC's next animatory state (phase 1 of firing, hitting or jumping)
62606 | ADD A,B
62607 | JP 25008 | Update ERIC's animatory state and update the SRB