Sherlock: annotated disassembly

Routines

Prev: CEB8 Up: Map Next: CEFE
CEDE: Resolve a plan argument byte
Values below $F5, and $FE/$FF, are used as they are. $FA = the plan's verb (9FD6), $FB = the actor itself ($A036), $FC = the plan's indirect object (9FD8); $FD and the unused $F5-$F9 = the plan's direct object (9FD7).
Input
A An argument byte
Output
A The value it stands for
CEDE CP $F5 Compare A with $F5 - An ordinary value?
CEE0 RET C If A is below $F5, return
CEE1 CP $FE Compare A with $FE - $FE or $FF: also as it is
CEE3 RET NC If A is $FE or more, return
CEE4 CP $FA Compare A with $FA - $FA: the plan's verb
CEE6 JR NZ,$CEEC If A differs from $FA, skip ahead to CEEC
CEE8 LD A,($9FD6) Read the plan's verb (9FD6) into A
CEEB RET Return to the caller
CEEC CP $FB Compare A with $FB - $FB: the actor itself
CEEE JR NZ,$CEF4 If A differs from $FB, skip ahead to CEF4
CEF0 LD A,($A036) Read $A036 in "Game variables" into A
CEF3 RET Return to the caller
CEF4 CP $FC Compare A with $FC - $FC: the plan's indirect object
CEF6 LD A,($9FD8) Read the plan's indirect (9FD8) into A
CEF9 RET Z If A equals $FC, return
CEFA LD A,($9FD7) Read the plan's direct object (9FD7) into A - Otherwise its direct object
CEFD RET Return to the caller
Prev: CEB8 Up: Map Next: CEFE