Prev: 52235 Up: Map Next: 52265
52238: Find Character
Used by the routines at 52279 and 56428.
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 corrrupted.
FindCharacter 52238 PUSH DE Stash DE and BC on the stack.
52239 PUSH BC
52240 LD C,A Store the character ID in C.
52241 LD DE,8 Load the length of the character data 0008 bytes into DE.
52244 LD IY,39008 IY=Table_Timetable.
FindCharacter_Loop 52248 LD A,(IY+0) Fetch the current characters ID from the timetable pointer.
52251 CP C Jump to FindCharacter_Return if this character ID and the requested character ID match.
52252 JR Z,FindCharacter_Return
52254 CP 255 Jump to FindCharacter_Return if the termination character has been reached (255).
52256 JR Z,FindCharacter_Return
52258 ADD IY,DE Add 0008 bytes to the timetable pointer to move to the next set of character data.
52260 JR FindCharacter_Loop Jump to FindCharacter_Loop.
Return with some housekeeping.
FindCharacter_Return 52262 POP BC Restore BC and DE from the stack.
52263 POP DE
52264 RET Return.
Prev: 52235 Up: Map Next: 52265