mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-22 15:12:18 +13:00
Move all code out of home.asm into home/
This results in 64 home/*.asm files, comparable to pokecrystal's 57.
This commit is contained in:
parent
51ac538c25
commit
bbf2f51a02
35 changed files with 1754 additions and 1758 deletions
44
home/item_price.asm
Normal file
44
home/item_price.asm
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue