diff options
author | obskyr <powpowd@gmail.com> | 2018-07-07 03:49:57 +0200 |
---|---|---|
committer | obskyr <powpowd@gmail.com> | 2018-07-07 03:49:57 +0200 |
commit | d4bb6b990a94de27f58d2c92fad5888017d3bb9d (patch) | |
tree | 7ae791db3412dbe7f9393d0c204ab4426a4992c4 /home/tables.asm | |
parent | d3f356a1dc6970973932502edbe3af6b150a22d0 (diff) | |
parent | f3f0e711bf4f4205fd29f2b448c93ff5597507e5 (diff) |
Merge branch 'master' of https://github.com/pret/pokegold-spaceworld
Diffstat (limited to 'home/tables.asm')
-rwxr-xr-x | home/tables.asm | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/home/tables.asm b/home/tables.asm index 5c35a4f..02fc78a 100755 --- a/home/tables.asm +++ b/home/tables.asm @@ -1,27 +1,27 @@ -INCLUDE "constants.asm"
-
-SECTION "FindItemInTable", ROM0[$35F8]
-
-; find value a from table hl with row length de
-; returns carry and row index b if successful
-FindItemInTable: ; 00:35F8
- ld b, 0
- ld c, a
-
-.loop
- ld a, [hl]
- cp -1
- jr z, .fail
- cp c
- jr z, .success
- inc b
- add hl, de
- jr .loop
-
-.fail
- and a
- ret
-
-.success
- scf
- ret
+INCLUDE "constants.asm" + +SECTION "FindItemInTable", ROM0[$35F8] + +; find value a from table hl with row length de +; returns carry and row index b if successful +FindItemInTable: ; 00:35F8 + ld b, 0 + ld c, a + +.loop + ld a, [hl] + cp -1 + jr z, .fail + cp c + jr z, .success + inc b + add hl, de + jr .loop + +.fail + and a + ret + +.success + scf + ret |