Sherlock: annotated disassembly

Routines

Prev: B4A2 Up: Map Next: B4C1
B4A3: The direct object is a number: use it once
The first time (B4A2 still $FF), if the direct-object slot holds a number (bit 7 of $B173), $A034 = $FE and the number goes to $A02F; after that, or if there is no number, A = $FF: no more candidates. Reached from B4C1 when the requirement code is 5.
Output
F NZ with $A034 = $FE and $A02F the number the first time; Z otherwise
A $FF if there is nothing to search
B4A3 LD A,($B4A2) Read "B4C1: $FF until the number in the direct-object..." (B4A2) into A - B4A2 = $FF means the number has not been used yet; anything else: go on to the thing search (B4CF)
B4A6 INC A Add one to A
B4A7 JR NZ,$B4CF If A is not zero, skip ahead to B4CF
B4A9 LD ($B4A2),A Used now (B4A2 = 0)
B4AC LD A,($B173) Read $B173 in "Parser variables" into A - The slot's first word ($B173): bit 7 set means a number
B4AF BIT 7,A Test bit 7 of A
B4B1 JR Z,$B4CF If bit 7 of A is clear, skip ahead to B4CF
B4B3 LD A,$FE Load A with $FE - The direct object is $FE: a number...
B4B5 LD ($A034),A Store A in $A034 in "Game variables"
B4B8 LD HL,($B172) Read $B172 in "Parser variables" into HL - ...with its value, from the word at $B172, in $A02F
B4BB LD ($A02F),HL Store HL in $A02F in "Game variables"
B4BE OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - NZ: a candidate
B4C0 RET Return to the caller
Prev: B4A2 Up: Map Next: B4C1