Prev: F46B Up: Map Next: F492
F46E: 'F' pressed - fire catapult
The address of this routine is found in the table of keypress handling routines at 6880. It is called from the main loop at 6767 when 'F', 'C' or '0' (zero) is pressed.
Input
DE ERIC's coordinates
F46E LD A,($AB62) A=x-coordinate of ERIC's catapult pellet
F471 RLCA Is ERIC's catapult pellet already airborne?
F472 RET NC Return if so
F473 LD BC,$0801 B=0x08 (ERIC raising catapult), C=0x01 (bit 0 set)
F476 LD A,$18 This will initialise the catapult-firing action timer at 7FF6 to 0x18
This entry point is used by the routine at F492 with A=0x12, B=0x0A (ERIC raising fist), C=0x02 (bit 1 set); and by the routine at F499 with A=0x10, B=0x0C (ERIC with arm raised), C=0x04 (bit 2 set).
F478 LD HL,$7FFB 7FFB holds ERIC's status flags
F47B BIT 7,(HL) Is ERIC sitting or lying down?
F47D RET NZ Return if so (ERIC can't fire, jump or hit while sitting or lying down)
F47E LD (HL),C Otherwise set the appropriate bit in 7FFB
F47F LD L,$F6 Initialise the action timer at 7FF6
F481 LD (HL),A
F482 PUSH BC Save ERIC's next animatory state temporarily
F483 LD H,$AC 0xAC=ERIC
F485 CALL $6214 Update the SRB for ERIC's current animatory state
F488 POP BC Restore ERIC's next animatory state to B
F489 LD L,$66 Store ERIC's current animatory state in byte 0x66 of his buffer
F48B LD (HL),A
F48C AND $80 A=ERIC's next animatory state (phase 1 of firing, hitting or jumping)
F48E ADD A,B
F48F JP $61B0 Update ERIC's animatory state and update the SRB
Prev: F46B Up: Map Next: F492