

>TYPE
   TYPE for multitasking systems.
.(     Type the following string on the terminal.
(    The Forth Comment Character.  The input stream is skipped
  until a ) is encountered.
\S  comment to end of screen.

TRAVERSE
   Run through a name field in the specified direction.
   Terminate when a byte whose high order bit is on is detected.
DONE?
   True if the input stream is exhaused or state doesn't match
FORTH-83   Let's hope so.

CNHASH  given CFA, get pointer into >NAME hash table in YSEG.

CNSRCH  search for CFA between YA and MAXYA in YSEG.  Return
   NFA and failure flag.

N>LINK       Go from name field to link field.
L>NAME       Go from link field to name field.
BODY>        Go from body to code field.
NAME>        Go from name field to code field.
LINK>        Go from link field to code field.
>BODY        Go from code field to body.
>NAME        Go from code field to name field.
>LINK        Go from code field to link field.
>VIEW        Go from code field to view field.
VIEW>        Go from view field to code field.
HASH   Given a string address and a pointer to a set of
   vocabulary chains, returns the actual thread.  Uses the
   first character of the string to determine which thread.

(FIND)
   Does a search of the dictionary based on a pointer to a
   vocabulary thread and a string.   If it finds the string
   in the chain, it returns a pointer to the CFA field
   inside the header.  This field contains the code field
   address of the body.  If it was an immediate word the
   flag returned is a 1.  If it is non-immediate the flag
   returned is a -1.
   If the name was not found, the string address is returned
   along with a flag of zero. Note that links point to
   links, and are absolute addresses.

#THREADS   The number of seperate linked lists per vocabulary.
FIND
   Run through the vocabulary list searching for the name whose
   address is supplied on the stack.  If the name is found,
   return the code field address of the name and a non-zero
   flag.  The flag is -1 if the word is non-immediate and 1 if
   it is immediate.  If the name is not found, the string
   address is returned along with a false flag.

?UPPERCASE
  Convert the given string to upper case if CAPS is true.
DEFINED    Look up the next word in the input stream.  Return
   true if it exists, otherwise false. Maybe ignore case.

?STACK
   Check for parameter stack underflow or overflow and issue
   appropriate error message if detected.
STATUS   Indicate the current status of the system.
INTERPRET
   The Forth Interpret Loop.  If the next word is defined,
   execute it, otherwise convert it to a number and push it
   onto the stack.

ALLOT    Allocate more space in the dictionary
,        Set the contents of the dictionary value on the stack
C,       Same as , except uses an 8 bit value
ALIGN    Used to force even addresses.
EVEN     Makes the top of the stack an EVEN number.
COMPILE     Compile the following word when this def. executes
IMMEDIATE   Mark the last Header as an Immediate word.
LITERAL  Compile the single integer from the stack as a literal
DLITERAL
   Compile the double integer from the stack as a literal.
ASCII    Compile the next character in the input stream as a
   literal Ascii integer.
CONTROL  Compile the next character in the input stream as a
   literal Ascii Control Character.

CRASH   Default routine called by execution vectors.

?MISSING  Tell user the word does not exist.

'        Return the code field address of the next word
[']      Like ' only used while compiling
[COMPILE]   Force compilation of an immediate word
(")    Return the address and length of the inline string
(.")   Type the inline string.  Skip over it.
,"     Add the following text till a " to the dictionary.
."     Compile the string to be typed out later.
"      Compile the string, return pointer later.

FENCE   Limit address for forgetting.
TRIM   (S faddr voc-addr -- )
   Change the 4 hash pointers in a vocabulary so that they are
   all less than a specified value, faddr.

(FORGET)   (S code-addr relative-link-addr -- )
   Forgets part of the dictionary.  Both the code address and
   the header address are specified, and may be independant.
   (FORGET) resets all of the links and releases the space.

FORGET   (S -- )
   Forget all of the code and headers before the next word.

WHERE  Locates the screen and position following an error.
?ERROR  Maybe indicate an error. Change this to alter ABORT"
(?ERROR)
   Default for ?ERROR. Conditionally execute WHERE and type
   message.

(ABORT")
   The Runtime code compiled by ABORT". Uses ERROR, and
   updates return stack.
ABORT"
   If the flag is true, issue an error message and quit.
ABORT
       Stop the system and indicate an error.

?CONDITION
   Simple compile time error checking.  Usually adequate
>MARK        Set up for a Forward Branch
>RESOLVE     Resolve a Forward Branch
<MARK        Set up for a Backwards Branch
<RESOLVE     Resolve a Backwards Branch

?>MARK       Set up a forward Branch with Error Checking
?>RESOLVE    Resolve a forward Branch with Error Checking
?<MARK       Set up for a Backwards Branch with Error Checking
?<RESOLVE    Resolve a backwards Branch with Error Checking

LEAVE and ?LEAVE could be non-immediate in this system,
  but the 83 standard specifies an immediate LEAVE, so they
  both are for uniformity.
These are the compiling words needed to properly compile
the Forth Conditional Structures.  Each of them is immediate
and they must compile their runtime routines along with
whatever addresses they need.  A modest amount of error
checking is done.  If you want to rip out the error checking
change the ?> and ?< words to > and < words, and
all of the 2DUPs to DUPs and the 2SWAPs to SWAPs.  The rest
should stay the same.

,VIEW   Calculate and compile the VIEW field of the header.
"CREATE   Use the string at str to make a header, and initialize
  the code field.  First we check for duplicates.  Then we make
  entry in >NAME hash table if appropriate.  Next lay down the
  view field. Then we hook in to the correct thread an make the
  link field.  We set up LAST so that it points to our name
  field.  Then we copy the name to YSEG and delimit the name
  field bits.  Then we make the pointer in the YSEG to the CFA.
  Then we add a stopper entry to >NAME hash table in case of a
  large ALLOT or end of dictionary. Finally we lay down the
  code field.

CREATE   Make a header for the next word in the input stream.

!CSP        Save the current stack level for error checking.
?CSP        Issue error message if stack has changed.
HIDE        Removes the Last definition from the Header
            Dictionary.
REVEAL      Replaces the Last definition in the Header
            Dictionary.
(;USES)     Set the code field to the contents of following cell
ASSEMBLER   Define the vocabulary to be filled later.
;USES       Similar to the traditional ;CODE except used when
            run time code has been previously defined.
(;CODE)     Set the code field to the address of the following.
;CODE       Used for defining the run time portion of a defining
            word in low level code.
DOES>       Specifies the run time of a defining word in high
            level Forth.
[     Stop compiling and start interpreting
]     The Compiling Loop.  First sets Compile State.  Looks up
   the next word in the input stream and either executes it
   or compiles it depending upon whether or not it is immediate.
   If the word is not in the dictionary, it converts it to a
   number, either single or double precision depending on
   whether or not any punctuation was present.  Continues until
   input stream is empty or state changes.
:    Defines a colon definition. The definition is hidden until
   it is completed, or the user desires recursion.  The runtime
   for : adds a nesting level.
;     Terminates a colon definition.  Compiles the runtime code
   to remove a nesting level, and changes STATE so that
   compilation will terminate.

RECURSIVE   Allow the current definition to be self referencing
CONSTANT    A defining word that creates constants.  At runtime
   the value of the constant is placed on the stack.
VARIABLE    A defining word to create variables.  At runtime
   the address of the variable is placed on the stack.
DEFER    Defining word for execution vectors.  These are
   initially set to display an error message.  They are
   initialized with IS. DEFERS, installs the contents of a
defered word in the current definition being defined. This is
used to make a new word the defered word also, sort of a list.
VOCABULARY
   Defines a new Forth vocabulary.  VOC-LINK is a chain in
   temporal order and used by FORGET.  At runtime a vocabulary
   changes the search order by setting CONTEXT.
DEFINITIONS Subsequent definitions will be placed into CURRENT.
2CONSTANT
   Create a double number constant.  This is defined for
   completeness, but never used, so the code field is discarded.
2VARIABLE
   Create a double length variable.  This is defined for
   completeness, but never used, so the code field is discarded.
   as appropriate.

