Sherlock: annotated disassembly

Routines

Prev: B54A Up: Map Next: B5A4
B568: The next candidate for the indirect object ($A035)
Addresses named in the title: $A035.
As B4C1, for the second slot ($B178, $B180, $A031, and $A010's requirement code).
Output
A The next candidate for the indirect object ($A035); $FF if none
F Z when none
IX Saved at $B180
B568 LD A,($A010) Read $A010 in "Game variables" into A - Requirement code 5 (a number): the number is the only candidate
B56B CP $05 Compare A with $05
B56D JR Z,$B54A If A equals $05, go back to the routine "The indirect object is a number: use it once" (B54A)
B56F LD A,($B179) Read $B179 in "Parser variables" into A - Bit 7 of the slot's word count set: no more candidates (A = $FF)
B572 BIT 7,A Test bit 7 of A
B574 JR Z,$B57B If bit 7 of A is clear, skip ahead to B57B
This entry point is used by the routine at B54A.
B576 LD A,$FF Load A with $FF
B578 CP $FF Compare A with $FF
B57A RET Return to the caller
B57B PUSH IY Save IY on the stack - IX = where the last search stopped ($B180)
B57D LD IX,($B180) Read $B180 in "Parser variables" into IX
B581 LD A,($A01D) Read $A01D in "Game variables" into A - Need it be here? ($A01D bit 0 -> $A038)
B584 AND $01 Isolate bit 0 of A (mask $01)
B586 LD ($A038),A Store A in $A038 in "Game variables"
B589 LD A,($A010) Read $A010 in "Game variables" into A - Code below 5 (a room): search the rooms (D39B)...
B58C CP $05 Compare A with $05
B58E LD IY,$D39B Point IY at "Find the next room that matches a word slot of..." (D39B)
B592 JR C,$B598 If A is below $05, skip ahead to B598
B594 LD IY,$D36A ...otherwise the things (D36A)
B598 CALL $B5A4 Call the routine "Next thing or room the indirect-object slot names" (B5A4) - Next match; A = $FF if there is none
B59B CP $FF Compare A with $FF
B59D LD ($B180),IX Store IX in $B180 in "Parser variables" - Remember where it stopped
B5A1 POP IY Restore IY from the stack
B5A3 RET Return to the caller
Prev: B54A Up: Map Next: B5A4