diff options
author | entrpntr <12521136+entrpntr@users.noreply.github.com> | 2020-05-15 12:57:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 12:57:29 -0400 |
commit | 88d7e9a34a8b610b358cec1ccc6660634ca9ce80 (patch) | |
tree | 709f2f908d9e1c2f7a882d628ff09b80de3c9e8b /home/array.asm | |
parent | a7e3a999ff21ecac0bfbe7f091f9ff901075a323 (diff) | |
parent | 6231351906960364a5ad2f34efefd809cceb0eb8 (diff) |
Merge pull request #19 from libjet/home-cleanup
Home and HRAM cleanup
Diffstat (limited to 'home/array.asm')
-rwxr-xr-x | home/array.asm | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/home/array.asm b/home/array.asm new file mode 100755 index 00000000..0abf9b7d --- /dev/null +++ b/home/array.asm @@ -0,0 +1,44 @@ +IsInArray:: +; 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 -1 + jr z, .NotInArray + cp c + jr z, .InArray + inc b + add hl, de + jr .loop + +.NotInArray: + and a + ret + +.InArray: + scf + ret + +SkipNames:: +; Skip a names. + ld bc, NAME_LENGTH + and a + ret z +.loop + add hl, bc + dec a + jr nz, .loop + ret + +AddNTimes:: +; Add bc * a to hl. + and a + ret z +.loop + add hl, bc + dec a + jr nz, .loop + ret |