| Routines

714C: Check whether a character is immobilised by a blown fuse

Used by the routine at F1FC. Returns with the carry flag set if the character is in an area affected by a blown fuse.
Input
H | Character number (0xD7-0xE5)
714C | LD L,$04 | Point HL at byte 0x04 of the character's buffer
714E | BIT 0,(HL) | Is the character indoors?
7150 | RET Z | Return if not
7151 | LD L,$01 | Point HL at byte 0x01 of the character's buffer
7153 | LD A,(HL) | A=character's x-coordinate
7154 | INC A | Point DE at the entry in the table at FFC0 that corresponds to the 8-tile wide column of the play area containing the character
7155 | AND $F8
7157 | RRA
7158 | RRA
7159 | RRA
715A | ADD A,$C0
715C | LD E,A
715D | LD D,$FF
715F | LD A,(DE) | Point DE at the delay counter for the fuse that is in the same building as the character (see 7FA2)
7160 | LD E,A
7161 | LD D,$7F
7163 | LD A,(DE) | Pick up the blown fuse delay counter in A
7164 | AND A | Return with the carry flag reset if there is no fuse here, or the fuse is not currently blown
7165 | RET Z
7166 | INC L | L=0x02
7167 | LD A,E | A=0xA2-0xA7
7168 | LD E,$00 | For no. 74 or the hotel, use this y-coordinate for comparison (the roofs of these buildings are inaccessible)
716A | CP $A4 | Is it the fuse at no. 74 or the hotel?
716C | JR C,$7176 | Jump if so
716E | LD E,$10 | For no. 31 or no. 19, use this y-coordinate for comparison (any character on the roof will be unaffected by a blown fuse)
7170 | CP $A6 | Is it the fuse at no. 31 or no. 19?
7172 | JR C,$7176 | Jump if so
7174 | LD E,$0A | For no. 17 or no. 15, use this y-coordinate for comparison (any character on the roof will be unaffected by a blown fuse)
7176 | LD A,E | A=0 (no. 74 or the hotel), 16 (no. 31 or no. 19), or 10 (no. 17 or no. 15)
7177 | CP (HL) | Compare this value with the character's y-coordinate
7178 | RET C | Return with the carry flag set if the character is inside the building (as opposed to on the roof)
7179 | XOR A | Clear the carry flag
717A | RET |