Routines |
Prev: F2A7 | Up: Map | Next: F2DD |
Used by the routines at F308 and F346. Returns with the carry flag reset if the door is already open, or the character can open the door (either because the door requires no key, or because the character has the key); otherwise returns with the carry flag set, and the zero flag set if the character has no keys. If the door is closed and requires a key, this routine will either open it (if the character has the key), or signal that the door was knocked on.
|
||||||||
F2A8 | LD D,H | D=character number | ||||||
F2A9 | CALL $F293 | Check whether the door is open | ||||||
F2AC | EX DE,HL | H=character number | ||||||
F2AD | RET NZ | Return (with the carry flag reset) if the door is open | ||||||
F2AE | EX DE,HL | Point HL at the door status flags | ||||||
F2AF | LD A,(HL) | A=door status flags | ||||||
F2B0 | AND A | Does the door require a key to unlock it? | ||||||
F2B1 | JR NZ,$F2BE | Jump if so | ||||||
This entry point is used by the routines at F308 and F383.
|
||||||||
F2B3 | LD A,(HL) | Initialise the door close delay timer (in bits 0-2 of the door status flags) to 7 | ||||||
F2B4 | ADD A,$07 | |||||||
F2B6 | LD (HL),A | |||||||
F2B7 | PUSH DE | Save the character number (in D) briefly | ||||||
F2B8 | CALL $F7CD | Open the door | ||||||
F2BB | POP HL | Restore the character number to H | ||||||
F2BC | XOR A | Reset the carry flag | ||||||
F2BD | RET | |||||||
The door requires a key to unlock it.
|
||||||||
F2BE | LD A,D | A=character number (0xD7-0xE6) | ||||||
F2BF | CP $E6 | Is this Sam? | ||||||
F2C1 | JR NZ,$F2C8 | Jump if not | ||||||
F2C3 | LD A,($7FEA) | Pick up the key inventory flags from 7FEA | ||||||
F2C6 | JR $F2CE | |||||||
F2C8 | ADD A,$0A | A=character number + 0x0A (0xE1-0xEF) | ||||||
F2CA | LD C,A | Point BC at the entry in the table of key ownership flags at F2E1 that corresponds to this character | ||||||
F2CB | LD B,$F2 | |||||||
F2CD | LD A,(BC) | Pick up the key ownership flags | ||||||
F2CE | LD C,A | C=character's key ownership flags | ||||||
F2CF | AND (HL) | Does the character have the key to this door? | ||||||
F2D0 | JR NZ,$F2B3 | Jump if so | ||||||
F2D2 | LD A,L | A=LSB of the door status flag byte (0xF0-0xF9) | ||||||
F2D3 | SUB $46 | A=0xAA-0xB3 | ||||||
F2D5 | LD L,A | Point HL at the door knock status flags for the door (at 7FAA) | ||||||
F2D6 | SET 7,(HL) | Signal: somebody has knocked on the door | ||||||
F2D8 | LD A,C | A=character's key ownership flags | ||||||
F2D9 | AND A | Set the zero flag if the character has no keys | ||||||
F2DA | SCF | Signal: the character cannot open the door | ||||||
F2DB | EX DE,HL | Restore the character number to H | ||||||
F2DC | RET |
Prev: F2A7 | Up: Map | Next: F2DD |