Sherlock: annotated disassembly

Routines

Prev: D2ED Up: Map Next: D305
D2F2: Total weight (+3) of everything in thing A, at any depth
D305 with B = 0: adds the +3 byte of every thing inside A, and of what is inside those; $FF if it goes over 127. Used by C8C6 (can the actor carry it as well as what it holds?) at $C8CE and $C8DF.
Input
A the container
Output
A the total
D2F2 PUSH BC Save BC on the stack
D2F3 LD B,$00 Load B with $00 - B = 0; C = 0, the running total
This entry point is used by the routine at D2ED.
D2F5 PUSH IX Save IX on the stack
D2F7 PUSH IY Save IY on the stack
D2F9 LD C,$00 Load C with $00
D2FB CALL $D305 Add up everything in thing A, to any depth (D305)
D2FE LD A,C Copy C into A - Return the total in A
D2FF POP IY Restore IY from the stack
D301 POP IX Restore IX from the stack
D303 POP BC Restore BC from the stack
D304 RET Return to the caller
Prev: D2ED Up: Map Next: D305