mirror of
https://github.com/pret/pokered.git
synced 2024-10-24 15:27:10 +00:00
18 lines
258 B
NASM
18 lines
258 B
NASM
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
|