Sherlock: annotated disassembly

Routines

Prev: BA13 Up: Map Next: BA60
BA20: A remark for Watson or Inspector Lestrade: let them reply
Reached from B936 when the node waiting for the actor has +7 = 2 (made by B8D1 when the player speaks to someone). For Watson (actor 3) the reply code is at BA67, for Lestrade (2) at BB67; BA3E runs it on the player's words (IY = node +5/+6, through D1DB), then frees the words (A1AF) and the node (B9FA). Other actors ignore remarks.
Input
$A036 The person spoken to (2 Lestrade, 3 Watson)
IX The remark node
Output
F Carry set (the turn is used)
A 1
BA20 LD A,($A036) Who is being spoken to?
BA23 LD HL,$BA67 Point HL at "Watson's reply to something the player says" (BA67) - Watson's reply code
BA26 CP $03 Compare A with $03
BA28 JR Z,$BA31 If A equals $03, skip ahead to BA31
BA2A LD HL,$BB67 Lestrade's reply code
BA2D CP $02 Compare A with $02
BA2F JR NZ,$BA34 Anyone else: ignore it
BA31 CALL $BA3E Let them reply
BA34 LD A,$01 Load A with $01 - Done (carry set: the turn is used)
BA36 POP HL Restore HL from the stack
BA37 POP IY Restore IY from the stack
BA39 POP IX Restore IX from the stack
BA3B AND A Test A for zero (this leaves A as it was and clears carry)
BA3C SCF Set the carry flag for the caller
BA3D RET Return to the caller
BA3E PUSH IX Save IX on the stack - Run reply code HL on the remark at IX
BA40 XOR A Clear A to zero (and the carry flag)
BA41 LD ($9FEB),A Store A in 9FEB in "Game variables"
BA44 LD E,(IX+$05) Read byte +5 of the record at IX into E
BA47 LD D,(IX+$06) Read byte +6 of the record at IX into D
BA4A PUSH DE Save DE on the stack
BA4B PUSH DE Save DE on the stack
BA4C POP IY Restore IY from the stack
BA4E CALL $D1DB Call the routine "Jump to HL" (D1DB)
BA51 POP IX Restore IX from the stack
BA53 PUSH AF Save AF on the stack
BA54 CALL $A1AF Call the routine "Free every node of the list starting at IX" (A1AF) - Free the words
BA57 POP AF Restore AF from the stack
BA58 POP IX Restore IX from the stack
BA5A PUSH AF Save AF on the stack
BA5B CALL $B9FA Call the routine "Remove node IX from the order/remark list and free it" (B9FA) - Remove the remark
BA5E POP AF Restore AF from the stack
BA5F RET Return to the caller
Prev: BA13 Up: Map Next: BA60