Prev: F70A Up: Map Next: F772
F726: Check whether ERIC has jumped up to the safe or a shield (2)
Continues from F51E. Checks whether ERIC has jumped up to the safe or a shield, and makes it flash or unflash as appropriate.
Input
DE Coordinates of ERIC's hand
F726 LD A,($7FEA) Pick up the game mode indicator from 7FEA
F729 CP $02 Are all the shields flashing?
F72B JP NZ,$6DE2 Jump if not (to check whether ERIC touched a shield)
F72E LD A,D A=y-coordinate of ERIC's hand
F72F CP $A1 This is the y-coordinate of the spot just under the safe in the staff room
F731 RET NZ Return if ERIC is not on the middle floor
F732 LD A,E A=x-coordinate of ERIC's hand
F733 CP $0A Has ERIC jumped up to the safe?
F735 RET NZ Return if not
ERIC has jumped up to the safe. Can he open it?
F736 LD HL,$7FED 7FED holds the number of the character who last wrote on the Reading Room blackboard
F739 LD DE,$7FA8 7FA8=Reading Room blackboard contents buffer
F73C LD C,$03 There are 3 blackboards
F73E LD A,(HL) A=number of the character who last wrote on this board
F73F INC HL Move HL along to the next blackboard
F740 INC HL
F741 CP $AC Did ERIC write on this blackboard?
F743 JR NZ,$F75A Jump if not
ERIC wrote on this blackboard. Check whether he wrote the safe combination code.
F745 PUSH HL
F746 LD L,$9F HL=7F9F (which holds the safe combination code)
F748 LD B,$04 There are 4 characters in the safe combination code
F74A PUSH DE Save the pointer to the blackboard contents buffer
F74B LD A,(DE) A=character written on the blackboard by ERIC
F74C AND $5F Convert to upper case
F74E INC E Move DE along to the next character on the blackboard
F74F CP (HL) Does the character on the blackboard match a safe combination letter?
F750 JR NZ,$F756 Jump if not
F752 INC L Move to the next letter of the safe combination code
F753 DJNZ $F74B Jump back until all four letters have been checked
F755 XOR A Set the zero flag to indicate a match
F756 POP DE Restore the blackboard contents buffer pointer to DE
F757 POP HL
F758 JR Z,$F762 Jump if ERIC got the right combination
F75A LD A,E Point DE at the next blackboard contents buffer (7FAE or 7FB4)
F75B ADD A,$06
F75D LD E,A
F75E DEC C Decrease the blackboard counter
F75F JR NZ,$F73E Jump back until all three blackboards have been checked
F761 RET
ERIC got the right combination.
F762 CALL $F8B4 Add 1000 to the score and play a celebratory tune
F765 LD HL,$A18A Point HL at the attribute byte for the safe
F768 SET 7,(HL) Alter the attribute byte of the safe in the skool attribute data to make it flash
F76A EX DE,HL Point DE at the attribute byte for the safe
F76B CALL $F4D2 Get the attribute file address of the safe in HL
F76E RET C Return if the safe is off-screen (unlikely!)
F76F SET 7,(HL) Adjust the on-screen attribute byte of the safe to make it flash
F771 RET
Prev: F70A Up: Map Next: F772