diff options
author | PikalaxALT <PikalaxALT@gmail.com> | 2016-01-29 18:36:31 -0500 |
---|---|---|
committer | PikalaxALT <PikalaxALT@gmail.com> | 2016-01-29 18:36:31 -0500 |
commit | 2bf93c5905319e9181f87b3f83cd3bce7b9feeca (patch) | |
tree | 3ebf17c8879e5d6243d81aac8f1c36eb226fac26 /home/string.asm | |
parent | ed3f9395f6d45f6554ed9d9c49c41ea86a8e2447 (diff) |
Import stuff from pokecrystal; diff gold and silver
Diffstat (limited to 'home/string.asm')
-rw-r--r-- | home/string.asm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/home/string.asm b/home/string.asm new file mode 100644 index 00000000..70a0f2dd --- /dev/null +++ b/home/string.asm @@ -0,0 +1,38 @@ +InitString:: ; 2ef6 +; Init a string of length c. + push hl + jr _InitString +; 2ef9 + +InitName:: ; 2ef9 +; Intended for names, so this function is limited to ten characters. + push hl + ld c, 10 +; 2efc + +_InitString:: ; 2efc +; 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 +.loop + ld a, [hli] + cp "@" + jr z, .blank + cp " " + jr nz, .notblank + dec c + jr nz, .loop +.blank + pop bc + ld l, e + ld h, d + pop de + ld b, 0 + inc c + call CopyBytes + ret +.notblank + pop bc + pop hl + ret +; 2f17 |