Routines
 Prev: F923 Up: Map Next: F9A4
F955: Make a stricken teacher give lines or reveal his safe combination letter
Used by the routine at 6A46. If the character who has been knocked over is a teacher, this routine makes him reveal his safe combination letter (if all the shields are flashing but the safe has not been opened yet) and give lines to the nearest main kid (if any are close enough).
Input
A Knockout delay counter (0x01-0x12)
H Character number (0x98-0xA9)
F955 CP \$12 Is it time to reveal a safe combination letter?
F957 JR Z,\$F960 Jump if so
F959 CP \$09 Is it time to give lines to the nearest main kid?
F95B RET NZ Return if not
F95C POP BC
F95D JP \$6A3C Give lines to the nearest main kid if we're dealing with a teacher
It's time to reveal a safe combination letter (if all shields are flashing).
F960 LD A,(\$7FEA) Collect the game mode indicator from 7FEA
F963 CP \$02 Set the zero flag if all the shields are flashing but the safe has not been opened
F965 LD A,\$12 Restore the knockout delay counter to A
F967 RET NZ Return unless all the shields are flashing
F968 LD A,H Return unless we are dealing with a teacher
F969 CP \$A3
F96B RET C
F96C CP \$A6
F96E RET NC
F96F POP BC
This entry point is used by the routine at F6D7 to make MR CREAK reveal his safe combination letter after seeing his year of birth written on a blackboard.
F970 LD L,\$61 Pick up the character's coordinates in DE
F972 LD D,(HL)
F973 INC L
F974 LD E,(HL)
F975 LD L,H Pick up the teacher's safe combination letter in A
F976 LD H,\$7F
F978 LD A,(HL)
F979 LD L,\$96 Place this in 7F96
F97B LD (HL),A
F97C CALL \$74AF Save the area of the screen that will be overwritten by the bubble
F97F RET C Return if the character is off-screen
F980 PUSH DE
F981 LD DE,\$EC30 Point DE at the graphic data portion of the safe combination letter bubble graphic buffer at EC00
F984 LD HL,\$DA89 DA89: ' ' (single space)
F987 CALL \$7625 Write this into the first line of the graphic buffer
F98A LD DE,\$EC70 Write the teacher's safe combination letter into the second line of the graphic buffer
F98D LD HL,\$7F96
F990 CALL \$7625
F993 LD HL,\$EC18 Set the attribute bytes in the graphic buffer - INK 7: PAPER 0
F996 DEC L
F997 LD (HL),\$07
F999 JR NZ,\$F996
F99B POP DE Restore the attribute file address of the top left corner of the bubble to DE and save it again
F99C PUSH DE
F99D CALL \$7519 Display the combination letter in a bubble
F9A0 XOR A A=0 (black border for the sound effect)
F9A1 JP \$776F Make a sound effect and remove the bubble
 Prev: F923 Up: Map Next: F9A4