diff options
| author | YamaArashi <shadow962@live.com> | 2016-12-31 17:23:54 -0800 |
|---|---|---|
| committer | YamaArashi <shadow962@live.com> | 2016-12-31 17:23:54 -0800 |
| commit | bf67f7174d8e3f1348c786618ee5a3a076d1eff8 (patch) | |
| tree | 41dfcd420ce30d4b077d2055e096ea40e4a229a5 /engine/get_bag_item_quantity.asm | |
| parent | use hardware constants in pic.asm (diff) | |
| download | pokeyellow-bf67f7174d8e3f1348c786618ee5a3a076d1eff8.tar.gz pokeyellow-bf67f7174d8e3f1348c786618ee5a3a076d1eff8.tar.xz pokeyellow-bf67f7174d8e3f1348c786618ee5a3a076d1eff8.zip | |
split code out of main.asm
Diffstat (limited to 'engine/get_bag_item_quantity.asm')
| -rw-r--r-- | engine/get_bag_item_quantity.asm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/engine/get_bag_item_quantity.asm b/engine/get_bag_item_quantity.asm new file mode 100644 index 00000000..f10df1a0 --- /dev/null +++ b/engine/get_bag_item_quantity.asm @@ -0,0 +1,18 @@ +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 |
