Prev: F100 Up: Map Next: F15E
F144: Close any doors that need closing
Used by the routine at F000. Periodically checks whether any open doors need closing, and closes them.
Input
HL 7FA9 (main loop task timer)
F144 LD A,(HL) Collect the current value of the main loop task timer from 7FA9
F145 AND $0F Is it time to close any currently open doors?
F147 RET NZ Return if not
F148 LD L,$FA HL will be used to index the door status flags at 7FF0
F14A DEC L Point HL at the status flags for the next door
F14B BIT 4,L Have we checked every door yet?
F14D RET Z Return if so
F14E LD A,(HL) Pick up the status flags for this door
F14F AND $07 Is the door currently closed?
F151 JR Z,$F14A If so, jump back to check the next door
F153 DEC (HL) Decrement the door close delay timer in bits 0-2 of the status flags
F154 DEC A Is it time to close the door?
F155 JR NZ,$F14A If not, jump back to check the next door
F157 PUSH HL Save the door status flags pointer
F158 CALL $F100 Close the door and update the screen refresh buffer
F15B POP HL Restore the door status flags pointer to HL
F15C JR $F14A Jump back to check the next door
Prev: F100 Up: Map Next: F15E