Sherlock: annotated disassembly

Routines

Prev: E506 Up: Map Next: E52F
E518: Action record: pay everything in the purse (RUN at $E508)
Addresses named in the title: E508.
Prepares the payment step of the sub-script at E506. The direct object becomes the number $FE, and the sum to pay ($A02F) is the whole balance held by the payer's purse (+9/+10) with bit 7 set; the next step, PAY TO (E370), then hands it over. The cabbie's purse balance is negative while a fare is owed, so paying 'everything' from the cabbie's purse pays the change.
Input
IX The purse
Output
$9FD7 $FE
$A02F The amount in the number form
F NZ
E518 DEFB $6D,$0D,$FC,$E4 Action record header: flags $6D; bit 5: test D078 first; bit 6: pre-check at E4FC; byte 1 $0D
E51C LD A,$FE Load A with $FE - The plan's direct object (9FD7) = $FE (a number)
E51E LD ($9FD7),A Store A in the plan's direct object (9FD7)
E521 LD L,(IX+$09) Read byte +9 of the record at IX into L - HL = the word at IX+9/+10 (an amount)
E524 LD H,(IX+$0A) Read byte +10 of the record at IX into H
E527 SET 7,L Bit 7 set: the number form
E529 LD ($A02F),HL Store it at $A02F
E52C OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - Return NZ
E52E RET Return to the caller
Prev: E506 Up: Map Next: E52F