Prev: B520 Up: Map Next: B55A
B531: List Objects To Draw
Used by the routine at RunGame.
Makes a list of the numbers of the objects that have to be drawn, which is every object that is in use and has bit 4 of its flags set. The list is stored at DrawList and ends with FF.
Go through all 36 objects.
ListObjectsToDraw B531 PUSH IX Stash IX on the stack.
B533 LD B,$36 Set a counter in B of 36 objects.
B535 LD DE,$0020 Set DE to the size of an object record.
B538 LD IX,$A76F Start with the first object record, ObjectsTable.
B53C LD HL,$B55A Start the draw list at DrawList.
B53F LD C,$00 Start with object number 00.
ListObjectsToDraw_Next B541 LD A,(IX+$00) Jump to ListObjectsToDraw_Skip if the object is not in use.
B544 AND A
B545 JR Z,ListObjectsToDraw_Skip
B547 BIT 4,(IX+$07) Jump to ListObjectsToDraw_Skip if the object does not need drawing.
B54B JR Z,ListObjectsToDraw_Skip
B54D LD (HL),C Add the object number to the list.
B54E INC HL Move on in the list.
ListObjectsToDraw_Skip B54F INC C Move on to the next object number.
B550 ADD IX,DE Move IX on to the next object record.
B552 DJNZ ListObjectsToDraw_Next Decrease the counter and loop until all the objects have been done.
B554 LD A,$FF Take FF as the end marker of the draw list.
B556 LD (HL),A Mark the end of the list.
B557 POP IX Restore IX from the stack.
B559 RET Return.
View the equivalent code in;
Prev: B520 Up: Map Next: B55A