![]() |
Routines |
| Prev: 54439 | Up: Map | Next: 54511 |
|
Used by the routines at ProcessLocationTokenDisplay, PrintObjectList, PrintFormattedObjectList and 56629.
|
||||||||||||
| CountObjectsInLocation | 54476 | PUSH IX | Stash IX, IY, HL and BC on the stack. | |||||||||
| 54478 | PUSH IY | |||||||||||
| 54480 | PUSH HL | |||||||||||
| 54481 | PUSH BC | |||||||||||
| 54482 | CALL AdjustObjectTableForSum | Call AdjustObjectTableForSum to set up the object table pointer. | ||||||||||
| 54485 | LD B,0 | Initialise the object counter in B to zero. | ||||||||||
| 54487 | LD C,A | Store the location ID in C for later use. | ||||||||||
| CountObjectsInLocation_Loop | 54488 | CALL FetchNextObject | Call FetchNextObject. | |||||||||
| 54491 | JR Z,CountObjectsInLocation_End | Jump to CountObjectsInLocation_End if we've reached the end of the object table (255). | ||||||||||
| 54493 | LD A,C | Restore the location ID from C into A. | ||||||||||
| 54494 | CALL CheckObjectMatchCriteria | Call CheckObjectMatchCriteria to check if this object matches the location and visibility criteria. | ||||||||||
|
Skip this object if it doesn't match the criteria (carry flag not set).
|
||||||||||||
| 54497 | JR NC,CountObjectsInLocation_Loop | Jump back to CountObjectsInLocation_Loop to continue checking objects if this one doesn't match. | ||||||||||
|
This object matches the criteria, so count it.
|
||||||||||||
| 54499 | INC B | Increment the object counter in B by one. | ||||||||||
| 54500 | JR CountObjectsInLocation_Loop | Jump back to CountObjectsInLocation_Loop to check the next object. | ||||||||||
| CountObjectsInLocation_End | 54502 | LD A,B | Transfer the object count from B to A. | |||||||||
| 54503 | AND A | Set flags based on the count (zero flag set if no objects found). | ||||||||||
| 54504 | POP BC | Restore BC, HL, IY and IX from the stack. | ||||||||||
| 54505 | POP HL | |||||||||||
| 54506 | POP IY | |||||||||||
| 54508 | POP IX | |||||||||||
| 54510 | RET | Return. | ||||||||||
| Prev: 54439 | Up: Map | Next: 54511 |