figForth word - CREATE
Some parts of this page/site are currently incomplete & will be updated asap
Other parts will change continually so use “Refresh” in your browser !!
There is extensive use of “Tooltips” text to support learning which do
not seem to render on a Smartphone
1774 86 DB 86H
1775 43524541 54 DB "CREAT"
177A C5 DB 'E'+80H
177B 6017 DW IDDOT-6
177D 950E CREAT: DW DOCOL
177F 0D10 0616 DW BL,WORD ; BL WORD
1783 1A11 DW HERE ; HERE
1785 990C DW DUP ; DUP
1787 E610 DW ONEP ; 1+
1789 110D DW CAT ; C@
178B 7A0B DW ZEQU ; 0=
178D 0908 DW ZBRAN ; IF
178F 0600 DW CREA2-$
1791 F00F 4417 DW FIVE,ERROR ; 5 ERROR
1795 D210 CREA2: DW CONT ; CONTEXT
1797 EA0C EA0C DW AT,AT ; @ @
179B D208 DW PFIND ; (FIND)
179D 0908 DW ZBRAN ; IF
179F 1700 DW CREA1-$
17A1 5A0C DW DROP ; DROP
17A3 6E12 DW NFA ; NFA
17A5 6617 DW IDDOT ; ID.
17A7 A914 DW PDOTQ ; (.")
17A9 0C DB 12
17AA 204E6F74 20556E69 DB " Not Unique "
17B2 71756520
17B6 1A11 CREA1: DW HERE ; HERE
17B8 990C DW DUP ; DUP
17BA 110D DW CAT ; C@
17BC E610 DW ONEP ; 1+
17BE 2A11 DW ALLOT ; ALLOT
17C0 990C DW DUP ; DUP
17C2 8407 A000 DW LIT,0A0H ; 0A0H
17C6 DC0C DW TOGGL ; TOGGLE
17C8 1A11 DW HERE ; HERE
17CA E00F DW ONE ; 1
17CC 5E11 DW SUBB ; -
17CE 8407 8000 DW LIT,80H ; 80H
17D2 DC0C DW TOGGL ; TOGGLE
17D4 4212 DW LATES ; LATEST
17D6 3611 DW COMMA ; ,
17D8 C510 DW CURR ; CURRENT
17DA EA0C DW AT ; @
17DC 300D DW STORE ; !
17DE 1A11 DW HERE ; HERE
17E0 E610 E610 DW ONEP,ONEP ; 1+ 1+
17E4 3611 DW COMMA ; '
17E6 0F0B DW SEMIS
“The header is created by the word CREATE and its derivatives, which are called defining words because they are used to create or define different classes of words” Ting 29
“All words in the same class have the same code field address in the code fields”
“The code field address points to a (machine) code routine which will interpret this word when this word is to be executed”
“The structure of a definition as compiled in the dictionary is shown in Fig. 4”
“CREATE creates a dictionary header for a new definition with name cccc”
“The new word is linked to the CURRENT vocabulary”
“The code field points to the parameter field, ready to compile a code definition”
“Used in the form:”
“CREATE cccc”
: CREATE ---
BL WORD Bring the next string delimited by blanks to the top of dictionary
HERE Save dictionary pointer as name field address to be linked
DUP C@ Get the length byte of the string
WIDTH @ WIDTH has the maximum number of characters allowed in the name field
MIN Use the smaller of the two, and
1+ ALLOT allocate space for name field, and advance DP to link field
DUP 0A0H TOGGLE byte of the name field. Make a 'smudged' head so that dictionary search will not find this name
HERE 1- 80H TOGGLE Toggle the eighth bit in the last character of the name as a delimiter to the name field
LATEST , Compile the name field address of the last word in the link field, extending the linking chain
CURRENT @ ! Update contents of LATEST in the current vocabulary
HERE 2+ , Compile the parameter field address into code field, for the convenience of a new code definition
For other types of definitions, proper code routine address will be compiled here
; Stop compiling the definition