1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-27 14:29:52 +00:00

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
This commit is contained in:
cuz 2003-12-16 21:10:18 +00:00
parent 5e3a3eaed1
commit cb9a4e91e1

View File

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