From 145eb65a8e9eafcd96063c2df1b442f722896ee9 Mon Sep 17 00:00:00 2001 From: Clanmaster21 Date: Thu, 9 Jan 2020 14:20:27 +0000 Subject: [PATCH] Fixed strskip Strskip wasn't preserving a properly. The new code uses the shadow af register, so whilst a byte and 4 cycles have been added outside the loop, it's safer and cleaner. The flags register isn't affected, but since the search goes for up to 64Kb I think it's safe to say the end of the string will always be reached. --- apps/lib/util.asm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/lib/util.asm b/apps/lib/util.asm index 3010ed6..df04d4f 100644 --- a/apps/lib/util.asm +++ b/apps/lib/util.asm @@ -80,16 +80,16 @@ strcmp: ; Given a string at (HL), move HL until it points to the end of that string. strskip: push bc - ld b, a + ex af, af' xor a ; look for null char + ld b, a ld c, a cpir ; advances HL regardless of comparison, so goes one too far dec hl - ld a, b + ex af, af' pop bc ret - ; Returns length of string at (HL) in A. ; Doesn't include null termination. strlen: