1GetQuantityOfItemInBag: 2; In: b = item ID 3; Out: b = how many of that item are in the bag 4 call GetPredefRegisters 5 ld hl, wNumBagItems 6.loop 7 inc hl 8 ld a, [hli] 9 cp $ff 10 jr z, .notInBag 11 cp b 12 jr nz, .loop 13 ld a, [hl] 14 ld b, a 15 ret 16.notInBag 17 ld b, 0 18 ret 19 20