Sherlock: annotated disassembly

Routines

Prev: DC15 Up: Map Next: DC57
DC19: Action record: default for verb 35 (LOOK THROUGH)
LOOK THROUGH <door>: after the pre-check at DC6C, finds the exit through the door (D46C); if it leads to a room (+2), moves the actor there for a moment (DD0B), describes the room with 'YOU CAN SEE' instead of 'YOU ARE' (D0DC = 1, D1B2) and moves it back. LOOK THROUGH WINDOWS gets YOU CANNOT LOOK THROUGH THE WINDOW, LOOK THROUGH DOOR asks WHICH DOOR ?. The record's first seven bytes are header and arguments, not code.
You can see a hall.' - this is the only way found to run the body, so the door must be open.
Input
$A034 The door
Output
F NZ (done); the room beyond described as seen through the door
DC19 DEFB $1B,$20,$40,$28,$00,$00,$00 Action record header: flags $1B; bit 4: five extra bytes; byte 1 $20
DC20 CALL $DC6C Call DC6C (inside "Action record: default for verb 28 (GO...") - Pre-check (DC6C): fail if not a door
DC23 RET NZ If the zero flag is clear, return
DC24 LD A,($A034) Read $A034 in "Game variables" into A - A = the door; find its exit (D46C)
DC27 CALL $D46C Call the routine "Find the exit from the actor's room through door A..." (D46C)
DC2A LD A,(IX+$02) Read byte +2 of the record at IX into A - +2: the room beyond (none: just succeed)
DC2D AND A Test A for zero (this leaves A as it was and clears carry)
DC2E JR Z,$DC4B If A is zero, skip ahead to DC4B
DC30 LD B,A Copy A into B
DC31 LD A,($A00A) Read the current actor's room (A00A) into A - Remember the current room
DC34 PUSH AF Save AF on the stack
DC35 LD A,$01 Load A with $01 - 'YOU CAN SEE' wording on (D0DC)
DC37 LD ($D0DC),A Store A in "Set to use 'YOU CAN SEE' instead of 'YOU ARE ...'" (D0DC)
DC3A CALL $DD0B Move the actor to the room beyond for a moment (DD0B, B = the room)
DC3D LD A,($A00A) Read the current actor's room (A00A) into A - Describe the room it is in now (D1B2)
DC40 CALL $D1B2 Call the routine "Describe room A briefly (a room seen before)" (D1B2)
DC43 POP BC Restore BC from the stack
DC44 CALL $DD0B Call DD0B (inside "Default action: move in a direction (verbs...") - Move back to the room it was in
DC47 XOR A Clear A to zero (and the carry flag)
DC48 LD ($D0DC),A Store A in "Set to use 'YOU CAN SEE' instead of 'YOU ARE ...'" (D0DC) - Wording back to normal
DC4B OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
DC4D RET Return to the caller
DC4E LD A,($A034) Read $A034 in "Game variables" into A
DC51 CALL $D46C Call the routine "Find the exit from the actor's room through door A..." (D46C)
DC54 JP $DCDD Jump on to DCDD
Prev: DC15 Up: Map Next: DC57