Back to Skool Routines
30804: Deal with frog when knocked out of cup
The address of this routine is placed into bytes 17 and 18 the frog's buffer by the routine at 30229 when a catapult pellet has knocked the frog out of the cup in the girls' skool.
30804 LD A,(32747) 32747 holds the inventory flags
30807 RRCA Has ERIC got the safe key already?
30808 JR C,30889 Jump if so
30810 LD HL,52224 Point HL at byte 0 of MISS TAKE's buffer
30813 LD A,(HL) A=MISS TAKE's animatory state
30814 INC L L=1
30815 LD E,(HL) E=MISS TAKE's x-coordinate
30816 INC L L=2
30817 CP 118 118: Is MISS TAKE sitting on the floor facing left?
30819 JR Z,30829 Jump if so
30821 CP 246 246: Is she sitting on the floor facing right?
30823 LD A,252 A=-4
30825 JR NZ,30832 Jump if not
30827 DEC E
30828 DEC E
30829 INC E Now E=x-coordinate of MISS TAKE, adjusted one space to the left or right to take into account the location of her head while she's sitting on the floor
30830 LD A,253 A=-3
30832 ADD A,(HL) A=y-coordinate the frog would have to be at to be level with Miss TAKE's head
30833 LD H,212 212=frog
30835 CP (HL) Compare with the frog's current y-coordinate
30836 JR NZ,30889 Jump if the frog has not reached the level of MISS TAKE's head
30838 DEC L L=1
30839 LD A,(HL) A=frog's x-coordinate
30840 CP E Compare with the x-coordinate of MISS TAKE's head
30841 JR NZ,30889 Jump if they don't match
ERIC's pellet has knocked the frog out of the cup and onto MISS TAKE's head. Celebrate!
30843 LD HL,32747 32747 holds the inventory flags
30846 SET 0,(HL) Give ERIC the safe key
30848 LD A,200 Add 2000 to the score and print it
30850 CALL 29621
30853 LD HL,768 Make the safe-key-getting celebratory sound effect
30856 LD D,1
30858 LD A,L
30859 AND 63
30861 INC A
30862 LD B,A
30863 LD C,(HL)
30864 SET 4,C
30866 CALL 29836
30869 DEC L
30870 JR NZ,30856
30872 NOP
30873 NOP
30874 NOP
30875 CALL 31746 Print the inventory (which now includes the safe key)
30878 LD H,212 212=frog
30880 CALL 25012 Update SRB for the frog's current animatory state and location
30883 DEC E Move the frog one space to the left
30884 INC A A=29: Frog facing left, airborne (phase 1)
30885 INC D Make the frog fall one level
30886 JP 24880 Update SRB for the frog's new animatory state and location
The frog is still above the floor, but not in contact with MISS TAKE's head.
30889 CALL 25012 Update SRB for the frog's current animatory state and location
30892 BIT 4,D Is the frog about to hit the floor (D=16)?
30894 JR Z,30885 Jump if not (to make it fall another level)
30896 CP 28 The frog's animatory state will be 29 if it bounced off MISS TAKE's head
30898 LD A,28 28=frog sitting still, facing left
30900 JR NZ,30886 Jump if the frog bounced off MISS TAKE's head
30902 INC D D=17 (bottom floor)
30903 CALL 30534 Update SRB for the frog's new animatory state and location and then resume control at 30906