From: cuz Date: Tue, 16 Dec 2003 21:10:18 +0000 (+0000) Subject: Use .repeat to unroll the loop. X-Git-Tag: V2.12.0~1033 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cb9a4e91e1ade2458a19aeedbd23bdfc9d1fb30b;p=cc65 Use .repeat to unroll the loop. Squeeze out two bytes. git-svn-id: svn://svn.cc65.org/cc65/trunk@2775 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/common/memset.s b/libsrc/common/memset.s index f9a1ecd08..62c83fb5e 100644 --- a/libsrc/common/memset.s +++ b/libsrc/common/memset.s @@ -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