Sherlock: annotated disassembly

Routines

Prev: F380 Up: Map Next: F3A2
F389: Code after a plan script ($F389)
The pre-check of the checks-only record at F380 (flags $C8, bit 6). It tests the direct object ($A013): its holder (+1) must equal the actor's id less 1, and the actor must not be the direct object itself; otherwise it refuses (DC15).
Input
$A013 The direct object's record
Output
F NZ if it is held by the actor's number less 1 and is not the actor; otherwise $DC15
F389 LD IX,($A013) IX = the direct object's record
F38D LD A,($A036) Read $A036 in "Game variables" into A - Its holder (+1) must be the actor's number less 1; else refuse (DC15)
F390 DEC A Subtract one from A
F391 CP (IX+$01) Compare A with byte +1 of the record at IX
F394 JP NZ,$DC15 If A differs from byte +1 of the record at IX, go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
F397 LD HL,$A034 Point HL at $A034 in "Game variables" - And the actor must not be the direct object itself
F39A INC A Add one to A
F39B CP (HL) Compare A with the byte at $A034 in "Game variables"
F39C JP Z,$DC15 If A equals the byte at $A034 in "Game variables", go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
F39F OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Pass
F3A1 RET Return to the caller
Prev: F380 Up: Map Next: F3A2