Sherlock: annotated disassembly

Routines

Prev: DCD2 Up: Map Next: DD35
DD03: Default action: move in a direction (verbs 1-10)
Shared by all ten direction verbs. The pre-check (DCD2) works out where the actor would end up; the body moves the actor and, when the actor is the one being followed by the display, updates A00A.
The body also stores the destination and its room record at DD01 and DCFF - for ANY actor that moves, not just the player. After the boot sequence they hold room 16 (platform one of Aldergate station), left there by someone moving during the first turns.
Every compass move by every character, including the cook (EAST and WEST between rooms 65 and 68), the gardener (NORTHWEST, SOUTHWEST, NORTHEAST ...) and the player.
How it works:
1. The pre-check (DCD2) finds the exit in the direction (the verb number), and refuses if there is none, the actor is inside something, the destination is 0 or the thing in the way will not let the actor through.
2. The body sets the displayed room if the actor is the one followed, remembers the room entered (DD01) and its record (DCFF).
3.
Input
IX The exit found by the pre-check
Output
F NZ; the actor is in the new room
DD03 DEFB $60,$20,$D2,$DC Action record header: flags $60; bit 5: test D078 first; bit 6: pre-check at DCD2; byte 1 $20
This entry point is used by the routine at DC57.
DD07 LD A,(IX+$02) Read byte +2 of the record at IX into A
DD0A LD B,A Copy A into B
This entry point is used by the routine at DC19.
DD0B LD A,($A036) Read $A036 in "Game variables" into A - The actor
This entry point is used by the routines at 9AF4, 9C41, E2C7, E497 and E4C9.
DD0E PUSH AF Save AF on the stack
DD0F LD HL,$A036 Point HL at $A036 in "Game variables" - Is it the one the display follows?
DD12 CP (HL) Compare A with the byte at $A036 in "Game variables"
DD13 LD A,B Copy B into A
DD14 JR NZ,$DD19 If A differs from the byte at $A036 in "Game variables", skip ahead to DD19
DD16 LD ($A00A),A Store A in the current actor's room (A00A) - Yes: the displayed room changes
DD19 CP $FF Compare A with $FF
DD1B JR NZ,$DD1E If A differs from $FF, skip ahead to DD1E
DD1D XOR A Clear A to zero (and the carry flag)
DD1E LD ($DD01),A Store A in DD01 in "Pre-check for moving in a direction (verbs..." - Remember the room just entered (DD01) and its record (DCFF)
DD21 CALL $D224 Call the routine "Find a room record" (D224)
DD24 LD ($DCFF),IX Store IX in DCFF in "Pre-check for moving in a direction (verbs..."
DD28 POP AF Restore AF from the stack
DD29 CALL $D237 The actor's own record...
DD2C LD (IX+$0F),B Store B in byte +15 of the record at IX - ...location = the new room
DD2F CALL $D249 Call the routine "Move everything inside thing A, at any depth, to room..." (D249)
DD32 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
DD34 RET Return to the caller
Prev: DCD2 Up: Map Next: DD35