| Routines

61764: Close any doors that need closing

Used by the routine at 61440. Periodically checks whether any open doors need closing, and closes them.
Input
HL | 32681 (main loop task timer)
61764 | LD A,(HL) | Collect the current value of the main loop task timer from 32681
61765 | AND 15 | Is it time to close any currently open doors?
61767 | RET NZ | Return if not
61768 | LD L,250 | HL will be used to index the door status flags at 32752
61770 | DEC L | Point HL at the status flags for the next door
61771 | BIT 4,L | Have we checked every door yet?
61773 | RET Z | Return if so
61774 | LD A,(HL) | Pick up the status flags for this door
61775 | AND 7 | Is the door currently closed?
61777 | JR Z,61770 | If so, jump back to check the next door
61779 | DEC (HL) | Decrement the door close delay timer in bits 0-2 of the status flags
61780 | DEC A | Is it time to close the door?
61781 | JR NZ,61770 | If not, jump back to check the next door
61783 | PUSH HL | Save the door status flags pointer
61784 | CALL 61696 | Close the door and update the screen refresh buffer
61787 | POP HL | Restore the door status flags pointer to HL
61788 | JR 61770 | Jump back to check the next door