diff options
author | libjet <libj3t@gmail.com> | 2020-03-16 00:44:13 +0000 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-03-16 00:44:13 +0000 |
commit | 6231351906960364a5ad2f34efefd809cceb0eb8 (patch) | |
tree | 709f2f908d9e1c2f7a882d628ff09b80de3c9e8b /home/string.asm | |
parent | 4ad17cc30e6b70be19badd175558c438fc9adaf6 (diff) |
Sync home/ with pokecrystal
Diffstat (limited to 'home/string.asm')
-rw-r--r-- | home/string.asm | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/home/string.asm b/home/string.asm index 6f804a96..86de2e27 100644 --- a/home/string.asm +++ b/home/string.asm @@ -1,31 +1,35 @@ InitString:: +; Init a string of length c. push hl - jr InitString_ + jr _InitString InitName:: +; Intended for names, so this function is limited to ten characters. push hl - ld c, $a -InitString_:: + ld c, NAME_LENGTH - 1 +_InitString:: +; if the string pointed to by hl is empty (defined as "zero or more spaces +; followed by a null"), then initialize it to the string pointed to by de. push bc -.asm_2fbd +.loop ld a, [hli] - cp $50 - jr z, .asm_2fc9 - cp $7f - jr nz, .asm_2fd4 + cp "@" + jr z, .blank + cp " " + jr nz, .notblank dec c - jr nz, .asm_2fbd -.asm_2fc9 + jr nz, .loop +.blank pop bc ld l, e ld h, d pop de - ld b, $0 + ld b, 0 inc c call CopyBytes ret -.asm_2fd4 +.notblank pop bc pop hl ret |