mirror of
https://github.com/KarolS/millfork.git
synced 2024-08-28 20:29:01 +00:00
38 lines
678 B
Plaintext
38 lines
678 B
Plaintext
|
#pragma zilog_syntax
|
||
|
|
||
|
byte strzlen(pointer str) {
|
||
|
pointer end
|
||
|
end = str
|
||
|
while end[0] != 0 {
|
||
|
end += 1
|
||
|
}
|
||
|
return lo(end - str)
|
||
|
}
|
||
|
|
||
|
sbyte strzcmp(pointer str1, pointer str2) {
|
||
|
while true {
|
||
|
if str1[0] == 0 {
|
||
|
if str2[0] == 0 {
|
||
|
return 0
|
||
|
} else {
|
||
|
return -1
|
||
|
}
|
||
|
} else if str1[0] != str2[0] {
|
||
|
if str1[0] < str2[0] { return -1 }
|
||
|
return 1
|
||
|
}
|
||
|
str1 += 1
|
||
|
str2 += 1
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void strzcopy(pointer dest, pointer src) {
|
||
|
byte c
|
||
|
do {
|
||
|
c = src[0]
|
||
|
dest[0] = c
|
||
|
src += 1
|
||
|
dest += 1
|
||
|
} while c != 0
|
||
|
}
|