recomment IsInArray

This commit is contained in:
yenatch
2013-09-18 21:48:04 -04:00
parent c074231a07
commit f958ba0e6d

View File

@@ -714,27 +714,29 @@ CopyName2: ; 30d9
; 30e1 ; 30e1
IsInArray: ; 30e1 IsInArray: ; 30e1
; searches an array at hl for the value in a. ; Find value a for every de bytes in array hl.
; skips (de - 1) bytes between reads, so to check every byte, de should be 1. ; Return index in b and carry if found.
; if found, returns count in b and sets carry.
ld b,0 ld b, 0
ld c,a ld c, a
.loop .loop
ld a,[hl] ld a, [hl]
cp a, $FF cp $ff
jr z,.NotInArray jr z, .NotInArray
cp c cp c
jr z,.InArray jr z, .InArray
inc b inc b
add hl,de add hl, de
jr .loop jr .loop
.NotInArray .NotInArray
and a and a
ret ret
.InArray .InArray
scf scf
ret ret
; 0x30f4 ; 30f4
SkipNames: ; 0x30f4 SkipNames: ; 0x30f4
; skips n names where n = a ; skips n names where n = a