Prev: 75FD Up: Map Next: 7653
7615: Check whether a pellet has hit a cup containing water, sherry or the frog
Used by the routine at 76AC. Returns with the zero flag set if the pellet hit a water- or sherry-filled cup. Otherwise it returns with the zero flag reset, but releases the frog if the pellet hit the cup containing it.
Input
H Pellet's character number (0xD5 or 0xD6)
7615 CALL $75FD Has the pellet hit a cup?
7618 RET NZ Return with the zero flag reset if not
7619 LD A,($7FEB) Pick up the inventory flags from 7FEB
761C BIT 1,A Has ERIC got the Science Lab storeroom key?
761E JR Z,$7636 Jump if not
7620 LD A,($D401) A=frog's x-coordinate
7623 INC A Adjust it for comparison with that of the cup that was hit
7624 CP E Does the frog's x-coordinate match that of the cup?
7625 JR NZ,$7636 Jump if not
7627 LD A,($D402) A=frog's y-coordinate
762A CP $0B Is the frog in the cup?
762C JR NZ,$7636 Jump if not
762E PUSH HL
762F LD HL,$7854 Place the address of the uninterruptible subcommand routine at 7854 into bytes 0x11 and 0x12 of the frog's buffer, thus releasing the frog
7632 LD ($D411),HL
7635 POP HL
7636 LD A,($7FFF) A=leftmost column of the play area on screen
7639 LD B,A Return if the cup is off-screen to the left
763A LD A,E
763B SUB B
763C RET C
763D CP $20 Return if the cup is off-screen to the right
763F RET NC
7640 ADD A,$C0 Point DE at the attribute file byte for the cup
7642 LD E,A
7643 LD D,$59
7645 LD A,(DE) Pick up the attribute byte of the cup
7646 CP $28 Does the cup contain water (PAPER 5)?
7648 JR NZ,$764D Jump if not
764A LD A,$1F 0x1F: Drop of water
764C RET Return with the zero flag set
764D CP $58 Does the cup contain sherry (BRIGHT 1: PAPER 3)?
764F RET NZ Return if not
7650 LD A,$9F 0x9F: Drop of sherry
7652 RET Return with the zero flag set
Prev: 75FD Up: Map Next: 7653