| Routines

F6B0: Check whether a character is standing next to a light switch or window blind

Used by the routines at 758C and F6E9. Returns with the zero flag reset if the character is standing next to a light switch or a window that has a blind, and with the bit set in A identifying the fixture that was found.
Input
H | Character number (0xD7-0xE6)
F6B0 | LD L,$04 | Point HL at byte 0x04 of the character's buffer
F6B2 | BIT 0,(HL) | Is the character indoors?
F6B4 | RET Z | Return if not
F6B5 | CALL $F6A2 | Collect in C the x-coordinate of the front column of the character's sprite
F6B8 | LD B,$80 | Bit 7 set: check for a light switch at the left side of the room
F6BA | JR Z,$F6D0 | Jump if C=0 mod 8
F6BC | LD B,$10 | Bit 4 set: check for a blind on the left-hand window
F6BE | SUB $03 | Does C=1 or 2 mod 8?
F6C0 | JR C,$F6D0 | Jump if so
F6C2 | LD B,$04 | Bit 2 set: check for a blind on a large central window
F6C4 | SUB $02 | Does C=3 or 4 mod 8?
F6C6 | JR C,$F6D0 | Jump if so
F6C8 | LD B,$08 | Bit 3 set: check for a blind on the right-hand window
F6CA | SUB $02 | Does C=5 or 6 mod 8?
F6CC | JR C,$F6D0 | Jump if so
F6CE | LD B,$40 | Bit 6 set: check for a light switch at the right side of the room (when C=7 mod 8)
F6D0 | PUSH BC | Save the fixture identifier bit (in B)
F6D1 | CALL $F454 | Is the character standing next to a light switch or a window that has a blind?
F6D4 | JR NZ,$F6D9 | Jump if so
F6D6 | POP AF | Restore the fixture identifier bit to A (though we don't need it now)
F6D7 | XOR A | Set the zero flag
F6D8 | RET |
F6D9 | POP AF | Restore the fixture identifier bit to A
F6DA | AND A | Reset the zero flag
F6DB | RET |