1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-22 23:29:55 +00:00

memset() optimizations from Peter Ferrie. Thanks Peter!

This commit is contained in:
David Schmenk 2014-06-15 16:26:30 -07:00
parent 2f50d5c6e2
commit a6e216f6ac
3 changed files with 65 additions and 77 deletions

View File

@ -168,25 +168,21 @@ asm memset
STA DSTH STA DSTH
INC ESTKL+1,X INC ESTKL+1,X
INC ESTKH+1,X INC ESTKH+1,X
- CLC
SETMLP DEC ESTKL+1,X SETMLP DEC ESTKL+1,X
BNE + BNE +
DEC ESTKH+1,X DEC ESTKH+1,X
BEQ SETMEX BEQ SETMEX
+ LDA ESTKL,X + LDA ESTKL,X
STA (DST),Y BCC +
LDA ESTKH,X
+ STA (DST),Y
INY INY
BNE + BNE +
INC DSTH INC DSTH
+ DEC ESTKL+1,X + BCS -
BNE + SEC
DEC ESTKH+1,X BCS SETMLP
BEQ SETMEX
+ LDA ESTKH,X
STA (DST),Y
INY
BNE SETMLP
INC DSTH
BNE SETMLP
SETMEX INX SETMEX INX
INX INX
RTS RTS
@ -618,14 +614,14 @@ end
; CFFA1 routines ; CFFA1 routines
; FILE I/O ; FILE I/O
; ;
def opendir ;def opendir
perr = syscall($10) ; perr = syscall($10)
return perr ; return perr
end ;end
def readdir ;def readdir
perr = syscall($12) ; perr = syscall($12)
return *CFFAEntryPtr ; return *CFFAEntryPtr
end ;end
def finddirentry(filename) def finddirentry(filename)
*CFFAFileName = filename *CFFAFileName = filename
perr = syscall($14) perr = syscall($14)
@ -905,38 +901,38 @@ end
; ;
; Command mode ; Command mode
; ;
def catalog ;def catalog
byte type, len ; byte type, len
word entry, filecnt ; word entry, filecnt
opendir ; opendir
repeat ; repeat
entry = readdir ; entry = readdir
if !perr ; if !perr
type = ^entry ; type = ^entry
if type ; if type
len = type & $0F ; len = type & $0F
^entry = len ; ^entry = len
prstr(entry) ; prstr(entry)
if type & $F0 == $D0 ; Is it a directory? ; if type & $F0 == $D0 ; Is it a directory?
cout('/') ; cout('/')
len = len + 1 ; len = len + 1
elsif (entry).$10 == $FF ; elsif (entry).$10 == $FF
cout('-') ; cout('-')
len = len + 1 ; len = len + 1
elsif (entry).$10 == $FE ; elsif (entry).$10 == $FE
cout('+') ; cout('+')
len = len + 1 ; len = len + 1
fin ; fin
for len = 19 - len downto 0 ; for len = 19 - len downto 0
cout(' ') ; cout(' ')
next ; next
fin ; fin
fin ; fin
until perr ; until perr
perr = 0 ; perr = 0
return crout() ; return crout()
end ;end
def stripchars(strptr) def stripchars(strptr)
while ^strptr and ^(strptr + 1) <> ' ' while ^strptr and ^(strptr + 1) <> ' '
memcpy(strptr + 1, strptr + 2, ^strptr) memcpy(strptr + 1, strptr + 2, ^strptr)
@ -1036,8 +1032,8 @@ while 1
quit quit
is 'M' is 'M'
syscall($02) syscall($02)
is 'C' ; is 'C'
catalog ; catalog
is '+' is '+'
execmod(cmdptr) execmod(cmdptr)
otherwise otherwise

View File

@ -193,25 +193,21 @@ asm memset
STA DSTH STA DSTH
INC ESTKL+1,X INC ESTKL+1,X
INC ESTKH+1,X INC ESTKH+1,X
- CLC
SETMLP DEC ESTKL+1,X SETMLP DEC ESTKL+1,X
BNE + BNE +
DEC ESTKH+1,X DEC ESTKH+1,X
BEQ SETMEX BEQ SETMEX
+ LDA ESTKL,X + LDA ESTKL,X
STA (DST),Y BCC +
LDA ESTKH,X
+ STA (DST),Y
INY INY
BNE + BNE +
INC DSTH INC DSTH
+ DEC ESTKL+1,X + BCS -
BNE + SEC
DEC ESTKH+1,X BCS SETMLP
BEQ SETMEX
+ LDA ESTKH,X
STA (DST),Y
INY
BNE SETMLP
INC DSTH
BNE SETMLP
SETMEX INX SETMEX INX
INX INX
RTS RTS

View File

@ -169,25 +169,21 @@ asm memset
STA DSTH STA DSTH
INC ESTKL+1,X INC ESTKL+1,X
INC ESTKH+1,X INC ESTKH+1,X
- CLC
SETMLP DEC ESTKL+1,X SETMLP DEC ESTKL+1,X
BNE + BNE +
DEC ESTKH+1,X DEC ESTKH+1,X
BEQ SETMEX BEQ SETMEX
+ LDA ESTKL,X + LDA ESTKL,X
STA (DST),Y BCC +
LDA ESTKH,X
+ STA (DST),Y
INY INY
BNE + BNE +
INC DSTH INC DSTH
+ DEC ESTKL+1,X + BCS -
BNE + SEC
DEC ESTKH+1,X BCS SETMLP
BEQ SETMEX
+ LDA ESTKH,X
STA (DST),Y
INY
BNE SETMLP
INC DSTH
BNE SETMLP
SETMEX INX SETMEX INX
INX INX
RTS RTS