| Routines

31985: Call an interruptible subcommand

Used by the routines at 31996, 32048, 32158, 62208 and 62464. Drops the return address from the stack and copies its LSB into byte 99 of the character's buffer (where the LSB of the address of the primary command routine is held), copies the address of the interruptible subcommand routine from BC into bytes 106 and 107 of the character's buffer, and then jumps to that routine.
Input
BC | Interruptible subcommand routine address
H | Character number (152-169)
31985 | LD L,106 | Copy the routine address from BC into bytes 105 and 106 of the character's buffer
31987 | LD (HL),B
31988 | DEC L
31989 | LD (HL),C
31990 | POP DE | Drop the return address off the stack and place its LSB into byte 99 of the character's buffer; this ensures that when the interruptible subcommand has finished, control resumes in the caller of this routine
31991 | LD L,99
31993 | LD (HL),E
31994 | PUSH BC | Make an indirect jump to the routine address in BC
31995 | RET