From 35eb53c7f6420beeef7ac64f606070a46f56965e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 16 Nov 2017 19:03:03 +0000 Subject: [PATCH] z80: initial build fixes --- Applications/SmallC/Z80/lib/_ispunct.s | 1 - Applications/SmallC/Z80/lib/_isxdigit.s | 4 ++-- Applications/SmallC/Z80/lib/_memcpy.s | 17 ++++++------- Applications/SmallC/Z80/lib/_memset.s | 15 ++++++------ Applications/SmallC/Z80/lib/_strcat.s | 4 ++-- Applications/SmallC/Z80/lib/_strchr.s | 2 -- Applications/SmallC/Z80/lib/_strcmp.s | 4 ++-- Applications/SmallC/Z80/lib/_strcpy.s | 2 +- Applications/SmallC/Z80/lib/_strcspn.s | 2 +- Applications/SmallC/Z80/lib/_strncat.s | 16 ++++++------- Applications/SmallC/Z80/lib/_strncpy.s | 18 +++++++------- Applications/SmallC/Z80/lib/_strrchr.s | 1 - Applications/SmallC/Z80/lib/_strspn.s | 32 ------------------------- 13 files changed, 42 insertions(+), 76 deletions(-) delete mode 100644 Applications/SmallC/Z80/lib/_ispunct.s delete mode 100644 Applications/SmallC/Z80/lib/_strspn.s diff --git a/Applications/SmallC/Z80/lib/_ispunct.s b/Applications/SmallC/Z80/lib/_ispunct.s deleted file mode 100644 index 969bf850..00000000 --- a/Applications/SmallC/Z80/lib/_ispunct.s +++ /dev/null @@ -1 +0,0 @@ -ispunct.s \ No newline at end of file diff --git a/Applications/SmallC/Z80/lib/_isxdigit.s b/Applications/SmallC/Z80/lib/_isxdigit.s index b3a6878e..aaaecdd7 100644 --- a/Applications/SmallC/Z80/lib/_isxdigit.s +++ b/Applications/SmallC/Z80/lib/_isxdigit.s @@ -1,5 +1,5 @@ .code - .global _isxdigit + .export _isxdigit _isxdigit: pop bc pop hl push hl @@ -15,7 +15,7 @@ _isxdigit: pop bc cp '9'+1 jr nc, ret0 jr ret1 -ascii1: add 32 +ascii1: add a,32 ascii2: cp 'a' jr c, ret0 diff --git a/Applications/SmallC/Z80/lib/_memcpy.s b/Applications/SmallC/Z80/lib/_memcpy.s index e9781266..3fcf5952 100644 --- a/Applications/SmallC/Z80/lib/_memcpy.s +++ b/Applications/SmallC/Z80/lib/_memcpy.s @@ -4,16 +4,17 @@ _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 diff --git a/Applications/SmallC/Z80/lib/_memset.s b/Applications/SmallC/Z80/lib/_memset.s index b1f4ac72..4bc85d9f 100644 --- a/Applications/SmallC/Z80/lib/_memset.s +++ b/Applications/SmallC/Z80/lib/_memset.s @@ -4,11 +4,11 @@ _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 @@ -21,6 +21,7 @@ _memset: push ix 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 diff --git a/Applications/SmallC/Z80/lib/_strcat.s b/Applications/SmallC/Z80/lib/_strcat.s index 7764f389..d06e3742 100644 --- a/Applications/SmallC/Z80/lib/_strcat.s +++ b/Applications/SmallC/Z80/lib/_strcat.s @@ -17,9 +17,9 @@ _strcat_2: 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 diff --git a/Applications/SmallC/Z80/lib/_strchr.s b/Applications/SmallC/Z80/lib/_strchr.s index de206f14..91f73405 100644 --- a/Applications/SmallC/Z80/lib/_strchr.s +++ b/Applications/SmallC/Z80/lib/_strchr.s @@ -16,5 +16,3 @@ _strchr_1: ld a,(hl) ; "The terminting nul is considered part jr nz,_strchr_1 ld hl,0 ret - - \ No newline at end of file diff --git a/Applications/SmallC/Z80/lib/_strcmp.s b/Applications/SmallC/Z80/lib/_strcmp.s index 4a666f46..e067cfea 100644 --- a/Applications/SmallC/Z80/lib/_strcmp.s +++ b/Applications/SmallC/Z80/lib/_strcmp.s @@ -11,9 +11,9 @@ _strcmp: _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 diff --git a/Applications/SmallC/Z80/lib/_strcpy.s b/Applications/SmallC/Z80/lib/_strcpy.s index e1ce6114..8317c6d8 100644 --- a/Applications/SmallC/Z80/lib/_strcpy.s +++ b/Applications/SmallC/Z80/lib/_strcpy.s @@ -11,7 +11,7 @@ _strcpy: pop bc ;ret _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 diff --git a/Applications/SmallC/Z80/lib/_strcspn.s b/Applications/SmallC/Z80/lib/_strcspn.s index 0b77ff08..17f73b69 100644 --- a/Applications/SmallC/Z80/lib/_strcspn.s +++ b/Applications/SmallC/Z80/lib/_strcspn.s @@ -24,7 +24,7 @@ _strcspn_2: 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 diff --git a/Applications/SmallC/Z80/lib/_strncat.s b/Applications/SmallC/Z80/lib/_strncat.s index bf649ebf..3377224f 100644 --- a/Applications/SmallC/Z80/lib/_strncat.s +++ b/Applications/SmallC/Z80/lib/_strncat.s @@ -5,18 +5,18 @@ _strncat: 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 @@ -30,8 +30,8 @@ _strncat_1: 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 diff --git a/Applications/SmallC/Z80/lib/_strncpy.s b/Applications/SmallC/Z80/lib/_strncpy.s index 317afa97..b5efd431 100644 --- a/Applications/SmallC/Z80/lib/_strncpy.s +++ b/Applications/SmallC/Z80/lib/_strncpy.s @@ -3,14 +3,14 @@ _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 @@ -24,8 +24,8 @@ _strncpy_1: 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 diff --git a/Applications/SmallC/Z80/lib/_strrchr.s b/Applications/SmallC/Z80/lib/_strrchr.s index b970d5c2..c707aab9 100644 --- a/Applications/SmallC/Z80/lib/_strrchr.s +++ b/Applications/SmallC/Z80/lib/_strrchr.s @@ -24,4 +24,3 @@ _strrchr_3: ld b,h ld c,l jr _strrchr_1 - \ No newline at end of file diff --git a/Applications/SmallC/Z80/lib/_strspn.s b/Applications/SmallC/Z80/lib/_strspn.s deleted file mode 100644 index 0b77ff08..00000000 --- a/Applications/SmallC/Z80/lib/_strspn.s +++ /dev/null @@ -1,32 +0,0 @@ - .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 -- 2.34.1