![]() |
Routines |
| Prev: 9CED | Up: Map | Next: 9D37 |
|
Used by the routine at Condition_TotalTheMassInside.
Adds the volume or the mass of each object inside the id in A. Volume covers those objects only; mass also adds what they hold. An overflow returns FF.
|
||||
| Condition_AddUpTheObjectsInside | 9D00 | PUSH IX | Point IX at the object table. | |
| 9D02 | LD IX,$C063 | |||
| Condition_AddUpTheObjectsInside_Loop | 9D06 | CALL Table_FindTheRecord | Call Table_FindTheRecord to find the record. | |
| 9D09 | JR Z,Condition_AddUpTheObjectsInside_RestoreAndReturn | Jump to Condition_AddUpTheObjectsInside_RestoreAndReturn at the end of the object index. | ||
| 9D0B | CP (IY+$01) | Jump back to Condition_AddUpTheObjectsInside_Loop if where this object is is not the id in A. | ||
| 9D0E | JR NZ,Condition_AddUpTheObjectsInside_Loop | |||
| 9D10 | PUSH AF | Jump to Condition_AddUpTheObjectsInside_AddTheMass if B is zero (add masses instead of volumes). | ||
| 9D11 | SUB A | |||
| 9D12 | CP B | |||
| 9D13 | LD A,C | |||
| 9D14 | JR Z,Condition_AddUpTheObjectsInside_AddTheMass | |||
| 9D16 | ADD A,(IY+$02) | Add the object's volume onto the total. | ||
| 9D19 | JP PE,Condition_AddUpTheObjectsInside_MarkTheTotalAsFull | Jump to Condition_AddUpTheObjectsInside_MarkTheTotalAsFull if the total overflowed. | ||
| 9D1C | LD C,A | Copy the result into C. | ||
| 9D1D | JR Condition_AddUpTheObjectsInside_FindTheRecord | Jump to Condition_AddUpTheObjectsInside_FindTheRecord to find the next record. | ||
| Condition_AddUpTheObjectsInside_AddTheMass | 9D1F | ADD A,(IY+$03) | Add the object's mass onto the total. | |
| 9D22 | JP PE,Condition_AddUpTheObjectsInside_MarkTheTotalAsFull | Jump to Condition_AddUpTheObjectsInside_MarkTheTotalAsFull if the total overflowed. | ||
| 9D25 | LD C,A | Copy the result into C. | ||
| 9D26 | LD A,(IX+$00) | Read the id from the index entry. | ||
| 9D29 | CALL Condition_AddUpTheObjectsInside | Call Condition_AddUpTheObjectsInside to add the mass of what this object holds. | ||
| Condition_AddUpTheObjectsInside_FindTheRecord | 9D2C | POP AF | Jump back to Condition_AddUpTheObjectsInside_Loop to find the record. | |
| 9D2D | JR Condition_AddUpTheObjectsInside_Loop | |||
| Condition_AddUpTheObjectsInside_RestoreAndReturn | 9D2F | POP IX | Restore IX from the stack. | |
| 9D31 | RET | Return. | ||
| Condition_AddUpTheObjectsInside_MarkTheTotalAsFull | 9D32 | POP AF | Pop the saved id and mark the total as full (FF). | |
| 9D33 | LD C,$FF | |||
| 9D35 | JR Condition_AddUpTheObjectsInside_RestoreAndReturn | Jump back to Condition_AddUpTheObjectsInside_RestoreAndReturn to return. | ||
|
View the equivalent code in;
|
||||
| Prev: 9CED | Up: Map | Next: 9D37 |