pokered/engine/items/tm_prices.asm

26 lines
531 B
NASM
Raw Normal View History

2014-05-22 22:13:20 +00:00
GetMachinePrice: ; 7bf86 (1e:7f86)
; Input: [wcf91] = Item Id of a TM
2015-07-18 15:17:29 +00:00
; Output: Stores the TM price at hItemPrice
ld a, [wcf91] ; a contains TM item id
2014-05-22 22:13:20 +00:00
sub TM_01
ret c
ld d, a
ld hl, TechnicalMachinePrices
2014-05-22 22:13:20 +00:00
srl a
ld c, a
ld b, 0
add hl, bc
ld a, [hl] ; a contains byte whose high or low nybble is the TM price (in thousands)
2014-05-22 22:13:20 +00:00
srl d
jr nc, .highNybbleIsPrice ; is TM id odd?
2014-05-22 22:13:20 +00:00
swap a
.highNybbleIsPrice
2014-05-22 22:13:20 +00:00
and $f0
2015-07-18 15:17:29 +00:00
ld [hItemPrice + 1], a
2014-05-22 22:13:20 +00:00
xor a
2015-07-18 15:17:29 +00:00
ld [hItemPrice], a
ld [hItemPrice + 2], a
2014-05-22 22:13:20 +00:00
ret
INCLUDE "data/tm_prices.asm"