summaryrefslogtreecommitdiff
path: root/home/tables.asm
diff options
context:
space:
mode:
authorPokeglitch <pokeglitchx@gmail.com>2018-06-04 20:33:25 -0400
committerPokeglitch <pokeglitchx@gmail.com>2018-06-04 20:33:25 -0400
commit2873751d31331d5ffb0e6b3539a62d1ad264d063 (patch)
tree50e112095e8ada615b3dc6da60469fd45685e6fa /home/tables.asm
parenta02f7c334808b18570484d060fa758377a47d8cb (diff)
Removed unnecessary comments
Diffstat (limited to 'home/tables.asm')
-rwxr-xr-xhome/tables.asm30
1 files changed, 13 insertions, 17 deletions
diff --git a/home/tables.asm b/home/tables.asm
index 6831d10..dc0a7a2 100755
--- a/home/tables.asm
+++ b/home/tables.asm
@@ -2,31 +2,27 @@ INCLUDE "constants.asm"
SECTION "FindItemInTable", ROM0[$35F8]
-; Inputs:
-; hl = start of table to check
-; de = row size
-; a = item to search for
-; Outputs:
-; carry = item found
-; b = row index of item
+; 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
.nextItem
- ld a, [hl] ; load the next item
- cp $FF ; is the list finished?
- jr z, .fail ; if so, then fail
- cp c ; does this item match?
- jr z, .success ; if so, then set the carry flag
- inc b ; increase the row index count
- add hl, de ; move the next row
- jr .nextItem ; check the next item
+ ld a, [hl]
+ cp $FF
+ jr z, .fail
+ cp c
+ jr z, .success
+ inc b
+ add hl, de
+ jr .nextItem
.fail
- and a ; unset the carry flag to indicate failure
+ and a
ret
.success
- scf ; set the carry flag to indicate success
+ scf
ret \ No newline at end of file