| Routines

30116: Check whether Sam is standing next to a fuse that has not been blown yet

Used by the routines at 29733 and 29866. Returns with the zero flag set if Sam is standing next to a fuse that has not been blown yet.
Input
H | 230 (Sam)
30116 | LD DE,29635 | Point DE at the fuse location table at 29635
30119 | LD L,2 | Point HL at byte 2 of Sam's buffer
30121 | LD BC,1537 | B=6 (there are six fuses), C=1 (fuse identifier)
30124 | LD A,(DE) | A=y-coordinate of a fuse
30125 | INC DE | Point DE at the x-coordinate of the fuse
30126 | CP (HL) | Does the fuse's y-coordinate match Sam's y-coordinate?
30127 | JR NZ,30140 | Jump if not
30129 | DEC L | Point HL at byte 1 of Sam's buffer
30130 | LD A,(DE) | A=x-coordinate of the fuse
30131 | CP (HL) | Compare it with Sam's x-coordinate
30132 | INC HL | Point HL back at byte 2 of Sam's buffer
30133 | JR NZ,30140 | Jump unless Sam is standing next to the fuse
30135 | LD A,(32694) | Collect the fuse flags from 32694
30138 | AND C | Set the zero flag if the fuse has not been blown yet
30139 | RET |
30140 | RLC C | Move the fuse identifier bit in C leftwards
30142 | INC DE | Point DE at the next entry in the fuse location table
30143 | DJNZ 30124 | Jump back until all fuse locations have been checked
30145 | RET |