]> git.sur5r.net Git - cc65/commitdiff
Use .repeat to unroll the loop.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 16 Dec 2003 21:10:18 +0000 (21:10 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 16 Dec 2003 21:10:18 +0000 (21:10 +0000)
Squeeze out two bytes.

git-svn-id: svn://svn.cc65.org/cc65/trunk@2775 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/memset.s

index f9a1ecd08aee362fdceb6ba1db783ff7f8337f96..62c83fb5e6140f126c0e305aac0b901db50fe9de 100644 (file)
@@ -21,19 +21,17 @@ _bzero:
 __bzero:
         sta     ptr3
         stx     ptr3+1          ; Save n
-        lda     #0
-        sta     tmp1            ; fill with zeros
+        lda     #0             ; Fill with zeros
         beq     common
-
+       
 _memset:
        sta     ptr3            ; Save n
        stx     ptr3+1
        jsr     popax           ; Get c
-               sta     tmp1            ; Save c
 
 ; Common stuff for memset and bzero from here
 
-common:
+common:        sta     tmp1            ; Save the fill value
         ldy     #1
         lda     (sp),y
         tax
@@ -49,10 +47,10 @@ common:
 
 ; Set 256 byte blocks
 
-L1:    sta     (ptr1),y        ; Set one byte
+L1:            .repeat 2               ; Unroll this a bit to make it faster
+       sta     (ptr1),y        ; Set one byte
        iny
-       sta     (ptr1),y        ; Unroll this a bit to make it faster
-       iny
+       .endrepeat
        bne     L1
        inc     ptr1+1
                dex                     ; Next 256 byte block