Prev: 5D4F Up: Map Next: 5DDB
5D63: Deal with ERIC when he's jumping
Called by the routine at F7AD when bit 0 at 7FFB is set (by the routine at 5D4F). Checks whether ERIC has jumped onto a plant pot, up to the safe, or up to the drinks cabinet.
5D63 LD HL,$7FF3 7FF3 holds ERIC's main action timer
5D66 DEC (HL) Is it time for ERIC to land?
5D67 RET NZ Return if not
5D68 LD L,$FB Reset all of ERIC's status flags at 7FFB (ERIC is no longer doing anything special)
5D6A LD (HL),$00
5D6C LD H,$D2 0xD2=ERIC
5D6E CALL $F986 Set the zero flag if ERIC is in the same position as a plant pot
5D71 LD A,$02 Bit 1 set at 7FFB: make the routine at F7AD inspect ERIC's other status flags at 7FED; bit 1 set at 7FED: ERIC is standing on a plant pot
5D73 JR NZ,$5D84 Jump if ERIC's not in the same position as a plant pot
This entry point is used by the routine at 5EC7 with A=0.
5D75 LD DE,$7FFB Set or reset the appropriate status flags at 7FFB
5D78 LD (DE),A
5D79 LD E,$ED Set or reset the appropriate status flags at 7FED
5D7B LD (DE),A
5D7C CALL $61B4 Update the SRB for ERIC's current animatory state and location
5D7F AND $80 Restore ERIC's animatory state to 0x00 (facing left) or 0x80 (facing right) as appropriate
This entry point is used by the routine at 5D4F.
5D81 JP $F317 Update ERIC's animatory state and update the SRB
ERIC has jumped, but not onto a plant pot.
5D84 LD L,A L=0x02
5D85 LD A,(HL) A=ERIC's y-coordinate
5D86 SUB L
5D87 JR Z,$5D91 Jump if ERIC jumped while on the top floor
5D89 LD H,$D2 0xD2=ERIC
5D8B CALL $61B4 Update the SRB for ERIC's current animatory state and location
5D8E INC D Increment ERIC's y-coordinate, bringing him back to the floor
5D8F JR $5D7F Restore ERIC's animatory state and update the SRB
ERIC jumped while on the top floor. Up to the drinks cabinet?
5D91 LD L,A L=0x00
5D92 LD A,(HL) A=ERIC's animatory state
5D93 INC L Now A=x-coordinate of ERIC's raised arm
5D94 RLCA
5D95 SBC A,A
5D96 ADD A,A
5D97 CPL
5D98 INC A
5D99 ADD A,(HL)
5D9A LD HL,$7FF4 7FF4 holds the door/window status flags
5D9D CP $BE Did ERIC jump up to the drinks cabinet?
5D9F JR C,$5DBC Jump if not
5DA1 BIT 5,(HL) Is the drinks cabinet door open?
5DA3 JR Z,$5D89 Just bring ERIC back to the floor if not
ERIC has jumped up to the drinks cabinet, and it's open. But has he got the water pistol?
5DA5 LD L,$EB HL=7FEB (which holds the inventory flags)
5DA7 BIT 4,(HL) Has ERIC already got a sherry-filled water pistol?
5DA9 JR NZ,$5D89 Jump if so
5DAB BIT 3,(HL) Has ERIC got a water-filled water pistol?
5DAD JR Z,$5D89 Jump if not
5DAF SET 4,(HL) Signal: ERIC now has a sherry-filled water pistol
5DB1 CALL $7C02 Print the inventory
Acknowledge the sherry-filled water pistol with a sound effect.
5DB4 LD HL,$0216 Make a sound effect
5DB7 CALL $F2C6
5DBA JR $5D89 Bring ERIC back to the floor
ERIC has jumped, but not onto a plant pot or up to the drinks cabinet. Up to the safe?
5DBC CP $51 Did ERIC jump up to the safe in WACKER's study?
5DBE JR NZ,$5D89 Jump if not
5DC0 LD L,$EB HL=7FEB (which holds the inventory flags)
5DC2 BIT 0,(HL) Has ERIC got the safe key?
5DC4 JR Z,$5D89 Just bring ERIC back to the floor if not
ERIC has jumped up to the safe, and he has the safe key. Celebration time.
5DC6 LD L,$DE Set 7FDE to 1 so the game will be restarted instead of going into demo mode
5DC8 INC (HL)
5DC9 LD A,$C8 Add 2000 to the score and print it
5DCB CALL $73B5
5DCE XOR A A=0x00: 'ONTO THE NEXT YEAR'
5DCF CALL $7EDE Print this in the lesson box and ring the bell
5DD2 LD HL,$DC2B Play the up-a-year tune
5DD5 CALL $5FA5
5DD8 JP $F6D5 Restart the game
Prev: 5D4F Up: Map Next: 5DDB