_strncasecmp
_strpbrk
_strspn
-_strstr
_strxfrm
-_memcpy
_memccpy
_memchr
_memmove
-_memset
_bcopy
_bzero
-_bswap
_ispunct
--- /dev/null
+ .code
+ .export _bzero
+
+_bzero: pop af
+ pop hl
+ pop de
+ push de
+ push hl
+ push af
+ push bc
+ ld c,e
+ ld b,d
+ ld a,b
+ or c
+ jr z, _bzero_1
+ ld (hl),0
+ dec bc
+ ld a,b
+ or c
+ jr z,_bzero_1
+ ld e,l
+ ld d,h
+ inc de
+ ldir
+_bzero_1:
+ pop bc
+ ret
\ No newline at end of file
.code
.export _isalnum
-_isalnum: pop bc
+_isalnum: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
cp '9'
jr nc, isalnum1
.code
.export _isalpha
-_isalpha: pop bc
+_isalpha: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
cp 'a'
jr c, isalpha1
.code
.export _isascii
-_isascii: pop bc
+_isascii: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
cp 32
jr c, ret0
.code
.export _isblank
-_isblank: pop bc
+_isblank: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
; Space
cp 32
.code
.export _iscntrl
-_iscntrl: pop bc
+_iscntrl: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
; Space
cp 32
.code
.export _isdigit
-_isdigit: pop bc
+_isdigit: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
cp '0'
jr c, ret0
.code
.export _isgraph
-_isgraph: pop bc
+_isgraph: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
cp 33
jr c, ret0
.code
.export _islower
-_islower: pop bc
+_islower: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
; Space
cp 'a'
.code
.export _isprint
-_isprint: pop bc
+_isprint: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
cp 32
jr c, ret0
.code
.export _isspace
-_isspace: pop bc
+_isspace: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
; Space
cp 32
.code
.export _isupper
-_isupper: pop bc
+_isupper: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
; Space
cp 'A'
.code
.export _isxdigit
-_isxdigit: pop bc
+_isxdigit: pop de
pop hl
push hl
- push bc
+ push de
ld a,l
; Space
cp '0'
.export _memset
_memset: push ix
+ push bc
ld ix,0
add ix,sp
ld h,(ix+4)
ldir
_memset_none: ld l,(ix+4)
ld h,(ix+5)
+ pop bc
pop ix
ret
.code
.export _strcat
-_strcat: pop bc ;ret
+_strcat: pop af ;ret
pop de ;dest
pop hl ;src
push hl
push de
- push bc
+ push af
push de ; for return code
_strcat_1: ld a,(de)
or a
.export _strchr
_strchr:
- pop de ; char
+ pop af
pop hl ; ptr
- pop bc
- push bc
- push hl
+ pop de ; char
push de
+ push hl
+ push af
_strchr_1: ld a,(hl) ; "The terminting nul is considered part
cp e ; of the string"
ret z
.export _strcmp
_strcmp:
- pop bc
+ pop af
pop de
pop hl
push hl
push de
+ push af
_strcmp_1:
ld a,(de)
.code
.export _strcpy
-_strcpy: pop bc ;ret
+_strcpy: pop af ;ret
pop de ;dest
pop hl ;src
push hl
push de
- push bc
+ push af
push de ; for return code
_strcpy_1: ld a,(hl)
ld (de),a
.export _strcspn
_strcspn:
- pop bc
+ pop af
pop hl ; string
pop de ; match
push de
push hl
- push bc
+ push af
_strcspn_1:
ld a,(hl)
pop de
push de
push hl
+ push bc
xor a
ld b,a
ld c,a
cpir
dec hl
sbc hl,de
+ pop bc
ret
_strncat:
push ix
+ push bc
ld ix,#0
add ix,sp
ld l,(ix+4)
jr _strncat_1
_strncat_2: ld l,(ix+4)
ld h,(ix+5)
+ pop bc
pop ix
ret
; Copy \0 until limit
.export _strrchr
_strrchr:
- pop de ; char
+ pop af
pop hl ; ptr
- pop bc
- push bc
+ pop de ; char
+ push de
push hl
+ push af
push de
+ push bc
ld bc, 0
_strrchr_1: ld a,(hl)
or a
_strrchr_2:
ld h,b
ld l,c
+ pop bc
ret
_strrchr_3:
ld b,h
--- /dev/null
+ .code
+ .export _swab
+
+_swab: pop bc
+ pop hl
+ pop de
+ push de
+ push hl
+ push bc
+ push bc
+_swab1
+ bit 7,d
+ ret nz
+ ld a,d
+ or e
+ ret z
+ ld a,(hl)
+ inc hl
+ ld c,(hl)
+ ld (hl),a
+ dec hl
+ ld (hl),c
+ inc hl
+ inc hl
+ dec de
+ dec de
+ jr _swab1
+
\ No newline at end of file