Sherlock: annotated disassembly

Routines

Prev: CF80 Up: Map Next: D045
D008: Load the current actor's plan registers
IY = the actor's record in the table at 9860. Copies the actor's saved plan registers into 9FD6 (the plan's verb) and 9FD7/9FD8 (its direct and indirect objects) - from the actor record's +3, +4 and +5, or, when the actor is inside a sub-script, from the call frame CFB6 finds (+6, +3 and +4). Script arguments $FA, $FD and $FC read these registers (see CEDE). D026 is the matching save.
Input
IY The actor's record
Output
$9FD6 The plan's verb
$9FD7 Its objects
D008 LD L,(IY+$04) Read byte +4 of the record at IY into L - HL = the actor's own saved objects
D00B LD H,(IY+$05) Read byte +5 of the record at IY into H
D00E CALL $CFB6 Is it inside a sub-script?
D011 LD A,(IY+$03) A = its own saved verb
D014 JR Z,$D01F No: use the actor record's
D016 LD L,(IX+$03) Read byte +3 of the record at IX into L - Yes: use the call frame's objects...
D019 LD H,(IX+$04) Read byte +4 of the record at IX into H
D01C LD A,(IX+$06) ...and verb
D01F LD ($9FD6),A The plan's verb
D022 LD ($9FD7),HL Store HL in the plan's direct object (9FD7) - The plan's direct and indirect objects
D025 RET Return to the caller
This entry point is used by the routine at CD82.
D026 LD HL,($9FD7) Save side: the plan's objects
D029 CALL $CFB6 Inside a sub-script?
D02C LD A,($9FD6) Read the plan's verb (9FD6) into A
D02F JR Z,$D03B No: save into the actor record
D031 LD (IX+$03),L Store L in byte +3 of the record at IX - Yes: save into the call frame
D034 LD (IX+$04),H Store H in byte +4 of the record at IX
D037 LD (IX+$06),A Store A in byte +6 of the record at IX
D03A RET Return to the caller
D03B LD (IY+$03),A Store A in byte +3 of the record at IY - Save into the actor record
D03E LD (IY+$04),L Store L in byte +4 of the record at IY
D041 LD (IY+$05),H Store H in byte +5 of the record at IY
D044 RET Return to the caller
Prev: CF80 Up: Map Next: D045