| Routines

F346: Control a character who is knocking on or opening a door (1)

The address of this interruptible subcommand routine is placed into bytes 0x0E and 0x0F of a character's buffer by the routine at F338. It makes the character open the door if he can, or knock and begin waiting for an answer.
Input
H | Character number (0xD7-0xE5)
F346 | CALL $F2A8 | Check whether the character can open the door, and open it if so
F349 | LD L,$10 | Point HL at byte 0x10 of the character's buffer
F34B | JR NC,$F375 | Jump if the character has opened the door
F34D | JR Z,$F375 | Jump if the character has no keys (only policemen have no keys)
This character (who is not a policeman) has knocked on the door.
F34F | LD (HL),E | Store the LSB of the address of the door knock status flags (see 7FAA) for the door in byte 0x10 of the character's buffer
F350 | INC L | Initialise the counter in byte 0x11 of the character's buffer to 0x1E; this determines how long the character will wait for someone to open the door before giving up
F351 | LD (HL),$1E
F353 | LD L,$0E | Change the address of the interruptible subcommand routine in bytes 0x0E and 0x0F of the character's buffer to F359
F355 | LD (HL),$59
F357 | JR $F37B | Lower the character's arm