Prev: CC0B Up: Map Next: CC29
CC0E: Find Character
Searches the timetable at Table_Timetable for the character id in A.
Input
A Character ID
Output
A The character ID or FF if it wasn't found
IY Pointer to character data
F The zero flag will be set if the character wasn't found
Stash some registers so they don't get corrupted.
FindCharacter CC0E PUSH DE Store the character ID in C, saving source and the count.
CC0F PUSH BC
CC10 LD C,A
CC11 LD DE,$0008 Use the timetable at Table_Timetable.
CC14 LD IY,$9860
FindCharacter_Loop CC18 LD A,(IY+$00) Fetch the current characters ID from the timetable pointer.
CC1B CP C Go to FindCharacter_Return if this timetable entry is the wanted character.
CC1C JR Z,FindCharacter_Return
CC1E CP $FF Go to FindCharacter_Return if it is FF.
CC20 JR Z,FindCharacter_Return
CC22 ADD IY,DE Add 08 bytes to the timetable pointer to move to the next set of character data.
CC24 JR FindCharacter_Loop Go back for the next character pair.
Return.
Return with some housekeeping.
FindCharacter_Return CC26 POP BC Restore the saved count and the saved source from the stack.
CC27 POP DE
CC28 RET Return.
Prev: CC0B Up: Map Next: CC29