Prev: 54554 Up: Map Next: 54652
54566: Print Formatted Object List
Used by the routine at PrintObjectListWithFormatting.
Input
IX Context pointer (preserved but not directly used)
A Object ID (starting object ID for the list, or 255 for all objects)
PrintFormattedObjectList 54566 PUSH IX Stash the context pointer (IX) on the stack.
54568 CALL AdjustObjectTableForSum Call AdjustObjectTableForSum to set up the object table pointer.
PrintFormattedObjectList_Loop 54571 PUSH AF Stash the object ID on the stack.
54572 CALL FindNextMatchingObject_Entry Call FindNextMatchingObject_Entry to find the next matching object.
Check if we found a valid object to print.
54575 JR C,PrintFormattedObjectList_CheckNested Jump to PrintFormattedObjectList_CheckNested if no matching object was found (carry flag not set).
Mark this object as processed and prepare to print its name.
54577 SET 7,(IY+6) Set bit 7 of *IY+6 to mark the object as processed.
54581 SUB A Clear A (set to zero).
54582 LD (41000),A Write 0 to *ObjectProcessingSourceFlag (clear the object name buffer pointer).
54585 CALL ProcessObjectEntryAlternate_4 Call ProcessObjectEntryAlternate_4 to print the object name.
Check how many objects remain to be printed.
54588 DEC C Decrease C (the remaining object counter) by one.
54589 LD A,C A=C (copy the counter value into A).
54590 AND A Set flags based on the counter value in A.
54591 JR NZ,PrintFormattedObjectList_CheckSeparator Jump to PrintFormattedObjectList_CheckSeparator if there are more objects to print (C is not zero).
Print separator for the last object in the list.
54593 CALL ProcessObject_Display_5 Call ProcessObject_Display_5 to print the final separator.
54596 JR PrintFormattedObjectList_LoopContinue Jump to PrintFormattedObjectList_LoopContinue to continue the loop.
Determine which separator to print based on how many objects remain.
PrintFormattedObjectList_CheckSeparator 54598 CP 1 Jump to PrintFormattedObjectList_Print_And if this is the second-to-last object (compare A with 1).
54600 JR Z,PrintFormattedObjectList_Print_And
Print comma separator for multiple objects.
54602 LD A,44 Load an ASCII comma (44) into A.
54604 CALL Print_Character Call Print_Character to print the comma character.
54607 JR PrintFormattedObjectList_LoopContinue Jump to PrintFormattedObjectList_LoopContinue to continue the loop.
Print "and" separator before the last object.
PrintFormattedObjectList_Print_And 54609 LD DE,93 DE=0093 (load address of "and" text token into DE).
54612 CALL PrintTextToken Call PrintTextToken to print the "and" text.
PrintFormattedObjectList_LoopContinue 54615 POP AF Restore the object ID from the stack.
54616 JR PrintFormattedObjectList_Loop Jump back to PrintFormattedObjectList_Loop to process the next object.
No more objects found in the main list - check for nested objects.
PrintFormattedObjectList_CheckNested 54618 POP AF Restore the object ID from the stack.
54619 CALL AdjustObjectTableForSum Call AdjustObjectTableForSum to reset the object table pointer.
PrintFormattedObjectList_NestedLoop 54622 PUSH AF Stash the object ID on the stack.
54623 CALL FindNextMatchingObject_Entry Call FindNextMatchingObject_Entry to find nested objects.
54626 JR C,PrintFormattedObjectList_End Jump to PrintFormattedObjectList_End if no nested objects found (A is less than 44).
Check if there are multiple nested objects.
54628 PUSH AF Stash the object ID on the stack.
54629 CALL CountObjectsInLocation Call CountObjectsInLocation to count nested objects in the location.
54632 JR Z,PrintFormattedObjectList_SkipNested Jump to PrintFormattedObjectList_SkipNested if there's only one nested object (A equals 44).
Print description and recursively print nested objects.
54634 LD C,A Store the object count in C for later use.
54635 POP AF Restore the object ID from the stack.
54636 CALL PrintObjectDescription Call PrintObjectDescription to print the object description.
54639 CALL PrintFormattedObjectList Call PrintFormattedObjectList to recursively print nested object names.
54642 JR PrintFormattedObjectList_NestedDone Jump to PrintFormattedObjectList_NestedDone (continue processing nested objects).
PrintFormattedObjectList_SkipNested 54644 POP AF Restore the object ID twice (to clean up) from the stack.
PrintFormattedObjectList_NestedDone 54645 POP AF
54646 JR PrintFormattedObjectList_NestedLoop Jump back to PrintFormattedObjectList_NestedLoop to check for more nested objects.
No nested objects found - restore registers and return.
PrintFormattedObjectList_End 54648 POP AF Restore the object ID from the stack.
54649 POP IX Restore the context pointer (IX) from the stack.
54651 RET Return.
Prev: 54554 Up: Map Next: 54652