Sherlock: annotated disassembly

Routines

Prev: DD52 Up: Map Next: DD84
DD61: Action record: find the exit to a room next door (RUN at $DD54)
Addresses named in the title: DD54.
The pre-check takes the direct object as a room number, finds the exit from the actor's room to it (D471) and refuses if there is none or if the exit is not a plain movement direction (a value below 11); the body stores that direction in plan register 9FD7. Used by the walk-to-a-room sub-script at DD52, which then DOes the direction.
Input
IX The exit found by the pre-check
Output
$9FD7 The exit's direction
F NZ
DD61 DEFB $64,$00,$6E,$DD Action record header: flags $64; bit 5: test D078 first; bit 6: pre-check at DD6E; byte 1 $00
DD65 LD A,(IX+$00) Read the first byte of the record at IX into A - IX = the exit found by the pre-check; its direction (+0) becomes the plan's direction
DD68 LD ($9FD7),A Store A in the plan's direct object (9FD7)
DD6B OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Succeed
DD6D RET Return to the caller
DD6E LD A,($A034) Read $A034 in "Game variables" into A - Pre-check: the direct object is a room; find the exit to it next to the actor (D471)
DD71 CALL $D471 Call D471 (inside "Find the exit from the actor's room through...")
DD74 CP $FF Compare A with $FF
DD76 JP Z,$DC15 No such exit: refuse (DC15)
DD79 LD A,(IX+$00) Read the first byte of the record at IX into A - Its direction must be below 11, a compass direction (not UP or DOWN...)
DD7C CP $0B Compare A with $0B
DD7E JP NC,$DC15 If A is $0B or more, go back to the routine "Fail: A = 0, HL = 0, Z set" (DC15) - Otherwise refuse
DD81 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
DD83 RET Return to the caller
Prev: DD52 Up: Map Next: DD84