fix float overflow checki in printf_fast_f, bug #1525093
[fw/sdcc] / device / lib / gbz80 / asm_strings.s
index fd26392779e4e1a27223e3369045ad800346a6fb..6fceac208f3035f06e60b0f50315267671846aba 100644 (file)
@@ -5,42 +5,41 @@
 
 ; char *strcpy(char *dest, const char *source)
 _strcpy::
-       push    de
-       push    ix
-       ld      ix,#0
-       add     ix,sp
-       ld      l,6(ix)
-       ld      h,7(ix)
-       ld      e,8(ix)
-       ld      d,9(ix)
-
-       push    hl
-1$:    
-       ld      a,(de)
-       ld      (hl),a
+       lda     hl,2(sp)
+       ld      e,(hl)
+       inc     hl
+       ld      d,(hl)
        inc     hl
+       ld      a,(hl+)
+       ld      h,(hl)
+       ld      l,a
+
+       push    de
+1$:
+       ld      a,(hl+)
+       ld      (de),a
        inc     de
        or      a,a
-       jr      nz,1$
+       jr      NZ,1$
 
-       pop     hl
-       pop     ix
        pop     de
        ret
 
 ; void *memcpy(void *dest, const void *source, int count)
 _memcpy::
-       push    de
        push    bc
-       push    ix
-       ld      ix,#0
-       add     ix,sp
-       ld      l,8(ix)
-       ld      h,9(ix)
-       ld      e,10(ix)
-       ld      d,11(ix)
-       ld      c,12(ix)
-       ld      b,13(ix)
+       lda     hl,6(sp)
+       ld      e,(hl)
+       inc     hl
+       ld      d,(hl)
+       inc     hl
+       ld      c,(hl)
+       inc     hl
+       ld      b,(hl)
+       lda     hl,4(sp)
+       ld      a,(hl+)
+       ld      h,(hl)
+       ld      l,a
 
        inc     b
        inc     c
@@ -49,54 +48,48 @@ _memcpy::
        jr      2$
 1$:
        ld      a,(de)
-       ld      (hl),a
+       ld      (hl+),a
        inc     de
-       inc     hl
 2$:
        dec     c
-       jr      nz,1$
+       jr      NZ,1$
        dec     b
-       jr      nz,1$   
+       jr      NZ,1$
 
-       pop     hl
-       pop     ix
-       pop     bc
        pop     de
+       pop     bc
        ret
 
-; int strcmp(const char *s1, const char *s2) 
+; int strcmp(const char *s1, const char *s2)
 _strcmp::
-       push    de
-       push    ix
-       ld      ix,#0
-       add     ix,sp
-       ld      e,6(ix)
-       ld      d,7(ix)
-       ld      l,8(ix)
-       ld      h,9(ix)
+       lda     hl,2(sp)
+       ld      e,(hl)
+       inc     hl
+       ld      d,(hl)
+       inc     hl
+       ld      a,(hl+)
+       ld      h,(hl)
+       ld      l,a
 
        jr      1$
-2$:    
+2$:
        ld      a,(de)
        sub     (hl)
-       jr      nz,4$
+       jr      NZ,4$
        ;; A == 0
        cp      (hl)
-       jr      z,3$
-1$:    
+       jr      Z,3$
+1$:
        inc     de
        inc     hl
        jr      2$
 
 3$:
-       ld      hl,#0
+       ld      de,#0
        jr      5$
 4$:
-       ld      hl,#1
+       ld      de,#1
        jr      nc,5$
-       ld      hl,#-1
+       ld      de,#-1
 5$:
-       pop     ix
-       pop     de
        ret
-       
\ No newline at end of file