Sherlock: annotated disassembly

Routines

Prev: D4CC Up: Map Next: D51A
D4EF: Should this thing be listed here?
In the place, not the actor itself, visible to the player (C821), and in exactly one location (so not a door).
Input
A A place
IX A thing's list entry
IY Its record
Output
F Carry set if it should be listed
D4EF CP (IY+$01) Compare A with the holder byte (+1) of the thing record at IY - Is the thing's holder (IX+1) the one this listing is for?
D4F2 JR NZ,$D518 If A differs from the holder byte (+1) of the thing record at IY, skip ahead to D518
D4F4 LD A,($A036) Read $A036 in "Game variables" into A - Not the actor's own record
D4F7 CP (IX+$00) Compare A with the number byte (+0) of the thing record at IX
D4FA JR Z,$D518 If A equals the number byte (+0) of the thing record at IX, skip ahead to D518
D4FC LD A,(IX+$00) Read the number byte (+0) of the thing record at IX into A - And the actor can see it (C821)
D4FF CALL $C821 Call the routine "Can the current actor ($A036) see thing A?" (C821)
D502 JR Z,$D518 If the zero flag is set, skip ahead to D518
D504 LD A,(IY+$00) Read the number byte (+0) of the thing record at IY into A - Its room count (+0) below 2: only a thing in one or no room
D507 CP $02 Compare A with $02
D509 JR NC,$D518 If A is $02 or more, skip ahead to D518
D50B LD A,($A036) Read $A036 in "Game variables" into A - Is the actor inside the thing, at any depth? (D278: carry if so)
D50E PUSH IX Save IX on the stack
D510 POP HL Restore HL from the stack
D511 CALL $D278 Call D278 (inside "Is thing A carried by the actor, perhaps...")
D514 JR C,$D518 If the carry flag is set, skip ahead to D518
D516 SCF Set the carry flag for the caller - Not inside it: list it (carry set)
D517 RET Return to the caller
D518 AND A Clear the carry flag for the caller (A is unchanged) - No (carry clear)
D519 RET Return to the caller
Prev: D4CC Up: Map Next: D51A