| Routines

638C: Terminate a command

The main entry point is used by the routines at 6464, 7CD0, 7CE1, 7EF1, F073, F0B8, F0BF, F0DA, F250, F460, F46C, F487, F49C and F80D. Removes the primary command routine address from bytes 0x03 and 0x04 of the character's buffer, which has the effect of making the routine at 62D0 move immediately to the next command in the command list.
638C | LD L,$04 | Byte 0x04 of the buffer contains the MSB of the primary command routine address
638E | JR $6396 | Jump forward to replace it with 0
This entry point is used by the routines at 63ED, 6438, 644D, 680F, 6880, 6A08, 7E7B and F017. Removes the interruptible subcommand routine address from bytes 0x09 and 0x0A of the character's buffer, which has the effect of making the routine at 62D0 immediately hand control of the character back to the primary command.
6390 | LD L,$0A | Byte 0x0A of the buffer contains the MSB of the interruptible subcommand routine address
6392 | JR $6396 | Jump forward to replace it with 0
This entry point is used by the routines at 7596, 77B3 and 7A16. Removes the uninterruptible subcommand routine address from bytes 0x11 and 0x12 of the character's buffer, which has the effect of making the routine at 62D0 immediately hand control of the character back to the interruptible subcommand or the primary command.
6394 | LD L,$12 | Byte 0x12 of the buffer contains the MSB of the uninterruptible subcommand routine address
6396 | LD A,($7FFC) | A=number of the character being worked on (0xB7-0xD6)
6399 | LD H,A | Zero out the relevant routine address MSB (in byte 0x04, 0x0A or 0x12) in the character's buffer
639A | LD (HL),$00
639C | JP $6358 | Re-enter the character-moving routine (62D0) at the checkpoint for the interruptible subcommand