Sherlock: annotated disassembly

Routines

Prev: A780 Up: Map Next: A7BA
A793: Codes $10, $11 and $13: name someone, then ARE or IS
Names the actor ($10), the direct object ($11) or the person in the next parameter ($13) with A82F, then DE = $007A if it was the player and $0485 if not - ARE and IS - for the interpreter to print: 'you are', 'Watson is'.
Input
$A036 The actor (code $10); $A034 the direct object (code $11); the next parameter (code $13)
Output
DE ARE ($007A) for the player, IS ($0485) otherwise
F NZ for the player; the flags of the compare otherwise
A793 LD A,($A036) Read $A036 in "Game variables" into A - Keep the current actor in A'
A796 EX AF,AF' Swap AF with the shadow copy
A797 XOR A Clear A to zero (and the carry flag)
A798 LD ($A028),A Store A in $A028 in "Game variables" - $A028 = 0 (the thing is the actor); for A7AC, 1 (a thing named by the command)
A79B EX AF,AF' Swap AF with the shadow copy
A79C PUSH AF Save AF on the stack
A79D CALL $A82F Call the routine "Name actor A ($FF: SOMEONE)" (A82F) - Name them (A82F): a thing's name words, or YOU ($080E) for $FF
A7A0 POP AF Restore AF from the stack
A7A1 AND A Z (the player) leaves DE = ARE ($007A)...
A7A2 LD DE,$0485 Load DE with $0485 - ...otherwise IS ($0485)
A7A5 RET NZ If A is not zero, return
A7A6 LD DE,$007A Load DE with $007A
A7A9 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
A7AB RET Return to the caller
A7AC LD A,($A034) Read $A034 in "Game variables" into A - Entry for code $11: the direct object ($A034)
A7AF EX AF,AF' Swap AF with the shadow copy
A7B0 LD A,$01 Load A with $01
A7B2 JR $A798 Go back to A798
A7B4 CALL $A66C Call the routine "Code $01: print the next parameter as a word (and:..." (A66C) - Entry for code $13: the person named in the next parameter (A66C)
A7B7 LD A,D Copy D into A
A7B8 JR $A7AF Go back to A7AF
Prev: A780 Up: Map Next: A7BA