(stdlib) Updated string routines

This commit is contained in:
Devine Lu Linvega 2024-01-09 20:21:14 -08:00
parent 8516126477
commit 94abf75cfb
1 changed files with 22 additions and 48 deletions

View File

@ -72,42 +72,33 @@
( (
@|stdlib ) @|stdlib )
@scap ( str* -- end* ) @scap ( str* -: end* )
LDAk ?&w INC2 & LDAk ?scap
JMP2r
&w ( -- )
INC2 LDAk ?&w
JMP2r JMP2r
@sput ( chr str* -- ) @slen ( str* -: len* )
scap INC2k #00 ROT ROT STA DUP2 scap/ SWP2 SUB2 JMP2r
@<scpy> ( src* dst* -: )
STH2
&w ( src* `dst* -- )
LDAk #00 STH2kr STA2
INC2r INC2 LDAk ?&w
POP2 POP2r JMP2r
@<sput> ( chr str* -: )
STH2
#00 STH2r scap/ STA2
JMP2r
@<sclr> ( str* -: )
STH2
#00 STH2r
&w ( -- )
STAk INC2 LDAk ?&w
STA STA
JMP2r JMP2r
@slen ( str* -- len* )
DUP2 scap SWP2 SUB2 JMP2r
@scat ( src* dst* -- )
scap
@scpy ( src* dst* -- )
OVR2 LDA ?&e
POP2 POP2 JMP2r
&e STH2
&w ( -- )
LDAk STH2kr STA
INC2r INC2 LDAk ?&w
POP2 #00 STH2r STA
JMP2r
@sclr ( str* -- )
LDAk ?&w
POP2 JMP2r
&w ( -- )
STH2k #00 STH2r STA
INC2 LDAk ?&w
POP2 JMP2r
@scmp ( a* b* -- f ) @scmp ( a* b* -- f )
STH2 STH2
&l ( -- ) &l ( -- )
@ -116,23 +107,6 @@
LDAk LDAkr STHr NEQ ?&d LDAk LDAkr STHr NEQ ?&d
INC2 INC2r !&l INC2 INC2r !&l
@scmp-fast ( a* b* -- f )
STH2
&l ( -- )
LDAk ?{
&d LDA LDAr STHr EQU JMP2r }
LDA2k LDA2kr STH2r NEQ2 ?{
INC2 INC2 INC2r INC2r !&l }
LDA2 LDA2r STH2r EQU2 JMP2r
@scmp-old ( a* b* -- f )
STH2
&l ( -- )
LDAk LDAkr STHr ANDk #00 EQU ?&e
NEQk ?&e
POP2 INC2 INC2r !&l
&e NIP2 POP2r EQU JMP2r
@sdec ( str* -- val* ) @sdec ( str* -- val* )
[ LIT2r 0000 ] [ LIT2r 0000 ]
&w ( -- ) &w ( -- )