Prev: B1C7 Up: Map Next: B1F5
B1D4: Is door locked?
This locates the current door, queuing a message if it's locked.
Used by the routines at door_handling and door_handling_interior.
Output
F Z set if door open.
is_door_locked B1D4 LD E,$7F Set E to the complement of door_REVERSE ($7F)
B1D6 LD A,($68A1) Fetch the current door [index]
B1D9 AND E Mask it off
B1DA LD C,A Move it to C
Check all locked doors
B1DB LD HL,$F05D Point HL at first locked doors
B1DE LD B,$09 9 iterations / 9 locked doors
Start loop
is_door_locked_0 B1E0 LD A,(HL) Fetch a door index
B1E1 AND E Mask off the locked flag
B1E2 CP C Does it match the current door?
B1E3 JR NZ,is_door_locked_1 Jump forward if not
B1E5 BIT 7,(HL) Test the door_LOCKED flag
B1E7 RET Z Return if the flag was zero: the door is open
Otherwise the door is locked
B1E8 LD B,$05 Queue the message "THE DOOR IS LOCKED"
B1EA CALL queue_message
B1ED OR $01 Set flags to NZ - the door is locked
B1EF RET Return
is_door_locked_1 B1F0 INC HL Advance to the next locked door
B1F1 DJNZ is_door_locked_0 ...loop
B1F3 AND B Set flags to Z - the door is open
B1F4 RET Return
Prev: B1C7 Up: Map Next: B1F5