Sherlock: annotated disassembly

Routines

Prev: B308 Up: Map Next: B34F
B32D: Count the candidates for the indirect object
As B308, with B36B, B568 and $B171.
Output
A The number of candidates for the indirect object
Search state kept
B32D LD HL,($B180) Read $B180 in "Parser variables" into HL - Save the search position $B180 (this is a counting pass that must not disturb it)
B330 PUSH HL Save HL on the stack
B331 CALL $B36B Restart the indirect-object search (B36B)
B334 LD A,($B549) Read "B568: $FF until the number in the..." (B549) into A - Save the number flag B549
B337 PUSH AF Save AF on the stack
B338 CALL $B568 Call the routine "The next candidate for the indirect object ($A035)" (B568) - Count every candidate (B568) into $B171
B33B JR Z,$B343 If the zero flag is set, skip ahead to B343
B33D LD HL,$B171 Point HL at $B171 in "Parser variables"
B340 INC (HL) Add one to the byte at $B171 in "Parser variables"
B341 JR $B338 Go back to B338
B343 POP AF Restore AF from the stack - Restore the flag and the position
B344 LD ($B549),A Store A in "B568: $FF until the number in the..." (B549)
B347 LD A,($B171) Read $B171 in "Parser variables" into A - Return the count in A
B34A POP HL Restore HL from the stack
B34B LD ($B180),HL Store HL in $B180 in "Parser variables"
B34E RET Return to the caller
Prev: B308 Up: Map Next: B34F