Sherlock: annotated disassembly

Routines

Prev: DED9 Up: Map Next: DF40
DF02: Action record: default for verb 26 (GIVE TO): hand the object over
The pre-check (DF24) asks whether the receiver ($A035) can carry the object as well as what it holds (C8C6). The body makes the receiver the object's holder (+1), puts the object in the receiver's room (+15) and moves everything inside it there too (D249).
GIVE MONEY TO CABBIE hands over the entire purse (thing 27): INVENTORY shows no money afterwards and the cabbie keeps asking for his fare. Use PAY n TO instead (E370).
Input
$A013 The object's record
$A015 The receiver's record
Output
F NZ; the receiver holds the object, in the receiver's room
DF02 DEFB $6A,$1D,$24,$DF Action record header: flags $6A; bit 5: test D078 first; bit 6: pre-check at DF24; byte 1 $1D
DF06 LD IY,($A015) Read the direct and indirect objects' records ($A015) into IY - IY = the receiver's record, IX = the object's
DF0A LD IX,($A013) Read $A013 in "Game variables" into IX
DF0E LD A,($A035) Read $A035 in "Game variables" into A - The receiver holds it now
DF11 LD (IX+$01),A Store A in byte +1 of the record at IX
DF14 LD A,(IY+$0F) Read byte +15 of the record at IY into A - and it is in the receiver's room
DF17 LD (IX+$0F),A Store A in byte +15 of the record at IX
DF1A LD B,A Copy A into B
DF1B LD A,($A034) Read $A034 in "Game variables" into A - with everything inside it (D249)
DF1E CALL $D249 Call the routine "Move everything inside thing A, at any depth, to room..." (D249)
DF21 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Succeed
DF23 RET Return to the caller
DF24 LD A,($A034) Read $A034 in "Game variables" into A - Pre-check: can the receiver carry it as well? (C8C6)
DF27 LD B,A Copy A into B
DF28 LD A,($A035) Read $A035 in "Game variables" into A
DF2B JP $C8C6 Go back to the routine "Can the actor carry object A as well as what it..." (C8C6)
DF2E LD A,($A034) Read $A034 in "Game variables" into A - Pre-check: is the object held by a person (C8AF)?
DF31 CALL $C8AF Call the routine "Is object A held, at any depth, by a person?" (C8AF)
DF34 JR Z,$DF3D If the zero flag is set, skip ahead to DF3D
DF36 LD HL,$A036 Point HL at $A036 in "Game variables" - By someone other than the actor: refuse
DF39 CP (HL) Compare A with the byte at $A036 in "Game variables"
DF3A JP NZ,$DC15 If A differs from the byte at $A036 in "Game variables", go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15)
DF3D OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Pass
DF3F RET Return to the caller
Prev: DED9 Up: Map Next: DF40