| Routines

27206: Deal with a character who has been knocked over

The address of this uninterruptible subcommand routine is placed into bytes 111 and 112 of a character's buffer by the routines at 27126 and 28569. It knocks the character to the floor, makes him give lines to any nearby kids or reveal his safe combination letter (if he's a teacher), and then makes him get up.
Input
H | Character number (152-169)
27206 | LD L,113 | Byte 113 of the character's buffer holds the knockout delay counter
27208 | DEC (HL) | Has the character already got up?
27209 | JP Z,25248 | Terminate this uninterruptible subcommand if so
27212 | LD A,(HL) | Pick up the delay counter in A
27213 | CP 19 | Has the character only just been hit?
27215 | JR Z,27233 | Jump if so
27217 | CALL 63829 | If the character is a teacher, make him reveal his safe combination letter or give lines (as appropriate) and exit, or else return here
27220 | NOP |
27221 | DEC A | Is it time for the character to get up?
27222 | RET NZ | Return if not
27223 | INC L | Copy the character's pre-decked animatory state (stored in byte 114 of the character's buffer) to A
27224 | LD A,(HL)
27225 | PUSH AF |
27226 | CALL 25108 | Update the SRB for the character's current animatory state
27229 | POP AF |
27230 | JP 25008 | Update the character's animatory state and update the SRB
The character has only just been hit, so adjust his animatory state to that of 'decked'.
27233 | CALL 25108 | Update the SRB for the character's current animatory state
27236 | LD L,114 | Store the character's pre-decked animatory state in byte 114 of the buffer
27238 | LD (HL),A
27239 | AND 248 | Set A equal to the animatory state of the character lying on the floor
27241 | ADD A,7
27243 | JP 25008 | Update the character's animatory state and update the SRB