Sherlock: annotated disassembly

Routines

Prev: E31C Up: Map Next: E36A
E328: Action record: shared 10 (COUNT the money)
COUNT: prints 'It totals' and the sum held in the money thing (+9/+10), in pounds, shillings and pence. It totals £5 4/-' (the game's pound sign is character $60, which my capture shows as a backquote).
Input
$A013 The money thing's record
Output
F NZ; "IT TOTALS" and the sum printed
E328 DEFB $6A,$10,$1C,$E3 Action record header: flags $6A; bit 5: test D078 first; bit 6: pre-check at E31C; byte 1 $10
E32C LD HL,$6836 Point HL at the message "IT TOTALS" (6836)
E32F CALL $A59F Call the routine "Print the message at HL" (A59F)
E332 LD IX,($A013) Read $A013 in "Game variables" into IX
E336 LD L,(IX+$09) Read byte +9 of the record at IX into L
E339 LD H,(IX+$0A) Read byte +10 of the record at IX into H
E33C CALL $A419 Call the routine "Print an amount of money" (A419)
E33F CALL $A2A2 Call the routine "Print a newline (A kept)" (A2A2)
E342 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
E344 RET Return to the caller
E345 CALL $E34F Call E34F (inside "Action record: shared 10 (COUNT the money)")
E348 RET Z If the zero flag is set, return
E349 LD A,$25 Load A with $25
E34B LD ($A033),A Store A in $A033 in "Game variables"
E34E RET Return to the caller
This entry point is used by the routine at E370.
E34F LD A,($A036) Read $A036 in "Game variables" into A - The current actor's purse (E619); none (Z): cannot pay
E352 CALL $E619 Call E619 (inside "Action record: RUN at E08F; RUN at E46B;...")
E355 JR Z,$E365 If the zero flag is set, skip ahead to E365
E357 CALL $E39C Call the routine "HL = the money a thing holds (+9/+10)" (E39C) - HL = its money, DE = the sum in the command
E35A CALL $E3A9 Call the routine "DE = the sum of money in the command ($A02F)" (E3A9)
E35D AND A Clear the carry flag, so that the subtraction that follows is a plain one (a compare)
E35E SBC HL,DE Subtract DE from HL (a compare: carry = HL was smaller, zero = equal) - HL - DE: less than nothing? (carry): cannot pay
E360 JR C,$E365 If it went below zero (carry), skip ahead to E365
E362 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller
E364 RET Return to the caller
E365 LD HL,$E36A Point HL at "Refusal: "YOU DO NOT HAVE ENOUGH."" (E36A) - Message 683F and fail
E368 XOR A Set A to zero, which sets the zero flag for the caller
E369 RET Return to the caller
Prev: E31C Up: Map Next: E36A