Prev: 9C3D Up: Map Next: 9C55
9C42: Total weight of an object's contents
Returns in A the total weight (byte 3) of everything held by object A, including the contents of containers, found by 9C55. The result is $FF if it overflows.
Input
A Object
Output
A Weight
9C42 PUSH BC TOTAL WEIGHT: save the caller's BC
9C43 LD B,$00 B=0 tells the shared routine below to add up weights
This entry point is used by the routine at 9C3D.
9C45 PUSH IX Save the caller's IX and IY, which the search below will use
9C47 PUSH IY
9C49 LD C,$00 C will be the running total, starting at 0
9C4B CALL $9C55 Add up everything object A holds
9C4E LD A,C A = the finished total
9C4F POP IY Restore the caller's IY and IX
9C51 POP IX
9C53 POP BC Restore the caller's BC
9C54 RET
Prev: 9C3D Up: Map Next: 9C55