-
-
Save jacobly0/95198d34e859f6f768ed325bc8a19658 to your computer and use it in GitHub Desktop.
Optimized memset_fast to 23 bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; (c) Copyright 2016 Matt Waltz | |
;------------------------------------------------------------------------- | |
; Faster memset variation | |
; Reasons faster: | |
; 1) uses ldir to memset | |
; 2) executes in RAM to avoid flash wait states | |
;------------------------------------------------------------------------- | |
.def _memset_fast | |
.assume adl=1 | |
_memset_fast: | |
pop iy | |
pop hl | |
pop de | |
pop bc | |
push bc | |
push de | |
push hl | |
push iy | |
cpi | |
add hl,bc | |
ret c | |
dec hl | |
ld (hl),e | |
ret po | |
push hl | |
pop de | |
dec de | |
lddr | |
ret | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment