| Routines

6A46: Deal with a character who has been knocked over

The address of this uninterruptible subcommand routine is placed into bytes 0x6F and 0x70 of a character's buffer by the routines at 69F6 and 6F99. 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 (0x98-0xA9)
6A46 | LD L,$71 | Byte 0x71 of the character's buffer holds the knockout delay counter
6A48 | DEC (HL) | Has the character already got up?
6A49 | JP Z,$62A0 | Terminate this uninterruptible subcommand if so
6A4C | LD A,(HL) | Pick up the delay counter in A
6A4D | CP $13 | Has the character only just been hit?
6A4F | JR Z,$6A61 | Jump if so
6A51 | CALL $F955 | If the character is a teacher, make him reveal his safe combination letter or give lines (as appropriate) and exit, or else return here
6A54 | NOP |
6A55 | DEC A | Is it time for the character to get up?
6A56 | RET NZ | Return if not
6A57 | INC L | Copy the character's pre-decked animatory state (stored in byte 0x72 of the character's buffer) to A
6A58 | LD A,(HL)
6A59 | PUSH AF |
6A5A | CALL $6214 | Update the SRB for the character's current animatory state
6A5D | POP AF |
6A5E | JP $61B0 | 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'.
6A61 | CALL $6214 | Update the SRB for the character's current animatory state
6A64 | LD L,$72 | Store the character's pre-decked animatory state in byte 0x72 of the buffer
6A66 | LD (HL),A
6A67 | AND $F8 | Set A equal to the animatory state of the character lying on the floor
6A69 | ADD A,$07
6A6B | JP $61B0 | Update the character's animatory state and update the SRB