aboutsummaryrefslogtreecommitdiffstats
path: root/home/item_price.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-07-07 18:50:58 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-07-07 19:43:11 -0400
commitbbf2f51a02b2544f1bef32a5868503b474ae2fef (patch)
treed73507228a57e4f3cece2fb93fe7df3a9439553f /home/item_price.asm
parentIdentify SPRITESTATEDATA2_ORIGFACINGDIRECTION (diff)
downloadpokeyellow-bbf2f51a02b2544f1bef32a5868503b474ae2fef.tar.gz
pokeyellow-bbf2f51a02b2544f1bef32a5868503b474ae2fef.tar.xz
pokeyellow-bbf2f51a02b2544f1bef32a5868503b474ae2fef.zip
Move all code out of home.asm into home/
This results in 64 home/*.asm files, comparable to pokecrystal's 57.
Diffstat (limited to 'home/item_price.asm')
-rw-r--r--home/item_price.asm44
1 files changed, 44 insertions, 0 deletions
diff --git a/home/item_price.asm b/home/item_price.asm
new file mode 100644
index 00000000..98eb31b1
--- /dev/null
+++ b/home/item_price.asm
@@ -0,0 +1,44 @@
+GetItemPrice::
+; Stores item's price as BCD at hItemPrice (3 bytes)
+; Input: [wcf91] = item id
+ ldh a, [hLoadedROMBank]
+ push af
+ ld a, [wListMenuID]
+ cp MOVESLISTMENU
+ ld a, BANK(ItemPrices)
+ jr nz, .ok
+ ld a, $f ; hardcoded Bank
+.ok
+ ldh [hLoadedROMBank], a
+ ld [MBC1RomBank], a
+ ld hl, wItemPrices
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wcf91] ; a contains item id
+ cp HM01
+ jr nc, .getTMPrice
+ ld bc, $3
+.loop
+ add hl, bc
+ dec a
+ jr nz, .loop
+ dec hl
+ ld a, [hld]
+ ldh [hItemPrice + 2], a
+ ld a, [hld]
+ ldh [hItemPrice + 1], a
+ ld a, [hl]
+ ldh [hItemPrice], a
+ jr .done
+.getTMPrice
+ ld a, BANK(GetMachinePrice)
+ ldh [hLoadedROMBank], a
+ ld [MBC1RomBank], a
+ call GetMachinePrice
+.done
+ ld de, hItemPrice
+ pop af
+ ldh [hLoadedROMBank], a
+ ld [MBC1RomBank], a
+ ret