Sherlock: annotated disassembly

Routines

Prev: E1B2 Up: Map Next: E22A
E1D6: Action record: default for TELL and TELL ABOUT (verbs 47 and 48)
The interview table at E22A: the actor is looked up (E207), then the topic (E201); a match prints that entry's reply (6830 with the entry's message as its parameter), otherwise 'I AM SORRY I CANNOT HELP YOU WITH THAT' (761D).
Input
$A036 The actor
$A035 The topic
Output
F NZ; the answer printed, or the refusal if there is none
E1D6 DEFB $0D,$17 Action record header: flags $0D; byte 1 $17
E1D8 LD A,($A036) The actor ($A036)...
E1DB CALL $E207 ...looked up in the list at E22A (E207)
E1DE JR Z,$E1FC Not there: message 761D
E1E0 INC IX Step IX on to the next byte - Next entry: the indirect object ($A035) is searched for (E201)
E1E2 LD A,($A035) Read $A035 in "Game variables" into A
E1E5 CALL $E201 Call E201 (inside "Action record: default for TELL and TELL...")
E1E8 JR Z,$E1FC Not there: message 761D
E1EA LD L,(IX+$01) Read byte +1 of the record at IX into L - HL = the entry's word at +1/+2
E1ED LD H,(IX+$02) Read byte +2 of the record at IX into H
E1F0 PUSH AF Save AF on the stack
E1F1 PUSH HL Save HL on the stack
E1F2 LD HL,$6830 Point HL at the message "YOU SAY TO THE OIL LAMP" W" (6830) - Print 6830 with it as a parameter
E1F5 CALL $A59F Call the routine "Print the message at HL" (A59F)
E1F8 POP AF Restore AF from the stack
E1F9 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Return NZ
E1FB RET Return to the caller
This entry point is used by the routine at E1B2.
E1FC LD HL,$761D Point HL at the message "I AM SORRY I CANNOT HELP YOU WITH THAT." (761D)
E1FF JR $E1F0 Go back to E1F0
E201 CALL $D34E Call the routine "Find a 3-byte record by id, in a sentinel-terminated..." (D34E) - Search the thing table (D34E) and test the result against $FF
E204 CP $FF Compare A with $FF
E206 RET Return to the caller
E207 LD IX,$E22A IX = the id list at E22A
E20B CP (IX+$00) Compare A with the first byte of the record at IX - Compare A with each id; a match goes to E1F9
E20E JR Z,$E1F9 If A equals the first byte of the record at IX, go back to E1F9
E210 PUSH AF Save AF on the stack
E211 LD A,(IX+$00) Read the first byte of the record at IX into A
E214 CP $FE Compare A with $FE - $FE entry: go to E1F8
E216 JR Z,$E1F8 If A equals $FE, go back to E1F8
E218 INC A Add one to A
E219 JR Z,$E227 $FF entry (the end): none matched, return A = 0
E21B INC IX Step IX on to the next byte - Otherwise step on and search the table for the entry (D34E)
E21D LD A,$FF Load A with $FF
E21F CALL $D34E Call the routine "Find a 3-byte record by id, in a sentinel-terminated..." (D34E)
E222 INC IX Step IX on to the next byte
E224 POP AF Restore AF from the stack
E225 JR $E20B Go back to E20B
E227 POP AF Restore AF from the stack
E228 XOR A Set A to zero, which sets the zero flag for the caller
E229 RET Return to the caller
Prev: E1B2 Up: Map Next: E22A