pokered/engine/items/tm_prices.asm
Rangi 4b853ad676
Separate maps.asm, pics.asm, sprites.asm, and tilesets.asm from main.asm (#251)
Each new file builds its own .o, along with separate main.o and home.o, which necessitates many more "exported::" labels.
2020-06-27 15:32:24 -04:00

25 lines
514 B
NASM
Executable file

GetMachinePrice::
; Input: [wcf91] = Item Id of a TM
; Output: Stores the TM price at hItemPrice
ld a, [wcf91] ; a contains TM item id
sub TM_01
ret c
ld d, a
ld hl, TechnicalMachinePrices
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)
srl d
jr nc, .highNybbleIsPrice ; is TM id odd?
swap a
.highNybbleIsPrice
and $f0
ld [hItemPrice + 1], a
xor a
ld [hItemPrice], a
ld [hItemPrice + 2], a
ret
INCLUDE "data/tm_prices.asm"