diff options
author | yenatch <yenatch@gmail.com> | 2013-09-18 21:48:04 -0400 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2013-09-18 21:48:04 -0400 |
commit | f958ba0e6d0e8dde9e77e0233bb9932fe506dee2 (patch) | |
tree | 62e041dbae0253278d8aaa4b157c8631279b643d | |
parent | c074231a07882bccb3da74681e1ef0e304db1ba6 (diff) |
recomment IsInArray
-rw-r--r-- | main.asm | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -714,27 +714,29 @@ CopyName2: ; 30d9 ; 30e1 IsInArray: ; 30e1 -; searches an array at hl for the value in a. -; skips (de - 1) bytes between reads, so to check every byte, de should be 1. -; if found, returns count in b and sets carry. - ld b,0 - ld c,a +; Find value a for every de bytes in array hl. +; Return index in b and carry if found. + + ld b, 0 + ld c, a .loop - ld a,[hl] - cp a, $FF - jr z,.NotInArray + ld a, [hl] + cp $ff + jr z, .NotInArray cp c - jr z,.InArray + jr z, .InArray inc b - add hl,de + add hl, de jr .loop + .NotInArray and a ret + .InArray scf ret -; 0x30f4 +; 30f4 SkipNames: ; 0x30f4 ; skips n names where n = a |