Prev: C869 Up: Map Next: C8AB
C86F: Compare With Other Object
Makes the other object the first object and starts the comparisons again from the beginning of the list.
Input
IY The address of the other object
Fetch the index of the other object.
CompareWithOtherObject C86F LD HL,($5B2F) Fetch SecondListPosition.
C872 DEC HL Point HL at the entry of the other object.
C873 LD C,(HL) Fetch the index of the other object.
C874 LD DE,$C8EF Point DE at ReplacedObjectsList.
Look for it in ReplacedObjectsList.
CompareWithOtherObject_Find C877 LD A,(DE) Fetch an entry.
C878 CP $FF Jump to CompareWithOtherObject_Add if it is the end of the list.
C87A JR Z,CompareWithOtherObject_Add
C87C CP C Jump to CompareWithOtherObject_Loop if it is the other object.
C87D JR Z,CompareWithOtherObject_Loop
C87F INC DE Move on to the next entry.
C880 JR CompareWithOtherObject_Find Jump to CompareWithOtherObject_Find.
Add it to the list.
CompareWithOtherObject_Add C882 LD A,C Fetch the index of the other object.
C883 LD (DE),A Add it to the list.
C884 INC DE Move on to the next entry.
C885 LD A,$FF Mark the end of the list.
C887 LD (DE),A
Make it the first object and start the comparisons again.
C888 PUSH IY Copy IY to IX (using the stack).
C88A POP IX
C88C LD HL,($5B2F) Fetch SecondListPosition.
C88F LD ($5B2D),HL Set FirstListPosition.
C892 LD DE,$C745 Point DE at ObjectsToDrawList.
C895 JP DrawObjectsInOrder_FindSecond Jump to DrawObjectsInOrder_FindSecond.
The objects hold each other up, so draw the other object to break the loop.
CompareWithOtherObject_Loop C898 LD HL,$C745 Point HL at ObjectsToDrawList.
CompareWithOtherObject_Search C89B LD A,(HL) Fetch an entry.
C89C INC HL Move on to the next entry.
C89D CP $FF Jump to DrawObjectsInOrder_First if it is the end of the list.
C89F JP Z,DrawObjectsInOrder_First
C8A2 CP C Jump to CompareWithOtherObject_Search if it is not the other object.
C8A3 JR NZ,CompareWithOtherObject_Search
C8A5 PUSH IY Copy IY to IX (using the stack).
C8A7 POP IX
C8A9 JR DrawNextObject_Flag Jump to DrawNextObject_Flag.
View the equivalent code in;
Prev: C869 Up: Map Next: C8AB