Prev: 38452 Up: Map Next: 38664
38654: Spend Money
Used by the routines at Handler_LocationChoice, Handler_SubGame and 38452.
Input
B Number of digits
DE Pointer to players cash
HL Pointer to cost to deduct
SpendMoney 38654 AND A Set flags ready for the subtraction.
SpendMoney_Loop 38655 LD A,(DE) Load the player cash digit from *DE into A.
38656 SBC A,(HL) Subtract the cost from the digit in *HL (with the carry flag).
38657 DAA Digital to analogue conversion.
38658 LD (DE),A Write the result in A back to the players cash.
38659 INC HL Increment both the players cash and cost to deduct pointers.
38660 INC DE
38661 DJNZ SpendMoney_Loop Decrease number of digits counter by one and loop back to SpendMoney_Loop until all digits have been processed.
38663 RET Return.
Prev: 38452 Up: Map Next: 38664