subtract_paid_money.asm 530 B

123456789101112131415161718
  1. ; subtracts the amount the player paid from their money
  2. ; sets carry flag if there is enough money and unsets carry flag if not
  3. SubtractAmountPaidFromMoney_:
  4. ld de, wPlayerMoney
  5. ld hl, hMoney ; total price of items
  6. ld c, 3 ; length of money in bytes
  7. call StringCmp
  8. ret c
  9. ld de, wPlayerMoney + 2
  10. ld hl, hMoney + 2 ; total price of items
  11. ld c, 3 ; length of money in bytes
  12. predef SubBCDPredef ; subtract total price from money
  13. ld a, MONEY_BOX
  14. ld [wTextBoxID], a
  15. call DisplayTextBoxID ; redraw money text box
  16. and a
  17. ret