Prev: 9A59 Up: Map Next: 9AA0
9A85: Table: Find A Special Object
Finds a special object by its index.
Input
A The index to search for
TableFindASpecialObject 9A85 PUSH DE Keep the id being sought.
9A86 PUSH BC
9A87 LD B,A
9A88 LD HL,$CACB Point HL at the special-object records.
9A8B LD DE,$0007 Each special-object entry is 07 bytes.
TableFindASpecialObject_Loop 9A8E LD A,(HL) If the current pointer matches our key jump to TableFindASpecialObject_PointAtTheRecord.
9A8F CP B
9A90 JR Z,TableFindASpecialObject_PointAtTheRecord
9A92 CP $FF Jump to TableFindASpecialObject_PointAtTheRecord at the end of the special-object records.
9A94 JR Z,TableFindASpecialObject_PointAtTheRecord
9A96 ADD HL,DE Increase the pointer address by 0007 (using DE).
9A97 JP TableFindASpecialObject_Loop Jump back to TableFindASpecialObject_Loop for the next special-object record.
TableFindASpecialObject_PointAtTheRecord 9A9A POP BC Restore BC and DE from the stack, and copy the special-object record from HL into IY.
9A9B POP DE
9A9C PUSH HL
9A9D POP IY
9A9F RET Return.
Prev: 9A59 Up: Map Next: 9AA0