Bläddra i källkod

SCPY: don't copy the NULL

This makes [entry] much simpler. Also, remove unused LITS word.
pull/102/head
Virgil Dupras 4 år sedan
förälder
incheckning
b760c2d353
7 ändrade filer med 13 tillägg och 21 borttagningar
  1. +2
    -3
      blk/058
  2. +1
    -1
      blk/268
  3. +4
    -6
      blk/407
  4. +4
    -8
      blk/408
  5. +1
    -2
      blk/422
  6. +1
    -1
      blk/424
  7. Binär
      emul/forth.bin

+ 2
- 3
blk/058 Visa fil

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





+ 1
- 1
blk/268 Visa fil

@@ -8,7 +8,7 @@
DUP LIT< ( S= IF
DROP [COMPILE] (
ELSE
SCPY 0x20 H@ 1- C!
SCPY 0x20 C,
THEN 0 ( loop again )
ELSE 1 ( stop looping ) THEN
UNTIL


+ 4
- 6
blk/407 Visa fil

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



+ 4
- 8
blk/408 Visa fil

@@ -1,14 +1,10 @@
: [entry]
HERE @ ( w h )
SWAP SCPY ( h )
( Adjust HERE -1 because SCPY copies the null )
HERE @ 1- ( h h' )
DUP HERE ! ( h h' )
SWAP - ( sz )
HERE @ ( w h )
SWAP SCPY ( h )
HERE @ SWAP - ( sz )
( write prev value )
HERE @ CURRENT @ - ,
( write size )
C,
C, ( write size )
HERE @ CURRENT !
;



+ 1
- 2
blk/422 Visa fil

@@ -1,7 +1,6 @@
: [ INTERPRET ; IMMEDIATE
: ] R> DROP ;
: LITS 34 , SCPY ;
: LIT< WORD LITS ; IMMEDIATE
: LIT< WORD 34 , SCPY 0 C, ; IMMEDIATE
: LITA 36 , , ;
: '? WORD (find) ;
: '


+ 1
- 1
blk/424 Visa fil

@@ -7,7 +7,7 @@

40 is ASCII for '('. We do this to simplify XPACK's task of
not mistakenly consider '(' definition as a comment.
LITS: 34 == litWord
LIT<: 34 == litWord
LITA: 36 == addrWord
COMPILE: Tough one. Get addr of caller word (example above
(br)) and then call LITA on it. )

Binär
emul/forth.bin Visa fil


Laddar…
Avbryt
Spara