Sherlock: annotated disassembly

Routines

Prev: D405 Up: Map Next: D46C
D448: Find the actor's exit in a direction
Walks the exits of the actor's room, skipping any whose destination is 0 (scenery exits - described, never usable). Used by the move pre-check DCD2 with the verb number as the direction.
Input
A Direction (1-10, the verb number)
Output
IX The exit (direction, thing in the way, destination)
A $FF if there is no usable exit that way
D448 PUSH DE Save DE on the stack
D449 PUSH BC Save BC on the stack
D44A PUSH IY Save IY on the stack
D44C LD B,A B = direction
D44D CALL $D33C The actor's room record...
D450 LD DE,$0006 Load DE with $0006, the amount that is added next
D453 ADD IX,DE ...+6, so the first step lands on the exits at +9
D455 CALL $D206 Call the routine "Step to the next 3-byte entry" (D206) - Next exit (Z: no more)
D458 JR Z,$D467 If the zero flag is set, skip ahead to D467
D45A LD A,(IX+$02) Read byte +2 of the record at IX into A - Destination 0?
D45D AND A Test A for zero (this leaves A as it was and clears carry)
D45E JR Z,$D455 ...a scenery exit: skip it
D460 LD A,(IX+$00) Read the first byte of the record at IX into A - The right direction?
D463 CP B Compare A with B
D464 JP NZ,$D455 If A differs from B, go back to D455
D467 POP IY Restore IY from the stack
D469 POP BC Restore BC from the stack
D46A POP DE Restore DE from the stack
D46B RET Return to the caller
Prev: D405 Up: Map Next: D46C