FORTH - DIARY.ZIP - WORDS.LST

 
Output of file : WORDS.LST contained in archive : DIARY.ZIP


FORTH-83 STARTING WORDS
FORTH-83 compared with STARTING-FORTH.
Leo Brodie/WWB 850807.
This list contains all the words in Brodie's STARTING FORTH,
all words whose meaning is determined by the Forth-83 Standard
document, and some words from the Laxen-Perry F83 Model,
Brodie's THINKING FORTH, Anderson & Tracy's MASTERING FORTH,
and Orange County FIG Chapter exhibits.
A number at the end of an entry refers to STARTING FORTH.
"(S" indicates starting words recommended by W. F. Ragsdale.
"(s" suggests further starting words.
S T A N D A R D W O R D S
! (S n,a -- )
Store number at address. 209
# ( du1, -- du2, )
Generate next digit of output string. 177
#> ( du, -- adr,len )
Complete output string. 177
#S ( du, -- 0., )
Generate remaining digits for output. 177
#TIB ( -- a )
Contains # of chars received by last "QUERY".
' xxx ( -- cfa )
Address of xxx. (S-F: -- pfa ) 246
( comment) (s -- )
(Immediate.) Comment.
* (S n1,n2 -- product )
53
*/ ( n1,n2,n3 -- n1*n2/n3 )
123
*/MOD ( n1,n2,n3 -- remainder,n1*n2/n3 )
123
+ (S n1,n2 -- sum )
53
+! (S n,a -- )
Increment contents at address. 209
+LOOP (S n1 -- )
(Compile-only, immediate.) 143
, (S n -- )
Store number in user's dictionary. 209
- (S n1,n2 -- difference )
53 103
--> (s -- )
(Immediate.) Interpretation continued on next block.
-TRAILING (S a1,len1 -- a1,len2 )
Trim trailing blanks. 283
. (S n -- )
Display number. 27
." message" (S -- )
(Compile-only, immediate.) Display message. 27
.( comment) (s -- )
(Immediate.) Display comment, even when compiling.
.R (s n,len -- )
Display number right justified.
/ (S n1,n2 -- quotient )
53
/MOD (S u1,u2 -- remainder,quotient )
53
0< (S n1 -- n1<0 )
103
0= (S n1 -- n1=0 )
103
0> (S n1 -- n1>0 )
103
1+ (S n1 -- n1+1 )
123
1- (S n1 -- n1-1 )
123
2! ( d,,a -- )
Store doublenumber at address. 210
2* (s n1 -- n1*2 )
DUP + ; 123
2+ (S n1 -- n1+2 )
123
2- (S n1 -- n1-2 )
123
2/ (s n1 -- n1/2 )
123
[email protected] ( a -- d, )
Doublenumber value at address. 210
2CONSTANT xxx ( Does: -- d1, ; d1 -- )
Define doublenumber constant. 210
2DROP ( n1,n2 -- )
DROP DROP ; 53
2DUP ( n1,n2 -- n1,n2,n1,n2 )
OVER OVER ; 53
2OVER ( n1,n2,n3,n4 -- n1,n2,n3,n4,n1,n2 )
53
2ROT ( n1,n2,n3,n4,n5,n6 -- n3,n4,n5,n6,n1,n2 )
(Hardly used.)
2SWAP ( n1,n2,n3,n4 -- n3,n4,n1,n2 )
53
2VARIABLE xxx ( -- ; Does: -- pfa )
Define doublenumber storage. 210
: xxx (S -- )
Colon-definition. 27
; (S -- )
Colon-definition. 27
;CODE ( sys -- )
(Assembler.)
< (S n1,n2 -- n1 103
<# ( du1, -- du1, )
Initiate output string for doublenumber. 177
(System.)
(System.)
= (S n1,n2 -- n1=n2 )
103
> (S n1,n2 -- n1>n2 )
103
>BODY ( cfa -- pfa )
Find pfa of given compilation address.
>IN ( -- a )
Contains character offset within input stream 247
>LINK ( cfa -- lfa )
(System.)
>MARK ( sys -- sys )
(System.)
>NAME ( cfa -- nfa )
(System.)
>R (S n1 -- ; R: -- n1 )
(Compile-only.) 123
>RESOLVE ( sys -- )
(System.)
?BRANCH ( flag -- )
(System.)
?DUP (S n1 -- n1,n1 -or- n1 )
DUP IF DUP THEN ; 103
@ (S a -- )
Value at address. 209
ABORT ( -- )
Clear stack and quit.
ABORT" fault" (s flag -- )
(Compile-only, immediate.) Abort message. 103
ABS (S n1 -- magnitude )
123
ALLOT (S n -- )
Reserve n bytes in user's dictionary. 209
ALSO ( -- )
Duplicate the first vocabulary in the search order.
AND (S n1,n2 -- and )
103
ASSEMBLER ( -- )
(Assembler.)
BASE ( -- a )
Contains active numeric conversion radix. 209
BEGIN (S -- )
(Compile-only, immediate.) 143
BL (s -- n )
The value of the space character (i.e, 32).
BLANK (s a,len -- )
BL FILL ; Fill string with space characters. 285
BLK ( -- a )
Contains block # of block being interpreted. 247
BLOCK (S u -- adr )
Address of buffer for block u. 283
BODY> ( pfa -- cfa )
(System.)
BRANCH ( -- )
(System.)
BUFFER ( u -- adr )
Address of buffer to use for block u. 283
C! (S n,a -- )
Store byte at address. 209
C, (S n -- )
Store byte in user's dictionary. 210
[email protected] (S a -- c )
Byte value at address. 209
CMOVE (S a1,a2,len -- )
Move data from a1 to a2. 284
CMOVE> (S a1,a2,len -- )
Move from a1+len-1. (S-F has " CODE xxx ( -- sys )
(System.)
COMPILE xxx ( -- )
Compile xxx. (Compile-only.) 313
CONSTANT xxx (S n1 -- ; Does: -- n1 )
Define number constant. 209
CONTEXT ( -- a )
Points to array of vocabularies in search order. 247
CONVERT ( d1,,a2 -- d3,,a4 )
(S-F has ">BINARY".) 284
COUNT (S a1 -- a1+1,c )
Convert counted string to text string. 284
CR (S -- )
Display newline or equivalent. 27
CREATE xxx (S -- ; Does: -- pfa )
Define next dictionary address. 209
CURRENT ( -- a )
Points to vocabulary for definitions. 247
D+ ( d1,,d2, -- sum, )
177
D- ( d1,,d2, -- difference, )
177
D. ( d, -- )
Disply doublenumber. 165
D.R ( d,,len -- )
Display doublenumber right justified. 179
D0= ( d1, -- d1=0. )
OR 0= ; 177
D2/ ( d1, -- d1/2, )
Arithmetic right shift.
D< ( d1,,d2, -- d1 177
D= ( d1,,d2 -- d1=d2 )
177
DABS ( d1, -- magnitude, )
177
DECIMAL (S -- )
10 BASE ! ; 177
DEFINITIONS ( -- )
CONTEXT @ CURRENT ! ; Set compilation vocabulary. 246
DEPTH ( -- n )
Number of elements on the stack. 83
DMAX ( d1,,d2, -- maximum, )
177
DMIN ( d1,,d2, -- minimum, )
177
DNEGATE ( d1, -- 2's complement, )
177
DO (S n2,n1 -- )
(Compile-only, immediate.) 143
DOES> ( -- a )
(Compile-only, immediate.) 313
DROP (S n1 -- )
53
DU< ( du1,,du2, -- du1 177
DUMP ( a,len -- )
Display contents of memory. 210
DUP (S n1 -- n1,n1 )
53
EDITOR ( -- )
(Not immediate. S-F: immediate.) 246
ELSE (S -- )
(Compile-only, immediate.) 103
EMIT (S c -- )
Display character c. 27
EMPTY-BUFFERS (S -- )
Mark all block buffers as unassigned. 283
END ( flag -- )
(Synonym for "UNTIL".) (DON'T USE.)
END-CODE ( sys -- )
(Assembler.)
ERASE (S a,len -- )
Fill string with nul characters. 0 FILL ; 210
EXECUTE ( cfa -- any )
(S-F: pfa -- any ) 246
EXIT ( -- )
(Compile-only.) (May not be used within DO-loop.) 246
EXPECT (S a1,len -- )
Receive up to len "cooked" characters. 284
FILL (S a,len,c -- )
Fill string with character "c". 209
FIND ( adr1 -- cfa,1 -or- cfa,-1 -or- adr1,0 )
Search dictionary.
FLUSH (S -- )
SAVE-BUFFERS EMPTY-BUFFERS ; 84
FORGET xxx (S -- )
Forget back through "xxx" in dictionary. 84
FORTH ( -- )
(Not immediate. S-F: immediate.) 246
FORTH-83 ( -- )
(Defined after all Forth-83 words.) (Never used.)
HERE ( -- a )
Address of next available dictionary location. 246
HEX (S -- )
16 BASE ! ; 177
HOLD ( c -- )
Generate character "c" in output string. 177
I (S -- loopindex )
(Not the same as "[email protected]".) 123
IF (S flag -- )
(Compile-only, immediate.) 103
IMMEDIATE ( -- )
Mark most recently compiled word as immediate. 313
INTERPRET ( any -- any )
Begin text interpretation of inputstream. 246
J ( -- 2nd innermost loopindex )
123
K ( -- 3rd innermost loopindex )
(Might not be available.)
KEY (S -- c )
Receive a "raw" character. 284
LEAVE (S -- )
(Compile-only, immediate.) Terminate loop. 143
L>NAME ( lfa -- nfa )
(System.)
LINK> ( lfa -- cfa )
(System.)
LIST ( u -- )
Display block u. 84
LITERAL ( n1 -- ; Later: -- n1)
(Compile-only, immediate.) 313
LOAD (S u -- )
Start text interpretation at top of block u. 84
LOOP (S -- )
(Compile-only, immediate.)
MAX (S n1,n2 -- maximum )
123
MIN (S n1,n2 -- minimum )
123
MOD (s u1,u2 -- remainder )
53
NAME> ( nfa -- cfa )
(System.)
N>LINK ( nfa -- lfa )
(System.)
NEGATE (S n1 -- 2's complement )
123
NOT (S n1 -- 1's complement )
NEGATE 1- ; 103
OCTAL ( -- )
8 BASE ! ; 177
OFFSET ( -- a )
Contains value added to # for BLOCK or BUFFER. 247
ONLY ( -- )
Make the search order to be only the "ONLY" vocabulary.
OR (S n1,n2 -- or )
103
ORDER ( -- )
Display search order.
OVER (S n1,n2 -- n1,n2,n1 )
53
PAD ( -- a )
Address of a scratch area for intermediate data. 246
PICK (S n[m],n[m-1],...,n[0],m
-- n[m],n[m-1],...,n[0],n[m])
QUERY ( -- )
Receive characters into TIB for parsing by WORD. 271
QUIT ( -- )
Clear return stack and return to terminal. 246
R> (S -- n1 ; R: n1 -- )
(Compile-only.) 123
[email protected] (s -- n1 ; R: n1 -- n1 )
(Not the same as "I".)
RECURSE ( any -- any )
(New name for "MYSELF".)
REPEAT (S -- )
(Compile-only, immediate.) 143
ROLL ( n[m],n[m-1],...,n[0],m--n[m-1],...,n[0],n[m])
(DON'T USE.)
ROT (S n1,n2,n3 -- n2,n3,n1 )
53
SAVE-BUFFERS ( -- )
Write updated buffers back to mass storage.
SCR ( -- a )
Contains the active editing screen number. 247
SEAL ( -- )
Eliminate the "ONLY" vocabulary from the search order.
SIGN ( n -- )
(Use "ROT SIGN" instead of S-F "SIGN".) 177
[email protected] ( -- a )
Address of stack top. (S-F has "'S".) (DON'T USE.)
SPACE (S -- )
Display one space. 27
SPACES (S n -- )
Display n spaces. 27
SPAN ( -- a )
Contains # of characters received by last "EXPECT".
STATE ( -- a )
Contains compilation state.
SWAP (S n1,n2 -- n2,n1 )
53
THEN (S -- )
(Compile-only, immediate.) 103
THRU (s u1,u2 -- )
Load block u1 thru u2.
TIB ( -- a )
Text input buffer. (S-F has "S0 @".) 247
TYPE (S a,len -- )
Display string. 283
U. (S u -- )
Display number unsigned. 177
U.R (S u,len -- )
Display number unsigned right justified. 143
U< (S u1,u2 -- u1 177
UM* ( u1,u2 -- unsigned double product, )
(New name for "U*".) 177
UM/MOD ( du,,u2 -- remainder,quotient )
(New name for "U/MOD".) 177
UNTIL (S flag -- )
(Compile-only, immediate.) 143
UPDATE (S -- )
Mark currently valid block buffer as modified. 283
VARIABLE xxx (S -- ; Does: -- pfa )
Define number storage. 209
VOCABULARY xxx ( -- )
Define vocabulary xxx.
WHILE (S flag -- )
(Compile-only, immediate.) 143
WORD ( c -- a )
Parse input for counted string delimited by c. 284
WORDS ( -- )
Display names in vocabulary. (New name for "VLIST".)
XOR ( n1,n2 -- exclusive or )
(Not mentioned in S-F.)
[ ( -- )
(Immediate.) Set interpret state. 313
['] xxx ( -- cfa )
(Compile-only, immediate.) Address of xxx. 247
[COMPILE] xxx ( -- )
(Compile-only, immediate.) 313
] ( -- )
Set compilation state. 313
S U P P L E M E N T A R Y W O R D S
" string" ( -- ??? )
(There is no consensus for this word. BE WARY.)
#OUT ( -- a )
Contains # of characters displayed since last CR .
(S any -- any) ( -- )
(Immediate.) Stack comment.
-ROT (s n1,n2,n3 -- n3,n1,n2 )
(S-F has " .S (s any -- same )
Non-destructive stack display. 83
/LOOP ( u -- )
(Compile-only, immediate.) (Use "+LOOP".) 177
;S ( -- )
Terminate interpretaton of a block. (Traditional.)
<> ( n1,n2 -- n1<>n2 )
= NOT ; (S-F generally uses "-".)
>TYPE ( a,len -- )
Move string to PAD and TYPE it. 285
2>R ( n1,n2 -- ; R: -- n1,n2 )
R> SWAP >R SWAP >R >R ;
2R> ( -- n1,n2 ; R: n1,n2 -- )
R> R> SWAP R> SWAP >R ;
? ( a -- )
@ . ; Display contents at address. 209
?DNEGATE ( d1,,n2 -- d3, )
0< IF DNEGATE THEN ;
?DO (s n2,n1 -- )
"2DUP = IF 2DROP ELSE DO ... [+]LOOP THEN"
?NEGATE ( n1,n2 -- n3 )
0< IF NEGATE THEN ;
?ENOUGH (s n -- )
Abort if fewer than n parameters.
?LEAVE (s flag -- )
(Compile-only, immediate) "IF LEAVE THEN"
?STACK ( -- )
Check for stack error. (S-F: -- f ) 103
AGAIN ( -- )
(Compile-only, immediate.) "0 UNTIL"
ASCII c (s -- c )
(Immediate.) Character literal. 1-9
AT ( h,v -- )
Set screen cursor position.
B ( -- )
Make the block before this the active editing block. 76
B/BUF ( -- n )
The size of a source block (i.e., 1024).
BEEP ( -- )
Sound audible alarm (when available).
BETWEEN ( n1,n2,n3 -- n2<=n1<=n2 )
1+ WITHIN ;
BINARY ( -- )
2 BASE ! 163
BOUNDS ( n1,n2 -- n1+n2,n1 )
OVER + SWAP ;
BUMP ( a -- )
1 SWAP +! ;
C+! ( n,a -- )
DUP [email protected] UNDER+ C! ;
C/L ( -- n )
The length of a source block line (usually 64).
CASE: xxx ... ; ( does: n -- any )
Simple case definition.
CELLS ( n1 -- n2 )
2* ; (Typically used like "n CELLS ALLOT".)
CHOOSE ( n1 -- n2 )
Random number < n1. 265
COMPARE ( a1,a2,len -- f)
(S-F has "-TEXT": a1,len,a2 -- f ) 285
COPY (S source,target -- )
Copy one block to another. 84
D2* ( dn1,, -- dn2,, )
2DUP D+ ;
DARK ( -- )
Clear screen. (S-F has "PAGE".) 143
DEBUG xxx ( -- )
Trace xxx when executed.
DEFER xxx ( -- )
Define an execution vector.
DP ( -- a )
Contains dict. pos'n. (S-F has "H".) (DON'T USE.)
DPL ( -- a )
Decimal point location. (S-F has "PTR".) 278
EMPTY ( -- )
Forget everything in the user's dictionary. 84
FALSE (s -- n )
Standard false value (i.e., 0).
FH ( n -- u )
BLK @ ?DUP 0= IF SCR @ THEN + ; Relative block #.
FLIP ( c1c2 -- c2c1 )
Exchange high- and low-bytes. A.k.a "><".
H. ( u -- )
Display number using base 16.
I' ( -- looplimit )
(Might not be available. DON'T USE.) 123
IS xxx ( n -- )
Redefine the parameter field of a CREATEd word.
KEY? ( -- f )
Check for keyboard attention.
L ( -- )
List the current editing block. 63
L/SCR ( -- n )
The number of lines in a source block (usually 16).
LEAP ( -- )
Exit from a single level DO-loop. (Thinking Forth)
M* ( n1,n2 -- d3, )
(Might not be available.) 179
M*/ ( d1,,n2,n3 -- d4, )
(Might not be available.) 179
M+ ( d1,,n2 -- d3, )
(Might not be available.) 179
M/ ( d1,,n2 -- n3 )
(Might not be available.) 179
N ( -- )
Make the next block the active editing block. 76
MOVE ( a1,a2,len -- )
>R 2DUP U< IF R> CMOVE> ELSE R> CMOVE THEN ;
NIP (s n1,n2 -- n2 )
SWAP DROP ;
NUF? ( -- flag )
KEY? DUP IF KEY 2DROP KEY = THEN ; (Mastering FOrth)
NUMBER ( a -- dn, )
Convert text to number. (S-F: a -- dn or n ) 284
OFF (s a -- )
FALSE SWAP ! ;
ON (s a,n -- )
TRUE SWAP ! ;
R# ( -- a )
Contains the active editing cursor position. 247
S>D ( n -- d, )
DUP 0< ; Convert single to double.
SEE xxx ( -- )
Decompile "xxx".
SLOT ( n,a -- 2*a+n )
SWAP 2* + ;
TEXT ( c -- )
Parse and move to PAD with blank extension. 284
TRUE (s -- n )
Standard true value (i.e., -1).
TUCK (s n1,n2 -- n2,n1,n2 )
SWAP OVER ;
U2/ ( u1 -- u2 )
Logical right shift.
UNDER+ ( n1,n2,n3 -- n1+n3,n2 )
ROT + SWAP ; (Thinking Forth)
WIPE (S -- )
SCR @ BUFFER B/BUF BLANK UPDATE ; 84
VALUE xxx ( n -- ; Does: -- n )
CREATE , DOES> @ ; (Like "CONSTANT".) (Mastering Forth)
VIEW xxx ( -- )
(S-F has "LOCATE".) (Might not be available.) 245
W ( -- )
Equivalent to "SAVE-BUFFERS" when editing.
WITHIN ( n1,n2,n3 -- n2<=n1 OVER - >R - R> U< ; 1-2
S T U D Y S E Q U E N C E
Chapter 1. FUNDAMENTAL FORTH 1-30
Chapter 2. HOW TO GET RESULTS 31-55 (omit p.50)
Chapter 3. THE EDITOR and staff 57-87
Chapter 4. DECISIONS, DECISIONS, ... 89-106
Chapter 5. THE PHILOSOPHY OF FIXED POINT 107-112
Chapter 6. THROW IT FOR A LOOP 127-147
Chapter 7. A NUMBER OF KINDS OF NUMBERS 149-163 only
Chapter 8. VARIABLES, CONSTANTS, AND ARRAYS 183-192 only
Chapter 9. UNDER THE HOOD. 242-243 only
Chapter 10. I/O AND YOU 253-268
Chapter 11. EXTENDING THE COMPILER
Chapter 12. THREE EXAMPLES 317-348
This list gives Forth-83 forms of Starting-Forth, and Forth-79
Standard, words. From the Forth-83 Standard it has all
required words, double number standard extension words,
controlled reference words, and the ONLY way of vocabulary
specification and control. It also includes supplementary
words of general acceptance. It is intended to be a practical
foundation for Forth programming.
The text associated with each word is just a reminder, and
should not be taken as a complete description or definition.
For this, consult the Forth-83 Standard document, or Anderson-
Tracy, MASTERING FORTH, or implementation source listings. Leo
Brodie, STARTING FORTH, is still a superlative guide, mutatis
mutandi, for learning Forth.
For completeness, all STARTING FORTH words and all words whose
meaning is prescribed by the Forth-83 Standard document have
been included. Some of these might not be defined in your
system, and others should be used only for system
implementation.
Classical implementations do not have "2ROT".
: 2ROT ( a,b,c,d,e,f -- c,d,e,f,a,b : short def'n.)
5 ROLL 5 ROLL ;
: 2ROT ( a,b,c,d,e,f -- c,d,e,f,a,b : fast? def'n.)
>R >R 2SWAP R> R> 2SWAP ;
In STARTING FORTH, "I'" gives the second item of the return
stack; in the Forth-83 uncontrolled reference words, it is
"used within a colon definition executed only from within a
do-loop to return the corresponding loop index." This is not
likely to be available. DON'T USE.
For implementations in which "DO" pushes three values on the
return stack.
: K ( -- i )
R> R> R> R> J -ROT >R >R ROT >R >R ;
For implementations in which "DO" pushes two values on the
return stack.
: K ( -- i )
R> R> R> J -ROT >R >R SWAP >R ;
Any definition of "ROLL" is very dependent on the
implementation. This is from the Laxen-Perry implementation.
: ROLL ( n[m],n[m-1],...,n[0],m -- n[m-1],...,n[0],n[m] )
>R [email protected] PICK [email protected] DUP 2+ R> 1+ 2* CMOVE> DROP ;
The definitions of "DP" and "[email protected]" are completely dependent on
the implementation and might not even make sense in some
implementations. E.g., The value of "DP" and the top elements
of the stack might be kept in registers or a different segment
The following words are required for some STARTING FORTH
exercises.
: M+ ( d1,,n2 -- d3, )
S>D D+ ;
: M* ( n1,n2 -- d3, )
2DUP XOR >R ABS SWAP ABS UM* R> ?DNEGATE ;
: M/MOD ( d1,,n2 -- rem,quot : This defines floored division.)
>R [email protected] ?DNEGATE S>D [email protected] ABS AND + [email protected] ABS UM/MOD
SWAP R> ?NEGATE SWAP ;
: M/ ( d1,,n2 -- quot )
M/MOD NIP ;
: M*/ ( d1,,n2,n3 -- d4, )
( If you use this often, rewrite in code.)
2DUP XOR -ROT ABS >R ABS >R OVER XOR -ROT DABS
SWAP [email protected] UM* ROT R> UM* ROT 0 D+ [email protected] UM/MOD -ROT R>
UM/MOD NIP SWAP ROT ?DNEGATE ;
: END ( flag -- )
[COMPILE] UNTIL ; IMMEDIATE
0 1 2 3 0. are usually constants. 210
( The following definition of "TEXT" does not allow leading
delimiters.)
84 CONSTANT C/PAD ( minimum capacity of PAD.)
: TEXT ( c -- )
PAD C/PAD BLANK WORD COUNT PAD SWAP C/PAD MIN CMOVE> ;