Prev: F6AA Up: Map Next: F6FF
F6D7: Make MR CREAK reveal his safe combination letter if appropriate
Used by the routine at 7D84. A teacher is standing at the doorway of a classroom, ready to tell the kids to sit down; this routine checks whether the teacher is MR CREAK, and if it is, makes him reveal his safe combination letter if his birth year has been written on the blackboard by ERIC, and ERIC has not yet opened the safe.
Input
H Teacher's character number (0xA3-0xA6)
L 122
F6D7 CALL $F8F6 Return unless we're dealing with CREAK and ERIC has not yet opened the safe
F6DA RET C
F6DB CALL $FA10 Return unless CREAK is near a blackboard last written on by ERIC
F6DE RET NZ
F6DF LD A,E A=0x38 (Reading Room blackboard) or 0x3A (White Room blackboard)
F6E0 SUB $B5
F6E2 PUSH HL Save CREAK's character number
F6E3 LD L,A HL=7FA8 (Reading Room blackboard contents buffer) or 7FAE (White Room blackboard contents buffer)
F6E4 ADD A,A
F6E5 ADD A,L
F6E6 NOP
F6E7 LD L,A
F6E8 LD H,D
Check whether CREAK's birth year has been written on the board.
F6E9 LD E,$9B DE=7F9B (which holds CREAK's year of birth)
F6EB LD B,$04 There are 4 digits in CREAK's year of birth
F6ED LD A,(DE) A=digit from CREAK's year of birth
F6EE INC E Move DE along to the next digit
F6EF CP (HL) Compare the digit with the character written on the board
F6F0 JR NZ,$F6FA Jump if they don't match
F6F2 INC L Move to the next character written on the board
F6F3 DJNZ $F6ED Jump back until all 4 digits have been checked
The first four characters written on the board by ERIC match the digits in MR CREAK's year of birth.
F6F5 POP HL Restore CREAK's character number (0xA6) to H
F6F6 PUSH HL Save it again
F6F7 CALL $F970 Reveal CREAK's safe combination letter
F6FA POP HL Restore CREAK's character number (0xA6) to H
F6FB LD BC,$F1C1 Set BC to F1C1 (SILENCE! OR I'LL CANE THE LOT OF YOU) before returning
F6FE RET
Prev: F6AA Up: Map Next: F6FF