Prev: 51305 Up: Map Next: 51371
51311: 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 51311 LD HL,(23343) Fetch SecondListPosition.
51314 DEC HL Point HL at the entry of the other object.
51315 LD C,(HL) Fetch the index of the other object.
51316 LD DE,51439 Point DE at ReplacedObjectsList.
Look for it in ReplacedObjectsList.
CompareWithOtherObject_Find 51319 LD A,(DE) Fetch an entry.
51320 CP 255 Jump to CompareWithOtherObject_Add if it is the end of the list.
51322 JR Z,CompareWithOtherObject_Add
51324 CP C Jump to CompareWithOtherObject_Loop if it is the other object.
51325 JR Z,CompareWithOtherObject_Loop
51327 INC DE Move on to the next entry.
51328 JR CompareWithOtherObject_Find Jump to CompareWithOtherObject_Find.
Add it to the list.
CompareWithOtherObject_Add 51330 LD A,C Fetch the index of the other object.
51331 LD (DE),A Add it to the list.
51332 INC DE Move on to the next entry.
51333 LD A,255 Mark the end of the list.
51335 LD (DE),A
Make it the first object and start the comparisons again.
51336 PUSH IY Copy IY to IX (using the stack).
51338 POP IX
51340 LD HL,(23343) Fetch SecondListPosition.
51343 LD (23341),HL Set FirstListPosition.
51346 LD DE,51013 Point DE at ObjectsToDrawList.
51349 JP DrawObjectsInOrder_FindSecond Jump to DrawObjectsInOrder_FindSecond.
The objects hold each other up, so draw the other object to break the loop.
CompareWithOtherObject_Loop 51352 LD HL,51013 Point HL at ObjectsToDrawList.
CompareWithOtherObject_Search 51355 LD A,(HL) Fetch an entry.
51356 INC HL Move on to the next entry.
51357 CP 255 Jump to DrawObjectsInOrder_First if it is the end of the list.
51359 JP Z,DrawObjectsInOrder_First
51362 CP C Jump to CompareWithOtherObject_Search if it is not the other object.
51363 JR NZ,CompareWithOtherObject_Search
51365 PUSH IY Copy IY to IX (using the stack).
51367 POP IX
51369 JR DrawNextObject_Flag Jump to DrawNextObject_Flag.
View the equivalent code in;
Prev: 51305 Up: Map Next: 51371