mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:38:05 +11:00
SCPY: don't copy the NULL
This makes [entry] much simpler. Also, remove unused LITS word.
This commit is contained in:
parent
231d727598
commit
b760c2d353
5
blk/058
5
blk/058
@ -4,10 +4,9 @@ LIT -- Write a LIT entry. You're expected to write
|
|||||||
actual string to HERE right afterwards.
|
actual string to HERE right afterwards.
|
||||||
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.
|
||||||
LITS a -- Write word at addr a as a atring 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.
|
SCPY a -- Copy string at addr a into HERE, without
|
||||||
|
NULL termination.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
blk/268
2
blk/268
@ -8,7 +8,7 @@
|
|||||||
DUP LIT< ( S= IF
|
DUP LIT< ( S= IF
|
||||||
DROP [COMPILE] (
|
DROP [COMPILE] (
|
||||||
ELSE
|
ELSE
|
||||||
SCPY 0x20 H@ 1- C!
|
SCPY 0x20 C,
|
||||||
THEN 0 ( loop again )
|
THEN 0 ( loop again )
|
||||||
ELSE 1 ( stop looping ) THEN
|
ELSE 1 ( stop looping ) THEN
|
||||||
UNTIL
|
UNTIL
|
||||||
|
6
blk/407
6
blk/407
@ -1,8 +1,6 @@
|
|||||||
: SCPY
|
: SCPY
|
||||||
BEGIN ( a )
|
BEGIN ( a )
|
||||||
C@+ ( a+1 c )
|
C@+ ( a+1 c )
|
||||||
DUP C, ( a c )
|
DUP NOT IF 2DROP EXIT THEN
|
||||||
NOT IF DROP EXIT THEN
|
C, ( a c )
|
||||||
AGAIN ;
|
AGAIN ;
|
||||||
|
|
||||||
|
|
||||||
|
8
blk/408
8
blk/408
@ -1,14 +1,10 @@
|
|||||||
: [entry]
|
: [entry]
|
||||||
HERE @ ( w h )
|
HERE @ ( w h )
|
||||||
SWAP SCPY ( h )
|
SWAP SCPY ( h )
|
||||||
( Adjust HERE -1 because SCPY copies the null )
|
HERE @ SWAP - ( sz )
|
||||||
HERE @ 1- ( h h' )
|
|
||||||
DUP HERE ! ( h h' )
|
|
||||||
SWAP - ( sz )
|
|
||||||
( write prev value )
|
( write prev value )
|
||||||
HERE @ CURRENT @ - ,
|
HERE @ CURRENT @ - ,
|
||||||
( write size )
|
C, ( write size )
|
||||||
C,
|
|
||||||
HERE @ CURRENT !
|
HERE @ CURRENT !
|
||||||
;
|
;
|
||||||
|
|
||||||
|
3
blk/422
3
blk/422
@ -1,7 +1,6 @@
|
|||||||
: [ INTERPRET ; IMMEDIATE
|
: [ INTERPRET ; IMMEDIATE
|
||||||
: ] R> DROP ;
|
: ] R> DROP ;
|
||||||
: LITS 34 , SCPY ;
|
: LIT< WORD 34 , SCPY 0 C, ; IMMEDIATE
|
||||||
: LIT< WORD LITS ; IMMEDIATE
|
|
||||||
: LITA 36 , , ;
|
: LITA 36 , , ;
|
||||||
: '? WORD (find) ;
|
: '? WORD (find) ;
|
||||||
: '
|
: '
|
||||||
|
2
blk/424
2
blk/424
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
40 is ASCII for '('. We do this to simplify XPACK's task of
|
40 is ASCII for '('. We do this to simplify XPACK's task of
|
||||||
not mistakenly consider '(' definition as a comment.
|
not mistakenly consider '(' definition as a comment.
|
||||||
LITS: 34 == litWord
|
LIT<: 34 == litWord
|
||||||
LITA: 36 == addrWord
|
LITA: 36 == addrWord
|
||||||
COMPILE: Tough one. Get addr of caller word (example above
|
COMPILE: Tough one. Get addr of caller word (example above
|
||||||
(br)) and then call LITA on it. )
|
(br)) and then call LITA on it. )
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user