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/string.asm | |
parent | a7e3a999ff21ecac0bfbe7f091f9ff901075a323 (diff) | |
parent | 6231351906960364a5ad2f34efefd809cceb0eb8 (diff) |
Merge pull request #19 from libjet/home-cleanup
Home and HRAM cleanup
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 |