| Routines

F7DA: Collect the window flags for a play area location

Used by the routine at E70C. On entry, A holds the T value (rotated left once), and DE points at the window flags for the play area location under consideration at (X,Y) (in one of the data blocks at B840, B940, BA40, BB40, BC40, BD40 and BE40). The window flags have the following meanings:
Bit(s) | Meaning
--- | ---
6,7 | Decorations for the only window, or the left-hand window of a pair: 11=blind is down; 10=blind is up; 01=other; 00=none
5 | If set, the light switch is in the 'off' position; reset='on'
2-4 | Unused
0,1 | Decorations for the right-hand window of a pair (used when bit 2 of T is set)
The window flags are also relevant for play area locations (41,33), (113,33), (154,33), (209,33), (234,33) and (250,33), where house number signs are displayed. In this case, bits 6 and 7 of the window flags determine which sign to display. On exit, A holds the window flags (with bit 5 set if the lights are out, reset otherwise), and the zero flag is reset if the play area location contains part of the right-hand window of a pair.
Input
A | T value, rotated left once
DE | Address of the window flags
F7DA | BIT 3,A | Reset the zero flag if we're dealing with a tile for the right-hand window of a pair
F7DC | LD A,(DE) | A=window flags
F7DD | PUSH AF | Save the window flags briefly
F7DE | SET 7,E | Point DE at the entry in the table at FFC0 that corresponds to the window's location
F7E0 | LD D,$FF
F7E2 | LD A,(DE) | Pick up the entry from the table
F7E3 | LD E,A | Point DE at the blown fuse delay counter for the fuse that affects the window (if any; see 7FA2)
F7E4 | LD D,$7F
F7E6 | LD A,(DE) | Pick up the blown fuse delay counter
F7E7 | AND A | Is the fuse currently blown?
F7E8 | JR Z,$F7EE | Jump if not
F7EA | POP AF | Restore the window flags to A
F7EB | SET 5,A | Signal: the lights are out (because the fuse is blown)
F7ED | RET |
F7EE | POP AF | Restore the window flags to A
F7EF | RET |