Prev: CF80 Up: Map Next: CFCF
CFB6: Find Character Script Entry
Searches through the character script entry list to find an entry matching the current character ID. Returns the entry pointer if found, otherwise returns 00.
Output
IX Character script entry pointer (if found)
A 00 if not found, bit 0 set if found
FindCharacterScriptEntry CFB6 LD A,($A036) A=*CurrentCharacter_ID.
This entry point is used by the routine at E17B.
FindCharacterScriptEntry_StartSearch CFB9 LD IX,$9FEB IX=*CharacterScriptEntryList.
FindCharacterScriptEntry_Loop CFBD PUSH AF Stash the current character ID on the stack.
CFBE CALL FetchObjectPointerFromStack Call FetchObjectPointerFromStack.
CFC1 JR Z,FindCharacterScriptEntry_NotFound Jump to FindCharacterScriptEntry_NotFound if the end of the list has been reached.
CFC3 POP AF Restore the current character ID from the stack.
CFC4 CP (IX+$00) Jump to FindCharacterScriptEntry_Loop if this entry doesn't match the character ID.
CFC7 JR NZ,FindCharacterScriptEntry_Loop
CFC9 OR %00000001 Mark that the entry was found.
CFCB RET Return with the entry pointer.
No matching entry was found in the list.
FindCharacterScriptEntry_NotFound CFCC POP AF Restore the current character ID from the stack.
CFCD XOR A Return 00 (entry not found).
CFCE RET
Prev: CF80 Up: Map Next: CFCF