![]() |
Routines |
| Prev: D51A | Up: Map | Next: D57C |
|
Used by the routine at PrintObjectListWithFormatting.
|
||||||||||
| PrintFormattedObjectList | D526 | PUSH IX | Stash the context pointer (IX) on the stack. | |||||||
| D528 | CALL AdjustObjectTableForSum | Call AdjustObjectTableForSum to set up the object table pointer. | ||||||||
| PrintFormattedObjectList_Loop | D52B | PUSH AF | Stash the object ID on the stack. | |||||||
| D52C | CALL FindNextMatchingObject_Entry | Call FindNextMatchingObject_Entry to find the next matching object. | ||||||||
|
Check if we found a valid object to print.
|
||||||||||
| D52F | 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.
|
||||||||||
| D531 | SET 7,(IY+$06) | Set bit 7 of *IY+06 to mark the object as processed. | ||||||||
| D535 | SUB A | Clear A (set to zero). | ||||||||
| D536 | LD ($A028),A | Write 00 to *ObjectProcessingSourceFlag (clear the object name buffer pointer). | ||||||||
| D539 | CALL ProcessObjectEntryAlternate_4 | Call ProcessObjectEntryAlternate_4 to print the object name. | ||||||||
|
Check how many objects remain to be printed.
|
||||||||||
| D53C | DEC C | Decrease C (the remaining object counter) by one. | ||||||||
| D53D | LD A,C | A=C (copy the counter value into A). | ||||||||
| D53E | AND A | Set flags based on the counter value in A. | ||||||||
| D53F | 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.
|
||||||||||
| D541 | CALL ProcessObject_Display_5 | Call ProcessObject_Display_5 to print the final separator. | ||||||||
| D544 | JR PrintFormattedObjectList_LoopContinue | Jump to PrintFormattedObjectList_LoopContinue to continue the loop. | ||||||||
|
Determine which separator to print based on how many objects remain.
|
||||||||||
| PrintFormattedObjectList_CheckSeparator | D546 | CP $01 | Jump to PrintFormattedObjectList_Print_And if this is the second-to-last object (compare A with 01). | |||||||
| D548 | JR Z,PrintFormattedObjectList_Print_And | |||||||||
|
Print comma separator for multiple objects.
|
||||||||||
| D54A | LD A,$2C | Load an ASCII comma (2C) into A. | ||||||||
| D54C | CALL Print_Character | Call Print_Character to print the comma character. | ||||||||
| D54F | JR PrintFormattedObjectList_LoopContinue | Jump to PrintFormattedObjectList_LoopContinue to continue the loop. | ||||||||
|
Print "and" separator before the last object.
|
||||||||||
| PrintFormattedObjectList_Print_And | D551 | LD DE,$005D | DE=005D (load address of "and" text token into DE). | |||||||
| D554 | CALL PrintTextToken | Call PrintTextToken to print the "and" text. | ||||||||
| PrintFormattedObjectList_LoopContinue | D557 | POP AF | Restore the object ID from the stack. | |||||||
| D558 | 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 | D55A | POP AF | Restore the object ID from the stack. | |||||||
| D55B | CALL AdjustObjectTableForSum | Call AdjustObjectTableForSum to reset the object table pointer. | ||||||||
| PrintFormattedObjectList_NestedLoop | D55E | PUSH AF | Stash the object ID on the stack. | |||||||
| D55F | CALL FindNextMatchingObject_Entry | Call FindNextMatchingObject_Entry to find nested objects. | ||||||||
| D562 | JR C,PrintFormattedObjectList_End | Jump to PrintFormattedObjectList_End if no nested objects found (A is less than 2C). | ||||||||
|
Check if there are multiple nested objects.
|
||||||||||
| D564 | PUSH AF | Stash the object ID on the stack. | ||||||||
| D565 | CALL CountObjectsInLocation | Call CountObjectsInLocation to count nested objects in the location. | ||||||||
| D568 | JR Z,PrintFormattedObjectList_SkipNested | Jump to PrintFormattedObjectList_SkipNested if there's only one nested object (A equals 2C). | ||||||||
|
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 object ID from the stack. | ||||||||
| D56C | CALL PrintObjectDescription | Call PrintObjectDescription to print the object description. | ||||||||
| D56F | CALL PrintFormattedObjectList | Call PrintFormattedObjectList to recursively print nested object names. | ||||||||
| D572 | JR PrintFormattedObjectList_NestedDone | Jump to PrintFormattedObjectList_NestedDone (continue processing nested objects). | ||||||||
| PrintFormattedObjectList_SkipNested | D574 | POP AF | Restore the object ID twice (to clean up) from the stack. | |||||||
| PrintFormattedObjectList_NestedDone | D575 | POP AF | ||||||||
| D576 | JR PrintFormattedObjectList_NestedLoop | Jump back to PrintFormattedObjectList_NestedLoop to check for more nested objects. | ||||||||
|
No nested objects found - restore registers and return.
|
||||||||||
| PrintFormattedObjectList_End | D578 | POP AF | Restore the object ID from the stack. | |||||||
| D579 | POP IX | Restore the context pointer (IX) from the stack. | ||||||||
| D57B | RET | Return. | ||||||||
| Prev: D51A | Up: Map | Next: D57C |