mirror of
https://github.com/hsoft/collapseos.git
synced 2025-04-12 10:18:16 +10:00
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.
This commit is contained in:
parent
aa2852628b
commit
145eb65a8e
@ -80,16 +80,16 @@ strcmp:
|
|||||||
; Given a string at (HL), move HL until it points to the end of that string.
|
; Given a string at (HL), move HL until it points to the end of that string.
|
||||||
strskip:
|
strskip:
|
||||||
push bc
|
push bc
|
||||||
ld b, a
|
ex af, af'
|
||||||
xor a ; look for null char
|
xor a ; look for null char
|
||||||
|
ld b, a
|
||||||
ld c, a
|
ld c, a
|
||||||
cpir ; advances HL regardless of comparison, so goes one too far
|
cpir ; advances HL regardless of comparison, so goes one too far
|
||||||
dec hl
|
dec hl
|
||||||
ld a, b
|
ex af, af'
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; Returns length of string at (HL) in A.
|
; Returns length of string at (HL) in A.
|
||||||
; Doesn't include null termination.
|
; Doesn't include null termination.
|
||||||
strlen:
|
strlen:
|
||||||
|
Loading…
Reference in New Issue
Block a user