From cb9a4e91e1ade2458a19aeedbd23bdfc9d1fb30b Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 16 Dec 2003 21:10:18 +0000 Subject: [PATCH] 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 --- libsrc/common/memset.s | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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 -- 2.39.5