Sherlock: annotated disassembly

Routines

Prev: D0DC Up: Map Next: D102
D0DD: Get the room's opening: 'YOU ARE ON/IN/AT ...' or 'YOU CAN SEE'
HL = the message to start the description with; for 'YOU ARE' the preposition is chosen from D05A by the room's kind.
Input
A A room number
Output
HL The message to start the description with
AF Kept
D0DD PUSH AF Save AF on the stack - Save A; room record (D224)
D0DE CALL $D224 Call the routine "Find a room record" (D224)
D0E1 LD A,($D0DC) Read "Set to use 'YOU CAN SEE' instead of 'YOU ARE ...'" (D0DC) into A - Test the flag at D0DC
D0E4 AND A Test A for zero (this leaves A as it was and clears carry)
D0E5 LD HL,$68E4 Point HL at the message "YOU CAN SEE" (68E4)
D0E8 JR NZ,$D100 If A is not zero, skip ahead to D100
D0EA LD A,(IX+$00) Read the first byte of the record at IX into A
D0ED AND $0E Keep only bits 1, 2, 3 of A (mask $0E)
D0EF LD E,A Copy A into E
D0F0 LD D,$00 Load D with $00
D0F2 LD HL,$D05A Point HL at "How a room is entered in words: 'You are ON Baker..." (D05A)
D0F5 ADD HL,DE Add DE to HL
D0F6 LD E,(HL) Read the byte HL points at into E
D0F7 INC HL Step HL on to the next byte
D0F8 LD D,(HL) Read the byte HL points at into D
D0F9 EX DE,HL Swap DE and HL
D0FA CALL $D0D0 Call the routine "Put word HL into the 'YOU ARE ...' message" (D0D0)
D0FD LD HL,$68DD Point HL at the message "YOU ARE IN" (68DD)
D100 POP AF Restore AF from the stack
D101 RET Return to the caller
Prev: D0DC Up: Map Next: D102