Prev: 52235 Up: Map Next: 52265
52238: Find Character
Searches the timetable at Table_Timetable for the character id in A.
Input
A Character ID
Output
A The character ID or 255 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 52238 PUSH DE Store the character ID in C, saving source and the count.
52239 PUSH BC
52240 LD C,A
52241 LD DE,8 Use the timetable at Table_Timetable.
52244 LD IY,39008
FindCharacter_Loop 52248 LD A,(IY+0) Fetch the current characters ID from the timetable pointer.
52251 CP C Go to FindCharacter_Return if this timetable entry is the wanted character.
52252 JR Z,FindCharacter_Return
52254 CP 255 Go to FindCharacter_Return if it is 255.
52256 JR Z,FindCharacter_Return
52258 ADD IY,DE Add 8 bytes to the timetable pointer to move to the next set of character data.
52260 JR FindCharacter_Loop Go back for the next character pair.
Return.
Return with some housekeeping.
FindCharacter_Return 52262 POP BC Restore the saved count and the saved source from the stack.
52263 POP DE
52264 RET Return.
Prev: 52235 Up: Map Next: 52265