Prev: 41207 Up: Map Next: 41310
41210: 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 41210 LD HL,(41392) Fetch the address of the entry after the other item.
41213 DEC HL Move back to the start of the item...
41214 DEC HL ...in the draw list...
41215 DEC HL ...which is three bytes.
41216 LD DE,41374 Point DE at TriedEntries.
DrawOtherItemFirst_Search 41219 LD A,(DE) Fetch the first byte of the next address in the list.
41220 CP 255 Jump to DrawOtherItemFirst_Add if this is the end of the list.
41222 JR Z,DrawOtherItemFirst_Add
41224 CP H Compare it with the first byte of the address of the other item.
41225 INC DE Move onto the second byte.
41226 JR NZ,DrawOtherItemFirst_Different Jump to DrawOtherItemFirst_Different if they are different.
41228 LD A,(DE) Fetch the second byte.
41229 CP L Compare it with the second byte of the address of the other item.
41230 JR Z,DrawOtherItemFirst_Loop Jump to DrawOtherItemFirst_Loop if the item is in the list.
DrawOtherItemFirst_Different 41232 INC DE Move onto the next address in the list.
41233 JR DrawOtherItemFirst_Search Jump back to compare it.
41235 DEC DE This instruction is never executed.
DrawOtherItemFirst_Add 41236 LD A,H Store the first byte of the address of the other item at the end of the list.
41237 LD (DE),A Move onto the second byte.
41238 INC DE
41239 LD A,L Fetch the second byte of the address of the other item.
41240 LD (DE),A Store it in the list.
41241 INC DE Move onto the end marker.
41242 LD A,255 Set the end marker to 255.
41244 LD (DE),A Store it.
41245 PUSH IY Copy the address of the other record into IX (using the stack).
41247 POP IX
41249 LD HL,(41392) Fetch the address of the item after the other item.
41252 LD (41390),HL Make it the item under consideration.
41255 LD DE,45051 Point DE at DrawList.
41258 DEC HL Move back to the start of the item...
41259 DEC HL ...in the draw list...
41260 DEC HL ...which is three bytes.
41261 BIT 0,(HL) Jump to SortDrawList_SecondLoop if the record is an entity.
41263 JP NZ,SortDrawList_SecondLoop
41266 PUSH IY Copy the address of the second scratch item into HL (using the stack).
41268 POP HL
41269 LD DE,40825 Point DE at ScratchItems.
41272 LDI Copy the first byte of the second scratch item to the first scratch item.
41274 LDI Copy the second byte.
41276 LDI Copy the third byte.
41278 LDI Copy the fourth byte.
41280 LDI Copy the fifth byte.
41282 LDI Copy the sixth byte.
41284 LDI Copy the seventh byte.
41286 LDI Copy the eighth byte.
41288 LDI Copy the ninth byte.
41290 LDI Copy the tenth byte.
41292 LD IX,40825 Point IX at ScratchItems.
41296 LD DE,45051 Point DE at DrawList.
41299 JP SortDrawList_SecondLoop Jump to SortDrawList_SecondLoop.
There is a loop, so move the other item to the sorted list now.
DrawOtherItemFirst_Loop 41302 LD HL,(41392) Fetch the address of the item after the other item.
41305 LD (41390),HL Make it the item under consideration.
41308 JR MoveItemToSortedList Jump to MoveItemToSortedList to move it to the sorted list.
Prev: 41207 Up: Map Next: 41310