| Routines

7986: Make a character speak (1)

The address of this interruptible subcommand routine is placed into bytes 0x69 and 0x6A of a character's buffer by the routines at 7A32, 7CFC and F400. The subcommand terminates if the character is off-screen; otherwise it waits for anybody else to stop speaking before printing the speech bubble above the character's head and handing over control to the routine at 799A.
Input
H | Character number (0x98-0xA9)
7986 | LD L,$6E | Zero out bytes 0x6D and 0x6E of the character's buffer, which normally hold the address of the next character in the submessage being spoken (when a character starts speaking, there is no submessage)
7988 | XOR A
7989 | LD (HL),A
798A | DEC L
798B | LD (HL),A
This entry point is used while the character is waiting for someone else to stop speaking.
798C | CALL $734E | Make the character start speaking if possible
798F | JP C,$62A4 | Terminate this interruptible subcommand if the character is off-screen
7992 | LD L,$69 | Set the interruptible subcommand routine address in bytes 0x69 and 0x6A of the character's buffer to the entry point at 798C
7994 | LD (HL),$8C
7996 | RET NZ | Return if somebody else is speaking at the moment
Now it's this character's turn to speak.
7997 | LD (HL),$9A | Set the interruptible subcommand routine address in bytes 0x69 and 0x6A of the character's buffer to 799A
7999 | RET |