Compare commits
2 Commits
9ad7ee7a4b
...
b760c2d353
Author | SHA1 | Date | |
---|---|---|---|
|
b760c2d353 | ||
|
231d727598 |
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.
|
||||
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.
|
||||
|
||||
|
||||
|
||||
|
2
blk/268
2
blk/268
@ -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
|
||||
|
10
blk/391
10
blk/391
@ -9,8 +9,8 @@ unusable directly. For the same reason, any reference to a word
|
||||
in the host system will obviously be wrong in the target
|
||||
system. More details in B260.
|
||||
|
||||
This unit is loaded in two "low" and "high" parts. The low part
|
||||
is the biggest chunk and has the most definitions. The high
|
||||
part is the "sensitive" chunk and contains "LITN", ":" and ";"
|
||||
definitions which, once defined, kind of make any more defs
|
||||
impossible. (cont.)
|
||||
These rules result in some practicals do's and dont's:
|
||||
|
||||
1. IF, UNTIL, AGAIN are fine, but *not* LOOP.
|
||||
|
||||
(cont.)
|
||||
|
6
blk/392
6
blk/392
@ -1,3 +1,9 @@
|
||||
This unit is loaded in two "low" and "high" parts. The low part
|
||||
is the biggest chunk and has the most definitions. The high
|
||||
part is the "sensitive" chunk and contains "LITN", ":" and ";"
|
||||
definitions which, once defined, kind of make any more defs
|
||||
impossible.
|
||||
|
||||
The gap between these 2 parts is the ideal place to put device
|
||||
driver code. Load the low part with "393 LOAD", the high part
|
||||
with "415 LOAD"
|
||||
|
14
blk/407
14
blk/407
@ -1,10 +1,6 @@
|
||||
: SCPY
|
||||
BEGIN ( a )
|
||||
DUP C@ ( a c )
|
||||
DUP C, ( a c )
|
||||
NOT IF DROP EXIT THEN
|
||||
1+ ( a+1 )
|
||||
AGAIN
|
||||
;
|
||||
|
||||
|
||||
BEGIN ( a )
|
||||
C@+ ( a+1 c )
|
||||
DUP NOT IF 2DROP EXIT THEN
|
||||
C, ( a c )
|
||||
AGAIN ;
|
||||
|
12
blk/408
12
blk/408
@ -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 !
|
||||
;
|
||||
|
||||
|
7
blk/412
7
blk/412
@ -1,3 +1,6 @@
|
||||
( 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. )
|
||||
: H@ HERE @ ;
|
||||
: IMMEDIATE
|
||||
CURRENT @ 1-
|
||||
@ -5,4 +8,8 @@
|
||||
;
|
||||
: +! SWAP OVER @ + SWAP ! ;
|
||||
: -^ SWAP - ;
|
||||
: / /MOD SWAP DROP ;
|
||||
: MOD /MOD DROP ;
|
||||
|
||||
: ALLOT HERE +! ;
|
||||
: CREATE (entry) 11 ( 11 == cellWord ) C, ;
|
||||
|
3
blk/422
3
blk/422
@ -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) ;
|
||||
: '
|
||||
|
2
blk/424
2
blk/424
@ -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. )
|
||||
|
7
blk/429
7
blk/429
@ -1,7 +0,0 @@
|
||||
: CREATE
|
||||
(entry) ( empty header with name )
|
||||
11 ( 11 == cellWord )
|
||||
C, ( write it )
|
||||
;
|
||||
|
||||
|
2
blk/431
2
blk/431
@ -1,7 +1,5 @@
|
||||
: VARIABLE CREATE 2 ALLOT ;
|
||||
: CONSTANT CREATE , DOES> @ ;
|
||||
: / /MOD SWAP DROP ;
|
||||
: MOD /MOD DROP ;
|
||||
|
||||
( In addition to pushing H@ this compiles 2>R so that loop
|
||||
variables are sent to PS at runtime )
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user