Sherlock: annotated disassembly

Routines

Prev: CC0B Up: Map Next: CC29
CC0E: Find the actor record whose id matches C
A plain linear search over the sentinel-terminated array of 8-byte actor/character records at 9860: given an id in C, walks the table 8 bytes at a time until either field +0 matches (found - IY left pointing at that record) or field +0 is $FF (not found).
Input
A An actor number
Output
IY The actor's record, or the $FF end marker if there is none
BC, DE Kept
CC0E PUSH DE Save DE on the stack - Record size is 8 bytes
CC0F PUSH BC Save BC on the stack
CC10 LD C,A Copy A into C
CC11 LD DE,$0008 Load DE with $0008
CC14 LD IY,$9860 IY -> first actor record
CC18 LD A,(IY+$00) This record's id byte...
CC1B CP C ...is it the one we want?
CC1C JR Z,$CC26 If A equals C, skip ahead to CC26
CC1E CP $FF
CC20 JR Z,$CC26 If A equals $FF, skip ahead to CC26
CC22 ADD IY,DE Neither: move to the next record
CC24 JR $CC18 Go back to CC18
CC26 POP BC Restore BC, DE and return
CC27 POP DE Restore DE from the stack
CC28 RET Return to the caller
Prev: CC0B Up: Map Next: CC29