| Routines

25503: Call an interruptible subcommand

Used by the routines at 27904, 31952, 31969, 32497, 61440, 61533, 61555, 61631, 61696, 62032 and 62815. Drops the return address from the stack and copies it into bytes 3 and 4 of the character's buffer (where the address of the primary command routine is held), copies the address of the interruptible subcommand routine from BC into bytes 9 and 10 of the character's buffer, and then jumps to that routine.
Input
BC | Interruptible subcommand routine address
H | Character number (183-214)
25503 | LD L,9 | Copy the routine address from BC into bytes 9 and 10 of the character's buffer
25505 | LD (HL),C
25506 | INC L
25507 | LD (HL),B
25508 | LD A,H | A=character number
25509 | POP HL | Drop the return address from the stack into HL
25510 | PUSH BC | Push the routine address in BC onto the stack
25511 | LD C,L |
25512 | LD L,3 |
This entry point is used by the (unused) routine at 25525 with L=9.
25514 | LD B,H | Now BC=address of the instruction after the CALL that got us here
25515 | LD H,A | H=character number
This entry point is used by the routine at 25520 with L=9 and BC=25581, 25656, 25677 or 62794.
25516 | LD (HL),C | Copy the routine address in BC into bytes 3 and 4 (or 9 and 10) of the character's buffer
25517 | INC L
25518 | LD (HL),B
25519 | RET | Make an indirect jump to the interruptible subcommand routine