Sherlock: annotated disassembly

Routines

Prev: 9CA2 Up: Map Next: 9CE9
9CCE: Is thing C in the same room as the current actor, and visible to the player?
Z if C is in the actor's room ($A017's +$0F) and the player can see it (C821); NZ otherwise.
Input
C The thing number
Output
F Z if the thing is in the actor's room and the player can see it; NZ if not
B The room of the actor ($A017)
IX The thing's record
9CCE LD IX,($A017) Read $A017 in "Game variables" into IX - B = the room of the actor's own record ($A017)
9CD2 LD B,(IX+$0F) Read the rooms byte (+15) of the thing record at IX into B
9CD5 LD A,C Copy C into A
9CD6 CALL $D237 Call the routine "Resolve an id (in A) to its full entity record" (D237) - IX = thing C: is it in the same room? If not, return NZ
9CD9 LD A,(IX+$0F) Read the rooms byte (+15) of the thing record at IX into A
9CDC CP B Compare A with B
9CDD RET NZ If A differs from B, return
9CDE LD A,C Copy C into A - Same room: can the player see it (C821 with A = C)?
9CDF CALL $C821 Call the routine "Can the current actor ($A036) see thing A?" (C821)
9CE2 JR Z,$9CE6 Not visible: NZ
9CE4 XOR A Set A to zero, which sets the zero flag for the caller - Visible: Z
9CE5 RET Return to the caller
9CE6 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
9CE8 RET Return to the caller
Prev: 9CA2 Up: Map Next: 9CE9