Sherlock: annotated disassembly

Routines

Prev: DD03 Up: Map Next: DD52
DD35: Can the actor get past the thing in an exit?
Nothing in the way (A = 0) always lets the actor through. Otherwise the thing must be open - +5 bit 5, or bit 3 - and its size (+2) must be at least the actor's size (IY+2).
This is how guards work: the local police men at Browns and Jones front gates are themselves the 'door' of the exit they stand in. They are 'open' (bit 5) with size 69, smaller than the player (96) and Watson (96), so neither can pass, while Lestrade (32) could. The hidden door into the opium den (85) and the front door between Camden Street and the entrance hall (32) are narrower than the player too.
Input
A The thing in the way (0 = nothing)
IY The actor
Output
F Z set if the actor can pass
DD35 AND A Nothing in the way...
DD36 RET Z If A is zero, return - ...pass
DD37 PUSH IX Save IX on the stack
DD39 CALL $D237 The thing's record
DD3C LD A,(IX+$05) Read the flags byte (+5) of the thing record at IX into A - Open?
DD3F AND $28 Keep only bits 3, 5 of A (mask $28)
DD41 LD A,(IX+$02) Read the size byte (+2) of the thing record at IX into A - Its size
DD44 POP IX Restore IX from the stack
DD46 JR Z,$DD4F Not open: refuse
DD48 CP (IY+$02) At least the actor's size?
DD4B JR C,$DD4F Too small: refuse
DD4D XOR A Set A to zero, which sets the zero flag for the caller - Pass (Z)
DD4E RET Return to the caller
DD4F OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Refuse (NZ)
DD51 RET Return to the caller
Prev: DD03 Up: Map Next: DD52