+++ /dev/null
-ispunct.s
\ No newline at end of file
.code
- .global _isxdigit
+ .export _isxdigit
_isxdigit: pop bc
pop hl
push hl
cp '9'+1
jr nc, ret0
jr ret1
-ascii1: add 32
+ascii1: add a,32
ascii2:
cp 'a'
jr c, ret0
_memcpy: push ix
ld ix,#0
add ix,sp
- ld e,4(ix)
- ld d,5(ix)
- ld l,6(ix)
- ld h,7(ix)
- ld c,8(ix)
- ld b,9(ix)
+ ld e,(ix+4)
+ ld d,(ix+5)
+ ld l,(ix+6)
+ ld h,(ix+7)
+ ld c,(ix+8)
+ ld b,(ix+9)
ld a,b
or c
jr z, _memcpy_none
ldir
-_memcpy_none: ld l,4(ix)
- ld h,5(ix)
+_memcpy_none: ld l,(ix+4)
+ ld h,(ix+5)
+ pop ix
ret
_memset: push ix
ld ix,0
add ix,sp
- ld h,4(ix)
- ld l,5(ix)
- ld e,6(ix)
- ld c,8(ix)
- ld b,9(ix)
+ ld h,(ix+4)
+ ld l,(ix+5)
+ ld e,(ix+6)
+ ld c,(ix+8)
+ ld b,(ix+9)
ld a,b
or c
jr z, _memset_none
ld d,h
inc de
ldir
-_memset_none: ld l,4(ix)
- ld h,5(ix)
+_memset_none: ld l,(ix+4)
+ ld h,(ix+5)
+ pop ix
ret
ld a,(hl)
ld (de),a
or a
- jr z _strcat_3
+ jr z,_strcat_3
inc hl
inc de
jr _strcat_2
-strcat_3: pop de
+_strcat_3: pop de
ret
jr nz,_strchr_1
ld hl,0
ret
-
-
\ No newline at end of file
_strcmp_1:
ld a,(de)
cp (hl)
- jr nz, strcmp_2
+ jr nz, _strcmp_2
or a
- jr z, strcmp_4
+ jr z, _strcmp_4
inc hl
inc de
jr _strcmp_1
_strcpy_1: ld a,(hl)
ld (de),a
or a
- jr z _strcpy_2
+ jr z,_strcpy_2
inc hl
inc de
jr _strcpy_1
ret z ; Matched HL ponts to right spot
inc de
jr _strcspn_2
-_strcpsn_3: pop de
+_strcspn_3: pop de
inc hl
jr _strcspn_1
_strcspn_4: ld h,a ; A always 0 here
push ix
ld ix,#0
add ix,sp
- ld l,4(ix)
- ld h,5(ix)
+ ld l,(ix+4)
+ ld h,(ix+5)
xor a
ld b,a
ld c,a
; Move past end of original string
cpir
dec hl
- ld e,6(ix)
- ld d,7(ix)
- ld c,8(ix)
- ld b,9(ix)
+ ld e,(ix+6)
+ ld d,(ix+7)
+ ld c,(ix+8)
+ ld b,(ix+0)
; Copy bytes until limit or \0
_strncat_1:
ld a,b
inc hl
dec bc
jr _strncat_1
-_strncat_2: ld l,4(ix)
- ld h,5(ix)
+_strncat_2: ld l,(ix+4)
+ ld h,(ix+5)
pop ix
ret
; Copy \0 until limit
_strncpy:
push ix
- ld ix,#0
+ ld ix,0
add ix,sp
- ld l,4(ix)
- ld h,5(ix)
- ld e,6(ix)
- ld d,7(ix)
- ld c,8(ix)
- ld b,9(ix)
+ ld l,(ix+4)
+ ld h,(ix+5)
+ ld e,(ix+6)
+ ld d,(ix+7)
+ ld c,(ix+8)
+ ld b,(ix+9)
; Copy bytes until limit or \0
_strncpy_1:
ld a,b
inc hl
dec bc
jr _strncpy_1
-_strncpy_2: ld l,4(ix)
- ld h,5(ix)
+_strncpy_2: ld l,(ix+4)
+ ld h,(ix+5)
pop ix
ret
; Copy \0 until limit
ld b,h
ld c,l
jr _strrchr_1
-
\ No newline at end of file
+++ /dev/null
- .code
- .export _strcspn
-
-_strcspn:
- pop bc
- pop hl ; string
- pop de ; match
- push de
- push hl
- push bc
-
-_strcspn_1:
- ld a,(hl)
- or a
- jr z,_strcspn_4
- ld c,a
-
- push de
-_strcspn_2:
- ld a,(de)
- or a
- jr z, _strcspn_3
- cp c
- ret z ; Matched HL ponts to right spot
- inc de
- jr _strcspn_2
-_strcpsn_3: pop de
- inc hl
- jr _strcspn_1
-_strcspn_4: ld h,a ; A always 0 here
- ld l,a
- ret