Inline SCPY

I'm planning a string reform and it's standing in the way.
This commit is contained in:
Virgil Dupras 2020-05-24 14:19:25 -04:00
parent a59322c252
commit 2d2a846b25
6 changed files with 4 additions and 15 deletions

View File

@ -5,9 +5,6 @@ LIT -- Write a LIT entry. You're expected to write
LIT< x -- Read following word and write to HERE as a LIT< x -- Read following word and write to HERE as a
string literal. string literal.
S= a1 a2 -- f Returns whether string a1 == a2. S= a1 a2 -- f Returns whether string a1 == a2.
SCPY a -- Copy string at addr a into HERE, without
NULL termination.

View File

@ -1,6 +0,0 @@
: SCPY
BEGIN ( a )
C@+ ( a+1 c )
?DUP NOT IF DROP EXIT THEN
C, ( a c )
AGAIN ;

View File

@ -1,5 +1,7 @@
: +! TUCK @ + SWAP ! ;
: [entry] ( w -- ) : [entry] ( w -- )
H@ SWAP SCPY ( h ) H@ SWAP
BEGIN C@+ ( w+1 c ) ?DUP IF C, 0 ELSE 1 THEN UNTIL DROP
H@ SWAP - ( sz ) H@ SWAP - ( sz )
( write prev value ) ( write prev value )
H@ CURRENT @ - , H@ CURRENT @ - ,

View File

@ -1,11 +1,7 @@
( Words here until the end of the low part, unlike words
preceeding them, aren't immediately needed for boot. But its
better to have as many words as possible in the xcomp part. )
: IMMEDIATE : IMMEDIATE
CURRENT @ 1- CURRENT @ 1-
DUP C@ 128 OR SWAP C! ; DUP C@ 128 OR SWAP C! ;
: IMMED? 1- C@ 0x80 AND ; : IMMED? 1- C@ 0x80 AND ;
: +! TUCK @ + SWAP ! ;
: -^ SWAP - ; : -^ SWAP - ;
: / /MOD NIP ; : / /MOD NIP ;
: MOD /MOD DROP ; : MOD /MOD DROP ;

View File

@ -1,9 +1,9 @@
: LIT< WORD 34 , BEGIN C@+ DUP C, NOT UNTIL DROP ; IMMEDIATE
: BEGIN H@ ; IMMEDIATE : BEGIN H@ ; IMMEDIATE
: AGAIN COMPILE (br) H@ - _bchk , ; IMMEDIATE : AGAIN COMPILE (br) H@ - _bchk , ; IMMEDIATE
: UNTIL COMPILE (?br) H@ - _bchk , ; IMMEDIATE : UNTIL COMPILE (?br) H@ - _bchk , ; IMMEDIATE
: [ INTERPRET ; IMMEDIATE : [ INTERPRET ; IMMEDIATE
: ] R> DROP ; : ] R> DROP ;
: LIT< WORD 34 , SCPY 0 C, ; IMMEDIATE
: LITA 36 , , ; : LITA 36 , , ;
: COMPILE ' LITA ['] , , ; IMMEDIATE : COMPILE ' LITA ['] , , ; IMMEDIATE
: [COMPILE] ' , ; IMMEDIATE : [COMPILE] ' , ; IMMEDIATE

Binary file not shown.