Prev: 54554 Up: Map Next: 54652
54566: Print Formatted Object List
Used by the routine at PrintObjectListWithFormatting.
Sets up the object table and prints each matching object.
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 Call AdjustObjectTableForSum to set up the object table pointer, keeping character record.
54568 CALL AdjustObjectTableForSum
PrintFormattedObjectList_Loop 54571 PUSH AF Keep the object id and call FindMatchingObject to find the next matching object.
54572 CALL FindMatchingObject
54575 JR C,PrintFormattedObjectList_CheckNested Go to PrintFormattedObjectList_CheckNested if there is no further object.
Mark this object as processed and prepare to print its name.
54577 SET 7,(IY+6) Set bit 7 of the object's byte at offset 6.
54581 SUB A Clear the object processing source flag at ObjectProcessingSourceFlag.
54582 LD (41000),A
54585 CALL TakeTheFoundObject_DescriptionFlag Call TakeTheFoundObject_DescriptionFlag to read this object's description flag.
54588 DEC C Jump ahead to PrintFormattedObjectList_CheckSeparator if the count is not zero.
54589 LD A,C
54590 AND A
54591 JR NZ,PrintFormattedObjectList_CheckSeparator
Print separator for the last object in the list.
54593 CALL PrintFullStop Call PrintFullStop to print a full stop.
54596 JR PrintFormattedObjectList_LoopContinue Carry on and print the next object in the list.
See whether the text byte is set, then leave the result this step chose, then print the character.
Determine which separator to print based on how many objects remain.
PrintFormattedObjectList_CheckSeparator 54598 CP 1 Jump ahead to PrintFormattedObjectList_PrintAnd if one object remains.
54600 JR Z,PrintFormattedObjectList_PrintAnd
Print comma separator for multiple objects.
54602 LD A,44 Take a comma.
54604 CALL Print_Character Print the character in A through Print_Character.
54607 JR PrintFormattedObjectList_LoopContinue Carry on and print the next object in the list.
Print the dictionary word.
Print "and" separator before the last object.
PrintFormattedObjectList_PrintAnd 54609 LD DE,93 Take token 0093.
54612 CALL PrintTextToken Call PrintTextToken to print token 93.
PrintFormattedObjectList_LoopContinue 54615 POP AF Keep looking for a matching object from PrintFormattedObjectList_Loop.
54616 JR PrintFormattedObjectList_Loop
Points the object list at the right room, finds the next matching object, and counts the objects there.
No more objects found in the main list - check for nested objects.
PrintFormattedObjectList_CheckNested 54618 POP AF Restore the saved result from the stack.
54619 CALL AdjustObjectTableForSum Call AdjustObjectTableForSum to reset the object table pointer.
PrintFormattedObjectList_NestedLoop 54622 PUSH AF Keep the result and call FindMatchingObject to find the next matching object.
54623 CALL FindMatchingObject
54626 JR C,PrintFormattedObjectList_End Finish at PrintFormattedObjectList_End when no more objects are found.
54628 PUSH AF Call CountObjectsInLocation to count nested objects in the location, keeping find next matching object result.
54629 CALL CountObjectsInLocation
54632 JR Z,PrintFormattedObjectList_SkipNested Skip the nested list when nothing is inside this object.
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 saved result from the stack.
54636 CALL PrintObjectDescription Call PrintObjectDescription to print object description.
54639 CALL PrintFormattedObjectList Call PrintFormattedObjectList to print the formatted object list.
54642 JR PrintFormattedObjectList_NestedDone Carry on after the separator.
Drop the saved flags and carry on after the separator.
PrintFormattedObjectList_SkipNested 54644 POP AF Restore the saved values from the stack.
PrintFormattedObjectList_NestedDone 54645 POP AF
54646 JR PrintFormattedObjectList_NestedLoop And jump to PrintFormattedObjectList_NestedLoop.
Return.
No nested objects found - restore registers and return.
PrintFormattedObjectList_End 54648 POP AF Restore the saved result and the saved character record from the stack.
54649 POP IX
54651 RET Return.
Prev: 54554 Up: Map Next: 54652