Prev: D51A Up: Map Next: D57C
D526: 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 FF for all objects)
PrintFormattedObjectList D526 PUSH IX Call AdjustObjectTableForSum to set up the object table pointer, keeping character record.
D528 CALL AdjustObjectTableForSum
PrintFormattedObjectList_Loop D52B PUSH AF Keep the object id and call FindMatchingObject to find the next matching object.
D52C CALL FindMatchingObject
D52F 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.
D531 SET 7,(IY+$06) Set bit 7 of the object's byte at offset 06.
D535 SUB A Clear the object processing source flag at ObjectProcessingSourceFlag.
D536 LD ($A028),A
D539 CALL TakeTheFoundObject_DescriptionFlag Call TakeTheFoundObject_DescriptionFlag to read this object's description flag.
D53C DEC C Jump ahead to PrintFormattedObjectList_CheckSeparator if the count is not zero.
D53D LD A,C
D53E AND A
D53F JR NZ,PrintFormattedObjectList_CheckSeparator
Print separator for the last object in the list.
D541 CALL PrintFullStop Call PrintFullStop to print a full stop.
D544 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 D546 CP $01 Jump ahead to PrintFormattedObjectList_PrintAnd if one object remains.
D548 JR Z,PrintFormattedObjectList_PrintAnd
Print comma separator for multiple objects.
D54A LD A,$2C Take a comma.
D54C CALL Print_Character Print the character in A through Print_Character.
D54F 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 D551 LD DE,$005D Take token 005D.
D554 CALL PrintTextToken Call PrintTextToken to print token 5D.
PrintFormattedObjectList_LoopContinue D557 POP AF Keep looking for a matching object from PrintFormattedObjectList_Loop.
D558 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 D55A POP AF Restore the saved result from the stack.
D55B CALL AdjustObjectTableForSum Call AdjustObjectTableForSum to reset the object table pointer.
PrintFormattedObjectList_NestedLoop D55E PUSH AF Keep the result and call FindMatchingObject to find the next matching object.
D55F CALL FindMatchingObject
D562 JR C,PrintFormattedObjectList_End Finish at PrintFormattedObjectList_End when no more objects are found.
D564 PUSH AF Call CountObjectsInLocation to count nested objects in the location, keeping find next matching object result.
D565 CALL CountObjectsInLocation
D568 JR Z,PrintFormattedObjectList_SkipNested Skip the nested list when nothing is inside this object.
Print description and recursively print nested objects.
D56A LD C,A Store the object count in C for later use.
D56B POP AF Restore the saved result from the stack.
D56C CALL PrintObjectDescription Call PrintObjectDescription to print object description.
D56F CALL PrintFormattedObjectList Call PrintFormattedObjectList to print the formatted object list.
D572 JR PrintFormattedObjectList_NestedDone Carry on after the separator.
Drop the saved flags and carry on after the separator.
PrintFormattedObjectList_SkipNested D574 POP AF Restore the saved values from the stack.
PrintFormattedObjectList_NestedDone D575 POP AF
D576 JR PrintFormattedObjectList_NestedLoop And jump to PrintFormattedObjectList_NestedLoop.
Return.
No nested objects found - restore registers and return.
PrintFormattedObjectList_End D578 POP AF Restore the saved result and the saved character record from the stack.
D579 POP IX
D57B RET Return.
Prev: D51A Up: Map Next: D57C