Sherlock: annotated disassembly

Routines

Prev: D60B Up: Map Next: D68C
D671: Step IX to the room's next plain exit (Z at the end)
Skips exits through a door (+1 not 0) and anything that is not a direction 1-10; Z at the $FF end marker.
Input
IX An exit
BC 3
Output
IX The next plain exit
F Z at the end; NZ if found
D671 ADD IX,BC Add BC to IX - (Separate routine) walk the exits from IX: stop with Z at the $FF end...
D673 LD A,$FF Load A with $FF
D675 CP (IX+$00) Compare A with the first byte of the record at IX
D678 RET Z If A equals the first byte of the record at IX, return
D679 XOR A Clear A to zero (and the carry flag) - ...or return NZ at the first plain exit (no thing, a direction 1-10)
D67A CP (IX+$01) Compare A with byte +1 of the record at IX
D67D JR NZ,$D671 If A differs from byte +1 of the record at IX, go back to the routine "Step IX to the room's next plain exit (Z at the..." (D671)
D67F LD A,(IX+$00) Read the first byte of the record at IX into A
D682 AND A Test A for zero (this leaves A as it was and clears carry)
D683 JR Z,$D671 If A is zero, go back to the routine "Step IX to the room's next plain exit (Z at the..." (D671)
D685 CP $0B Compare A with $0B
D687 JR NC,$D671 If A is $0B or more, go back to the routine "Step IX to the room's next plain exit (Z at the..." (D671)
D689 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
D68B RET Return to the caller
Prev: D60B Up: Map Next: D68C