Sherlock: annotated disassembly

Routines

Prev: B191 Up: Map Next: B303
B2DF: Choose the indirect object: the candidate that passes the record's checks
Restarts the indirect-object search (B36B) and tries each candidate (B568) with the record's checks (C929), counting those that pass in $B171 and keeping the last in B185; stops at the first unless $B190 is set. $A035 is left holding the one chosen.
Output
$A035 The first indirect object that passes the record's checks
$B171 How many pass
B2DF CALL $B36B Start the indirect-object search afresh (B36B)
B2E2 CALL $B568 Next indirect-object candidate (B568)
B2E5 JR Z,$B2FC None left: finish
B2E7 CALL $C929 Does it pass the record's checks (C929)?
B2EA JR Z,$B2E2 No: next
B2EC LD A,($A035) Read $A035 in "Game variables" into A - Yes: remember it in B185...
B2EF LD ($B185),A Store A in B185 in "Parser variables"
B2F2 LD HL,$B171 Point HL at $B171 in "Parser variables" - ...and count it in $B171
B2F5 INC (HL) Add one to the byte at $B171 in "Parser variables"
B2F6 LD A,($B190) Read $B190 in "Parser variables" into A - Stop at the first if the verb says so ($B190)
B2F9 AND A Test A for zero (this leaves A as it was and clears carry)
B2FA JR Z,$B2E2 If A is zero, go back to B2E2
B2FC LD A,($B185) Read B185 in "Parser variables" into A - Put the first one found into $A035
B2FF LD ($A035),A Store A in $A035 in "Game variables"
B302 RET Return to the caller
Prev: B191 Up: Map Next: B303