Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/items/subtract_paid_money.asm
1271 views
1
; subtracts the amount the player paid from their money
2
; OUTPUT: carry = 0(success) or 1(fail because there is not enough money)
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
18
19