Sherlock: annotated disassembly

Routines

Prev: B936 Up: Map Next: B9FA
B98C: Take the command out of an ASK order
The order's verb and objects (+2, +3, +4, resolved by CEDE) become the command; B9FA removes the node.
B9AC-B9F9 belong to the remark path of B936: B9CA hands the remark's remaining words back (node +5/+6) one sentence at a time, freeing what has been used.
Reached from B936 when an actor has been given an order (ASK): the order's verb and objects are turned into the command the actor will run and the order is removed from the list.
The tail from B9AC drops an order's sentences when the order cannot be parsed or an ALL has run out, and B9CA hands back the remark's remaining words one sentence at a time.
Input
IX The ASK order
Output
$A033 The verb
A034 The direct object, A035 the indirect object
B98C LD A,(IX+$02) Read byte +2 of the record at IX into A - The ordered verb
B98F CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
B992 LD ($A033),A Store A in $A033 in "Game variables"
B995 LD A,(IX+$03) Read byte +3 of the record at IX into A - Its direct object
B998 CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
B99B LD ($A034),A Store A in $A034 in "Game variables"
B99E LD A,(IX+$04) Read byte +4 of the record at IX into A - Its indirect object
B9A1 CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
B9A4 LD ($A035),A Store A in $A035 in "Game variables"
B9A7 CALL $B9FA Remove the order from the list
B9AA JR $B983 Go back to B983
B9AC CALL $B9CA Call B9CA (inside "Take the command out of an ASK order") - Unparsable: drop the order's sentences one by one...
B9AF JR NZ,$B9AC If the zero flag is clear, go back to B9AC
B9B1 XOR A Clear A to zero (and the carry flag) - ...and return Z: nothing to do
B9B2 JR $B985 Go back to B985
This entry point is used by the routine at B936.
B9B4 LD A,($A01C) Read $A01C in "Game variables" into A - An ALL that has run out: clear the flag, drop the sentence...
B9B7 AND A Test A for zero (this leaves A as it was and clears carry)
B9B8 JR Z,$B9AC If A is zero, go back to B9AC
B9BA LD IX,($B866) Read "Speech hand-over variables" (B866) into IX
B9BE LD (IX+$02),$00 Set byte +2 of the record at IX to $00
B9C2 CALL $B9CA Call B9CA (inside "Take the command out of an ASK order")
B9C5 JR Z,$B9B1 If the zero flag is set, go back to B9B1
B9C7 JP $B93E ...and try the next one
This entry point is used by the routine at B936.
B9CA LD IX,($B866) Read "Speech hand-over variables" (B866) into IX - Drop the order's current sentence (IY) and any BUT nodes after it
B9CE LD L,(IY-$02) Read byte -2 of the record at IY into L
B9D1 LD H,(IY-$01) Read byte -1 of the record at IY into H
B9D4 LD (IX+$05),L Store L in byte +5 of the record at IX
B9D7 LD (IX+$06),H Store H in byte +6 of the record at IX
B9DA PUSH IX Save IX on the stack
B9DC PUSH IY Save IY on the stack
B9DE POP IX Restore IX from the stack
B9E0 CALL $A1C7 Call the routine "Free node IX back to the heap" (A1C7)
B9E3 POP IX Restore IX from the stack
B9E5 LD A,L Copy L into A - None left: remove the order and return Z
B9E6 OR H Set in A the bits that are set in H
B9E7 JR Z,$B9F5 If the result is zero, skip ahead to B9F5
B9E9 PUSH HL Save HL on the stack
B9EA POP IY Restore IY from the stack
B9EC BIT 6,(IY+$01) Test bit 6 of byte +1 of the record at IY
B9F0 JR NZ,$B9CE If bit 6 of byte +1 of the record at IY is set, go back to B9CE
B9F2 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - More to come: NZ
B9F4 RET Return to the caller
B9F5 CALL $B9FA Call the routine "Remove node IX from the order/remark list and free it" (B9FA)
B9F8 XOR A Set A to zero, which sets the zero flag for the caller
B9F9 RET Return to the caller
Prev: B936 Up: Map Next: B9FA