Sherlock: annotated disassembly

Routines

Prev: D526 Up: Map Next: D590
D57C: The next listable thing in place A (carry at the end)
Steps through the things (D21C) and returns the next for which D4EF says yes.
Input
A A place
Output
A The next thing's id
F Carry set at the end; Z if it is thing 0
D57C POP AF Restore AF from the stack - Next thing in the place (D21C); Z at the end: return with carry set
This entry point is used by the routine at D526.
D57D CALL $D21C Call the routine "Step to the next thing's record (D206), keeping A" (D21C)
D580 JR NZ,$D584 If the zero flag is clear, skip ahead to D584
D582 SCF Set the carry flag for the caller
D583 RET Return to the caller
D584 PUSH AF Save AF on the stack
D585 CALL $D4EF Call the routine "Should this thing be listed here?" (D4EF) - Is it listable (D4EF)? Carry: no, try the next
D588 JR NC,$D57C If the carry flag is clear, go back to the routine "The next listable thing in place A (carry at the..." (D57C)
D58A POP AF Restore AF from the stack
D58B LD A,(IX+$00) Read the number byte (+0) of the thing record at IX into A - Found: A = its id; Z if it is thing 0
D58E AND A Clear the carry flag for the caller (A is unchanged)
D58F RET Return to the caller
Prev: D526 Up: Map Next: D590