| Routines

27772: Deal with a character who is looking for a seat

The address of this uninterruptible subcommand routine is placed into bytes 111 and 112 of a character's buffer by the routine at 27748 (after he's been knocked out of his chair and just got up to look for another one - or the same one, in EINSTEIN's case), or by the routine at 27808.
Input
H | Character number (152-169)
27772 | CALL 25108 | Update the SRB for the character's current location
27775 | LD C,A | Store the character's animatory state in C temporarily
27776 | BIT 0,A | Is the character midstride?
27778 | JP NZ,25434 | Finish the stride if so
27781 | CALL 27632 | Is the character standing beside a chair?
27784 | JP Z,27517 | If so, knock the current occupant (if any) to the floor, make this character sit down, and remove the address of this routine from bytes 111 and 112 of his buffer
27787 | LD A,C | Restore the character's animatory state to A
27788 | NOP |
27789 | JR NC,27794 | Jump unless the character should turn round
27791 | XOR 128 | Flip bit 7 of the animatory state, thus turning him round
27793 | DEC A | Compensate for the 'INC A' below
27794 | INC A | A=character's new animatory state (midstride, or just turned round)
27795 | JP 25008 | Update the character's animatory state and update the SRB