]> git.sur5r.net Git - cc65/commitdiff
Speed optimization
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 18 Aug 2003 11:25:31 +0000 (11:25 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 18 Aug 2003 11:25:31 +0000 (11:25 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2362 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/strncpy.s

index 564814599f66c81ceabaf00d2e4e529cb8b46a17..21de3a15954824412f7d7a6a442bb585293c8c34 100644 (file)
@@ -42,19 +42,21 @@ L2:     lda     (ptr1),y        ; Copy one character
         inc     ptr2+1          ; Bump high bytes
         bne     L1              ; Branch always
 
-; Fill the remaining bytes. 
+; Fill the remaining bytes.
 
-L3:     inx
-        bne     L4
-        inc     tmp2
-        beq     L9
-
-L4:     sta     (ptr2),y
-L5:     iny
+L3:     inx                     ; Counter low byte
+        beq     L6              ; Branch on overflow
+L4:     sta     (ptr2),y        ; Clear one byte
+L5:     iny                     ; Bump pointer
         bne     L3
         inc     ptr2+1          ; Bump high byte
         bne     L3              ; Branch always
 
+; Bump the counter high byte
+
+L6:     inc     tmp2
+        bne     L4
+
 ; Done, return dest
 
 L9:     lda     ptr2            ; Get low byte