Sherlock: annotated disassembly

Routines

Prev: CE83 Up: Map Next: CEB8
CE8F: A plan instruction succeeded: move on
Skips the instruction (CF03). With bit 7 set, the script position becomes the success address; otherwise, with bit 4 set, the failure address is skipped. With bit 5 set the instruction is erased (CF43). Then back to the main loop (CD91 saves the plan registers), which ends the actor's turn if the action took time.
Output
The script position moved on and the turn ended ($CD91)
CE8F CALL $CE83 The instruction just run
CE92 CALL $CF03 Skip it
CE95 BIT 7,(IX+$00) Test bit 7 of the first byte of the record at IX - Has it a success address?
CE99 JR Z,$CEA1 If bit 7 of the first byte of the record at IX is clear, skip ahead to CEA1
CE9B LD E,(HL) Read the byte HL points at into E - Yes: go there
CE9C INC HL Step HL on to the next byte
CE9D LD D,(HL) Read the byte HL points at into D
CE9E EX DE,HL Swap DE and HL
CE9F JR $CEA8 Skip ahead to CEA8
CEA1 BIT 4,(IX+$00) Test bit 4 of the first byte of the record at IX - No: skip any failure address
CEA5 CALL NZ,$CF40 If bit 4 of the first byte of the record at IX is set, call CF40 (inside "Skip past a plan instruction")
CEA8 BIT 5,(IX+$00) One-shot?
CEAC CALL NZ,$CF43 Yes: erase it
CEAF LD (IY+$01),L Store L in byte +1 of the record at IY - Store the new script position
CEB2 LD (IY+$02),H Store H in byte +2 of the record at IY
CEB5 JP $CD91 End the turn
Prev: CE83 Up: Map Next: CEB8