Prev: A0F7 Up: Map Next: A15E
A0FA: Draw Other Item First
Used by the routine at ResolveFullOverlap.
The other item must be drawn before this one, so it becomes the item under consideration. The addresses of the entries in the draw list which have been tried are kept in a list at TriedEntries, and if the other item is already in that list then there is a loop and the other item is moved to the sorted list now.
DrawOtherItemFirst A0FA LD HL,($A1B0) Fetch the address of the entry after the other item.
A0FD DEC HL Move back to the start of the item...
A0FE DEC HL ...in the draw list...
A0FF DEC HL ...which is three bytes.
A100 LD DE,$A19E Point DE at TriedEntries.
DrawOtherItemFirst_Search A103 LD A,(DE) Fetch the first byte of the next address in the list.
A104 CP $FF Jump to DrawOtherItemFirst_Add if this is the end of the list.
A106 JR Z,DrawOtherItemFirst_Add
A108 CP H Compare it with the first byte of the address of the other item.
A109 INC DE Move onto the second byte.
A10A JR NZ,DrawOtherItemFirst_Different Jump to DrawOtherItemFirst_Different if they are different.
A10C LD A,(DE) Fetch the second byte.
A10D CP L Compare it with the second byte of the address of the other item.
A10E JR Z,DrawOtherItemFirst_Loop Jump to DrawOtherItemFirst_Loop if the item is in the list.
DrawOtherItemFirst_Different A110 INC DE Move onto the next address in the list.
A111 JR DrawOtherItemFirst_Search Jump back to compare it.
A113 DEC DE This instruction is never executed.
DrawOtherItemFirst_Add A114 LD A,H Store the first byte of the address of the other item at the end of the list.
A115 LD (DE),A Move onto the second byte.
A116 INC DE
A117 LD A,L Fetch the second byte of the address of the other item.
A118 LD (DE),A Store it in the list.
A119 INC DE Move onto the end marker.
A11A LD A,$FF Set the end marker to FF.
A11C LD (DE),A Store it.
A11D PUSH IY Copy the address of the other record into IX (using the stack).
A11F POP IX
A121 LD HL,($A1B0) Fetch the address of the item after the other item.
A124 LD ($A1AE),HL Make it the item under consideration.
A127 LD DE,$AFFB Point DE at DrawList.
A12A DEC HL Move back to the start of the item...
A12B DEC HL ...in the draw list...
A12C DEC HL ...which is three bytes.
A12D BIT 0,(HL) Jump to SortDrawList_SecondLoop if the record is an entity.
A12F JP NZ,SortDrawList_SecondLoop
A132 PUSH IY Copy the address of the second scratch item into HL (using the stack).
A134 POP HL
A135 LD DE,$9F79 Point DE at ScratchItems.
A138 LDI Copy the first byte of the second scratch item to the first scratch item.
A13A LDI Copy the second byte.
A13C LDI Copy the third byte.
A13E LDI Copy the fourth byte.
A140 LDI Copy the fifth byte.
A142 LDI Copy the sixth byte.
A144 LDI Copy the seventh byte.
A146 LDI Copy the eighth byte.
A148 LDI Copy the ninth byte.
A14A LDI Copy the tenth byte.
A14C LD IX,$9F79 Point IX at ScratchItems.
A150 LD DE,$AFFB Point DE at DrawList.
A153 JP SortDrawList_SecondLoop Jump to SortDrawList_SecondLoop.
There is a loop, so move the other item to the sorted list now.
DrawOtherItemFirst_Loop A156 LD HL,($A1B0) Fetch the address of the item after the other item.
A159 LD ($A1AE),HL Make it the item under consideration.
A15C JR MoveItemToSortedList Jump to MoveItemToSortedList to move it to the sorted list.
Prev: A0F7 Up: Map Next: A15E