| Routines

7974: Make a female character stand on a chair or start jumping

The address of this uninterruptible subcommand routine is placed into bytes 0x11 and 0x12 of a female character's buffer by the routine at 79AE when there's a mouse in the vicinity. It makes the female character either stand on a chair (if there's one beside her) or start jumping up and down.
Input
H | Character number (0xB7-0xBD, 0xCC or 0xD1)
7974 | LD L,$11 | Replace the address of this routine in bytes 0x11 and 0x12 of the character's buffer with that of 7966
7976 | LD (HL),$66
7978 | CALL $61B4 | Update the SRB for the character's current animatory state and location
797B | LD L,$14 | Store the character's current animatory state in byte 0x14 of her buffer, so it can be restored when she's finished jumping
797D | LD (HL),A
797E | INC L | Initialise byte 0x15 to 0 on the assumption that there is no chair to stand on
797F | LD (HL),$00
7981 | DEC D | Jump up
7982 | PUSH DE |
7983 | LD L,$00 | Pretend the character is facing left by resetting bit 7 of her animatory state (to make the chair check work)
7985 | RES 7,(HL)
7987 | CALL $65D4 | Check whether this character is beside a chair
798A | POP DE |
798B | LD L,$15 |
798D | AND A | Is this character standing beside a chair?
798E | JR NZ,$7991 | Jump if not
7990 | INC (HL) | Set byte 0x15 to 1 to indicate that the character is standing on a chair
7991 | DEC L | Collect the character's original animatory state from byte 0x14
7992 | LD A,(HL)
7993 | AND $F8 | A=character's base animatory state
7995 | JP $6130 | Update the character's animatory state and location and update the SRB