Sherlock: annotated disassembly

Routines

Prev: CDBF Up: Map Next: CE83
CE18: Plan opcodes 1, 2, 3 and 7: DO a command or RUN a record
CE18 (opcode 2): verb, direct and indirect object from the instruction, through CEDE, then C4D1 runs the command. CE3B (7) and CE4F (3): run the action record named in the instruction directly (C591), with or without objects. CE6A (1): a verb alone. In each case carry back from the command means a sub-script was called (the script position has already moved), Z means it failed and NZ means it succeeded.
Input
IX The instruction
Output
The command or record run; the step succeeds, fails or starts a sub-script
CE18 LD A,(IX+$01) Read byte +1 of the record at IX into A - The verb
CE1B CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
CE1E LD ($A033),A Store A in $A033 in "Game variables"
CE21 LD A,(IX+$02) Read byte +2 of the record at IX into A - The direct object
CE24 CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
CE27 LD ($A034),A Store A in $A034 in "Game variables"
CE2A LD A,(IX+$03) Read byte +3 of the record at IX into A - The indirect object
CE2D CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
CE30 LD ($A035),A Store A in $A035 in "Game variables"
CE33 CALL $C4D1 Carry out the command
CE36 RET C A sub-script was entered: done
CE37 JR Z,$CEB8 Refused: the instruction fails
CE39 JR $CE8F Done: it succeeds
This entry point is used by the routine at CC78.
CE3B LD A,(IX+$03) Read byte +3 of the record at IX into A - RUN with objects: the direct object...
CE3E CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
CE41 LD ($A034),A Store A in $A034 in "Game variables"
CE44 LD A,(IX+$04) Read byte +4 of the record at IX into A - ...and the indirect object
CE47 CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
CE4A LD ($A035),A Store A in $A035 in "Game variables"
CE4D JR $CE57 Skip ahead to CE57
This entry point is used by the routine at CC78.
CE4F LD A,$FF Load A with $FF - RUN without objects
CE51 LD ($A034),A Store A in $A034 in "Game variables"
CE54 LD ($A035),A Store A in $A035 in "Game variables"
CE57 LD A,$FF Load A with $FF - No verb
CE59 LD ($A033),A Store A in $A033 in "Game variables"
CE5C LD L,(IX+$01) Read byte +1 of the record at IX into L - HL = the action record
CE5F LD H,(IX+$02) Read byte +2 of the record at IX into H
CE62 CALL $C591 Run it
CE65 RET C A sub-script was entered: done
CE66 JR Z,$CEB8 Refused: fail
CE68 JR $CE8F Done: succeed
This entry point is used by the routine at CC78.
CE6A LD A,(IX+$01) Read byte +1 of the record at IX into A - DO verb: the verb
CE6D CALL $CEDE Call the routine "Resolve a plan argument byte" (CEDE)
CE70 LD ($A033),A Store A in $A033 in "Game variables"
CE73 LD A,$FF Load A with $FF - No objects
CE75 LD ($A034),A Store A in $A034 in "Game variables"
CE78 LD ($A035),A Store A in $A035 in "Game variables"
CE7B CALL $C4D1 Carry out the command
CE7E RET C If the carry flag is set, return
CE7F JR Z,$CEB8 If the zero flag is set, jump on to the routine "A plan instruction failed: move on and try again..." (CEB8)
CE81 JR $CE8F Skip ahead to the routine "A plan instruction succeeded: move on" (CE8F)
Prev: CDBF Up: Map Next: CE83