pokered/engine/get_bag_item_quantity.asm

19 lines
258 B
NASM
Raw Normal View History

2017-01-01 01:23:54 +00:00
GetQuantityOfItemInBag:
; In: b = item ID
; Out: b = how many of that item are in the bag
call GetPredefRegisters
ld hl, wNumBagItems
.loop
inc hl
ld a, [hli]
cp $ff
jr z, .notInBag
cp b
jr nz, .loop
ld a, [hl]
ld b, a
ret
.notInBag
ld b, 0
ret