Prev: F346 Up: Map Next: F375
F359: Control a character who has knocked on a door and is waiting for an answer
The address of this interruptible subcommand routine is placed into bytes 0x0E and 0x0F of a character's buffer by the routine at F346. It makes the character continue to wait for someone to open the door, or give up and move on if he's already waited long enough.
Input
H Character number (0xD7-0xE5)
F359 LD D,H D=character number
F35A CALL $F293 Check whether the door is open
F35D EX DE,HL H=character number
F35E JP NZ,$F284 Terminate this subcommand if the door is open
F361 LD L,$11 Decrement the wait counter in byte 0x11 of the character's buffer
F363 DEC (HL)
F364 RET NZ Return unless it's now zero
F365 DEC (HL) Set the wait counter in byte 0x11 to 0xFF; since it could just as well be left at 0, this instruction is redundant
F366 DEC L L=0x10
F367 LD E,(HL) Point DE at the door knock status flags for the door that the character knocked on
F368 LD D,$7F
F36A LD A,(DE) Pick up the flags
F36B BIT 6,A Is somebody coming to answer the door?
F36D RET NZ Return if so
The character has waited long enough for someone to open the door, and will now give up and move on.
F36E LD L,$0F Remove the address of this routine from bytes 0x0E and 0x0F of the character's buffer
F370 LD (HL),$00
F372 JP $F6DE Restart the command list
Prev: F346 Up: Map Next: F375