home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFB.ZIP / FFHLP.ARC / FF.TXT < prev    next >
Encoding:
Text File  |  1987-12-14  |  47.6 KB  |  1,362 lines

  1. PF.TXT                  THE FF USERS MANUAL
  2.  
  3.  
  4.  
  5.                          Table of contents
  6.  
  7.  
  8.          Overview   FF, What is it all about _________________   2
  9.  
  10.          1.         Getting Started __________________________   2
  11.  
  12.          2.         Sequential File Forth: An Overview ________  6
  13.  
  14.          3.         What is the same as F83? __________________  8
  15.  
  16.          4.         What is different from F83? _______________  9
  17.  
  18.          5.         Differences from PF, ZF & DF ______________ 10
  19.  
  20.          6.         SED: The Editor ___________________________ 11
  21.  
  22.          7.         The Debugger, and the Tools Available _____ 19
  23.  
  24.          8.         DOS: The interface ________________________ 25
  25.  
  26.          9.         Memory Management in FF ___________________ 27
  27.  
  28.         10.         The File System and Handles _______________ 28
  29.  
  30.         11.         Rebuilding the System _____________________ 28
  31.  
  32.         12.         FF and Batch Files ________________________ 29
  33.  
  34.         13.         Extra stuff included with FF ______________ 30
  35.  
  36.         14.         Forth History: how did we get here? _______ 30
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  Overview        FF, What is it all about?
  58.  
  59.           The first thing you should know is that FF is trying to
  60.         achieve a number of conflicting goals.  With FF I am trying
  61.         to provide a Forth system that provides all of the following:
  62.  
  63.                 A system that is familiar to the large
  64.                 installed base F83 users.
  65.  
  66.                 A system that brings Forth fully into the
  67.                 realm of files.
  68.  
  69.                 A Forth system that is as unstrange as
  70.                 possible to C and Pascal programmers.
  71.  
  72.                 A system which maintains Forths interactive
  73.                 nature.
  74.  
  75.                 A system which if FAST to compile and run.
  76.  
  77.                 A FAT system with many tools, which still
  78.                 has room for an application program.
  79.  
  80.           Impossible, you say. Perhaps, but I think if you give FF a
  81.         chance you may find some things you like.
  82.  
  83.           In line with the above goals, here is a list of some of
  84.         FF's major features.
  85.  
  86.                 Direct threaded dictionary for speed.
  87.  
  88.                 Seperated lists & heads to increase space.
  89.  
  90.                 Prefix assembler to enhance readability.
  91.  
  92.                 Assembler supports both Prefix as well as
  93.                 Postfix assembly syntax for familiarity.
  94.  
  95.                 Full DOS access from system and COMMAND
  96.                 level control.
  97.  
  98.                 Full Handle/Path based file system.
  99.  
  100.                 View works across directory boundries.
  101.  
  102.                 Full user configurable sequential text
  103.                 editor provided in source.
  104.  
  105.                 Full DOS memory managment interface.
  106.  
  107.           Much more of course is provided, but enough of this
  108.         editorializing. Let's get started.
  109.  
  110.  
  111.  
  112.  1. Getting Started
  113.  
  114.           FF is a Forth system whose origins can be traced back to
  115.         F83. FF has been tailored to use sequential files for source,
  116.         and all references to BLOCK have been removed. While this may
  117.         seem very strange at first, allow me a few minutes, and you
  118.         will, I believe, find FF to be more familiar than you might
  119.         expect.
  120.  
  121.         Installing FF
  122.  
  123.           FF is provided on a single floppy disk, which you have
  124.         already copied FF onto your hard disk and expanded or you
  125.         wouldn't be reading this.  To install FF, you will need only
  126.         type the name of the batch file which will set the paths of
  127.         some of the files to be loaded to your current directory
  128.         structure.
  129.  
  130.                 Type:   INSTALL <enter>
  131.  
  132.           If you don't have a batch file called INSTALL.BAT, then you
  133.         can type the command manually as follows:
  134.  
  135.                 Type:   PKERNEL - SEQINIT FLOAD FF.SEQ <enter>
  136.  
  137.           Either of the above will re-compile FF from the PKERNEL
  138.         file, configuring FF for your directory structure in the
  139.         process.
  140.  
  141.           You will probably want to read the screen while the install
  142.         is taking place, as several interesting messages are
  143.         displayed while the installation occurs.
  144.  
  145.         Starting FF
  146.  
  147.           Once FF has been installed on your computer, you can start
  148.         it up by typing "FF <enter>" from the keyboard.  This will
  149.         display a signon message about the version number, available
  150.         memory, authors, etc.
  151.  
  152.         Opening a file:
  153.  
  154.           Type the following:   OPEN BANNER <enter>
  155.  
  156.           The file BANNER.SEQ will be opened.  We can load it with:
  157.  
  158.                                 1 LOAD <enter>
  159.  
  160.           This prints a nice demo message.  This demo came from the
  161.         F83X system.
  162.  
  163.           We can edit the source for BANNER by typing:
  164.  
  165.                                 ED <enter>
  166.  
  167.           You will now be in the editor, viewing the first 20 lines
  168.         or so of BANNER.SEQ.  You can page down through the file with
  169.         the PgDn key on the keypad, and back up with the PgUp key.
  170.         For now, page down to the bottom of the file with PgDn, and
  171.         there you see the definition of the word DEMO, which prints
  172.         out our demonstration banner.
  173.  
  174.           Now let's create a new file and put a new DEMO definition
  175.         with our own banner message in it.  Leave the editor by
  176.         typing Shift-ESC twice, that is, hold down the Shift key and
  177.         press the ESC key two times.  You will now be back in Forth
  178.         without saving any changes you may have accidently made to
  179.         BANNER.SEQ.
  180.  
  181.           To create the new file, type the following:
  182.  
  183.                 SED MYBANNER <enter>
  184.  
  185.           FF will start the editor, and try to open the file
  186.         MYBANNER.  If it is present, FF will open it.  If it is not,
  187.         then FF will automatically create a new file called
  188.         MYBANNER.SEQ and place you in the editor in that file,
  189.         prepared to enter text.
  190.  
  191.           Type in the following definition, using the <enter> key to
  192.         add new lines to the file as needed.  The arrow keys can be
  193.         used to move around, but you will not be allowed to move
  194.         below the line containing the little up pointing triangle at
  195.         the left edge of the screen, as this represents the end of
  196.         the current file.
  197.  
  198.         : MYBANNER      ( --- )
  199.                         " HELLO" BANNER
  200.                         " FROM" BANNER
  201.                         " YOURNAME" BANNER ;
  202.  
  203.           Note that YOURNAME must be no longer than 11 characters.
  204.  
  205.           Now that you have typed in or edited the above definition
  206.         into the file BANNER.SEQ, leave the editor saving the text
  207.         you have entered, by pressing ESC twice.  DON'T use Shift
  208.         this time, as we REALLY want to save the program.
  209.  
  210.           Let's compile the program.  Type:
  211.  
  212.                         FLOAD MYBANNER <enter>
  213.  
  214.           The file MYBANNER.SEQ is opened, and loaded.  If you
  215.         entered the program as shown, then all should be well, and
  216.         Forth should come back with the "ok" message.  You could have
  217.         compiled the program by typing 1 LOAD <enter>, since the file
  218.         was already open.
  219.  
  220.  
  221.  
  222.           Now that MYBANNER is compiled, type its name to make it do
  223.         it's stuff:
  224.  
  225.                         MYBANNER <enter>
  226.  
  227.           You should have seen your name scroll up on the screen, if
  228.         you didn't, try editing the source file and correcting your
  229.         typing error.
  230.  
  231.           At this point, you can VIEW the source for MYBANNER by
  232.         typing:
  233.                         VIEW MYBANNER <enter>
  234.  
  235.           FF will locate the source for your MYBANNER word, and
  236.         display the source file starting at the line where MYBANNER
  237.         was started.  A shorter word for VIEW called LL (Locate &
  238.         List) is provided to save typing.
  239.  
  240.           Now let's look at some Forth words with LL, and some of the
  241.         other file traversal words.  Type:
  242.  
  243.                         LL DUP <enter>
  244.  
  245.           The source for DUP will be displayed, with the line where
  246.         the definition of DUP starts underlined.  Above the line
  247.         where DUP starts is the reverse video message showing the
  248.         filename of the source for DUP. Now type:
  249.  
  250.                         N <enter>
  251.  
  252.           The screen will blink and display group of lines starting
  253.         16 lines farther into the KERNEL1.SEQ source file.  With the
  254.         "N" word, you can scan quickly through a sequential file.
  255.         The inverse of "N" is "B".  If you type it followed by
  256.         <enter>, the previous 16 lines will be displayed.  Another
  257.         display word "L" is provided to redisplay the current
  258.         location in the file again.
  259.  
  260.  
  261.           One last word you will find VERY useful is WORDS.  It is
  262.         used as follows:
  263.  
  264.                         WORDS HE <enter>
  265.  
  266.           The above command sequence will display all words in all
  267.         vocabularies of Forth that contain the letter sequence "HE".
  268.         This is very useful when you don't know how to spell the word
  269.         you are looking for, but you know it contains a particular
  270.         character sequence.  WORDS by it self will show all words in
  271.         the current vocabulary only, and the special sequence "*.*"
  272.         following WORDS is recognized as a command to display all
  273.         words of all vocabularies.
  274.  
  275.  
  276.  
  277.                 Here is a list of the words we have covered.
  278.  
  279.         OPEN <filename> <enter>         Opens filename.
  280.  
  281.         1 LOAD <enter>                  Compiles the open file.
  282.  
  283.         ED <enter>                      Starts editing the current
  284.                                         file.
  285.  
  286.         SED <filename> <enter>          Specifies a file to edit.
  287.  
  288.         FLOAD <filename> <enter>        Loads filename.
  289.  
  290.         HELP <enter>                    Displays a help screen.
  291.         HELP <forth_word> <enter>       Shows the source for a
  292.         VIEW <forth_word> <enter>       Forth word.
  293.         LL <forth_word> <enter>
  294.  
  295.         N <enter>                       Shows next 16 lines.
  296.  
  297.         B <enter>                       Shows previous 16 lines.
  298.  
  299.         L <enter>                       Re-display current 16 lines.
  300.  
  301.         WORDS <sub_string> <enter>      Display all words containing
  302.                                         <sub_string> in all vocabularies.
  303.  
  304.         SEE <word>                      Decompile the memory copy of
  305.                                         the word, and show the source.
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  2. Sequential File Forth:  An Overview
  333.  
  334.         More than 90% of what is in FF came from F83, much of
  335.         what you are seeing, should be somewhat familiar.  Things
  336.         that are different, are normally different because they need
  337.         to be.  There are a significant number of things about F83
  338.         that I would have liked to change, but did not for
  339.         compatibility reasons.  However since BLOCK is not present,
  340.         you will experience a period of difficulty.  I hope you will
  341.         take some solace in knowing I have at least tried to make the
  342.         transition as painless as possible.  Many of the familiar
  343.         file manipulation words from F83 are still present, and those
  344.         that are will work in a very similar if not identical way.
  345.         Some of these are:
  346.  
  347.  
  348.         OPEN, CLOSE, VIEW, OK, L, N, B, ED, LOAD, LIST, EDIT
  349.  
  350.  
  351.           Some words like BLOCK, and BUFFER, simply could not be fit
  352.         into the new scheme of things in a logical manner, and so
  353.         were omitted.  To load an entire file, use the sequence FLOAD
  354.         <filename>.  Listing through a file is best done with VIEW,
  355.         although of course the file will have already had to be
  356.         loaded. To LIST through a file which has not been loaded, you
  357.         can use LIST, which lists from a line number, rather than
  358.         from a block, but the following sequence is easier.
  359.  
  360.  
  361.                 OPEN <filename> <enter> opens file
  362.                 L <enter>               lists first 18 lines
  363.                 N <enter>               lists next group of lines.
  364.                 B <enter>               list previous group of lines.
  365.  
  366.  
  367.           These words are very fast using indices into the file to
  368.         maintain their line pointer information.
  369.  
  370.           the word LOAD still exists, but loads the rest of a file
  371.         starting at the line number specified.
  372.  
  373.           The compiler in FF has been tailored to be as fast as I
  374.         could make it.  Since much of the functionality of WORD has
  375.         been moved into CODE for performance, this system compiles
  376.         sequential text files much faster than standard F83 compiles
  377.         BLOCKs.
  378.  
  379.           The debugger has been enhanced to allow nesting and
  380.         un-nesting of ":" definitions for more capable debugging.
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.           The editor is WordStar compatible from a cursor control key
  388.         stand point, with the keypad functions fully supported,
  389.         along with some function keys.  Full search, replace, and
  390.         global replace are provided, along with copy and paste of
  391.         text segments within a file as well as between files.  The
  392.         editor can be used to directly convert existing BLOCK files
  393.         smaller than 64k to sequential files.  See the section on the
  394.         editor for detailed information.
  395.  
  396.           A utility is provided to convert even very large BLOCK
  397.         files into sequential files.  The resulting savings in mass
  398.         storage is typically greater than 60%.
  399.  
  400.           The source for FF is, of course, provided.  You can tailor
  401.         it to your way of doing things if you don't like mine.
  402.  
  403.  
  404.  3.  What is the same as F83?
  405.  
  406.           From a low-level Forth standpoint, FF is very similar to
  407.         F83.
  408.  
  409.           Multi-tasking is unchanged.
  410.  
  411.           The assembler in POSTFIX mode is fully compatible with the
  412.         F83 assembler.
  413.  
  414.           VIEW, FIX, L, N, B, ED, LISTING, and OK work as they did
  415.         in F83.
  416.  
  417.           LOAD and LIST need a line number rather than a screen
  418.         number.
  419.  
  420.           \S is available, and stops compilation of the remaining
  421.         portion of the current file.
  422.  
  423.           DBG and DEBUG work as they did in F83, with more
  424.         functionality added.  A decompiled source of the current
  425.         definition being debugged is displayed at the top of the
  426.         screen.
  427.  
  428.           SEE is available, but has been enhanced to display the
  429.         conditional structures in nested source form, for much
  430.         increased readability.
  431.  
  432.           WORDS works as it did in F83, with the enhancement that you
  433.         can specify a text string following it to display a subset
  434.         of words in the dictionary that contain the substring. WORDS
  435.         *.* will display all words in all vocabularies.
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  4.  What is different from F83?
  443.  
  444.           The system is now Direct threaded CODE. This results in
  445.         the CODE fields of Colon definitions being 3 bytes instead
  446.         of 2. Approximately a 15% increase in performance results.
  447.  
  448.           The LIST portion of all ":" definitions has been moved to
  449.         another segment. This resulted in at least a doubling of the
  450.         program space available. A small loss of performance
  451.         resulted. (about 10%)
  452.  
  453.           System based time and date functions have been added, for
  454.         measurement as well as display of the time and date.  The
  455.         word TIMER will allow measuring the performance of various
  456.         operations in FF.
  457.  
  458.           Very fast screen I/O is provided for editor and normal text
  459.         display.  The words FAST and SLOW switch between direct
  460.         screen I/O and BDOS function I/O.
  461.  
  462.           Screen hi-lighting for a monochrome display is supported
  463.         for underline, bold, reverse, bold blink, and reverse blink.
  464.  
  465.           Paths are fully supported, as entered from the command
  466.         line, or applied to a file automatically if not specified.
  467.  
  468.           Many DOS command line functions are built-in, like DIR,
  469.         COPY, FORMAT, DEL, REN, MD, RD, CHDIR, PATH, and more may be
  470.         added at a cost of about 40 bytes each.
  471.  
  472.           Cursor shape control is provided, in the form CURSOR-ON,
  473.         CURSOR-OFF, NORM-CURSOR, MED-CURSOR, BIG-CURSOR, GET-CURSOR,
  474.         and SET-CURSOR.
  475.  
  476.           BLOCK, BUFFER, B/BUF, C/L, L/SCR, BLK, FCB, and no longer
  477.         exist.
  478.  
  479.           The word COPY, is now a DOS function to copy files.
  480.  
  481.           Environment access is supported, see the ENVIRON.SEQ file.
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  5.  Differences from PF, ZF & DF
  498.  
  499.  
  500.           This Forth was implemented by Tom Zimmer, with substatial
  501.         help from Robert L. Smith. All of the Direct Threaded low
  502.         level code modifications came from Bob's LaForth
  503.         implementation.
  504.  
  505.           This is yet another step in the Forth evolution being
  506.         undertaken to obtain the ideal Forth system. This Forth
  507.         maintains very high compatibility with ZF & DF which was it's
  508.         predecessor. The primary problem that you are likely to
  509.         encounter, is that CODE fields are three (3) bytes rather
  510.         than 2, and the CODE field of a CODE word does not point to
  511.         code, but contains code.
  512.  
  513.           FF has moved ":" LISTs to a seperate segment, so there are
  514.         two bytes in the BODY of each ":" definition that points into
  515.         LIST space the the ":" definitions LIST of CFAs.  LIST space
  516.         is accessed with X words, like X@ and X!. The word XPERFORM
  517.         has been added for performing a word in LIST space.
  518.  
  519.           VARIABLEs, CONSTANTs, and strings are handles in the same
  520.         way as PF, that is they are in CODE space. This segmentation
  521.         seems to provide a reasonable balance. As the dictionary
  522.         expands, more user data space is needed, which works well with
  523.         FF, as most of the free space is in CODE/DATA space.
  524.  
  525.           This system will full circle meta compile and extend, with
  526.         the provided batch files for simplicity.
  527.  
  528.           As FF currently exists, there is about 30k of LIST
  529.         dictionary space, and 40k of CODE space. which can be expanded
  530.         by removing some of the optional files from the list of load
  531.         files in FF.SEQ. The removable files are marked. Some of these
  532.         files are listed as follows:
  533.  
  534.         PATHSET.SEQ     WORDS.SEQ       COLOR.SEQ       DUMP.SEQ
  535.         DECOM.SEQ       DEBUG.SEQ       STATUS.SEQ      MACROS.SEQ
  536.         PATCHER.SEQ     FILSTAT.SEQ     FWORDS.SEQ
  537.  
  538.           If some of these files are removed, a significant savings in
  539.         dictionary space will result.
  540.  
  541.           A tool of the type used in F83X has been added, called
  542.         ?NEEDS. This word when followed by a filename will
  543.         conditionally load the specified file if the file has not
  544.         already been loaded. Be sure to include the filename
  545.         extension. Another word ?UNWANTED, when followed by a
  546.         filename, aborts with an error if the Unwanted file has
  547.         already been loaded.
  548.  
  549.  
  550.  
  551.  
  552.  6.  SED the Editor
  553.  
  554.           For full information on the editor in FF, please see the
  555.         file SED.TXT
  556.  
  557.  
  558.  7.  The Debugger, and the Tools Available
  559.  
  560.  
  561.         THE DEBUGGER
  562.  
  563.           The debugger is very similar to the F83 debugger.  Some
  564.         features have been added to enhance its operation.  The
  565.         decompiled source for the current definition being debugged
  566.         is displayed while debugging. A typical command sequence
  567.         might be as follows:
  568.  
  569.                 DEBUG WORDS <enter>     specify WORDS to be debugged
  570.                                         as soon as it is executed.
  571.                         or
  572.  
  573.                 DBG WORDS <enter>       debug WORDS right now.
  574.  
  575.           Once in the debugger, you will be shown a display similar
  576.         to the following:
  577.  
  578.                 17469   INWFLG          ?>  _
  579.  
  580.           At this point, pressing return will cause the word INWFLG
  581.         to be executed, and the debugger will print the stack after
  582.         execution, and step to the next word in the list and wait for
  583.         a command.  Notice the fields in the above example.  The
  584.         number on the left is the address in memory where the
  585.         debugger is currently working.  The next word INWFLG is the
  586.         word the debugger is about to execute.  The next symbol "?>"
  587.         is a marker pointing to what will be the printed stack
  588.         contents after we press <enter>.  The question mark symbol is
  589.         the command we must press to see the command list for the
  590.         debugger.  If we press that now, we will see:
  591.  
  592.                 C-cont, F-forth, Q-quit, N-nest, U-unnest:
  593.  
  594.           These are the commands you can use in the debugger.  Their
  595.         functions are as follows:
  596.  
  597.         C-cont          Trace continuously until a key is pressed.
  598.  
  599.         F-forth         Allow entry of Forth command lines until
  600.                         <enter> is pressed on an empty line.
  601.  
  602.         Q-quit          Quit the debugger, and unpatch next.
  603.  
  604.  
  605.  
  606.  
  607.         N-nest          Nest into the ":" definition we were about
  608.                         to execute.  Only works on ":" definitions,
  609.                         and deferred words.
  610.  
  611.         U-unnest        Unnest the current ":" definition being
  612.                         debugged.  Re-enters the debugger on the next
  613.                         higher level.
  614.  
  615.  
  616.         DEBUGGING with SOURCE displayed
  617.  
  618.           You will have noticed that the upper portion of the screen
  619.         is filled with the source for the word you are currently
  620.         debugging.  This is to make it easier to follow the debug
  621.         process. You may want to turn off the source display, if it
  622.         interferes with your the debuging process. The words to
  623.         control this are:
  624.  
  625.                 SRCOFF          turn off the source display
  626.                 SRCON           turn on the source display
  627.  
  628.           The default state is ON.
  629.  
  630.  
  631.         CONSTANTS as VARIABLES and what to do with them
  632.  
  633.           A set of operators has been included for manipulating
  634.         constants.  Since constants are faster at run time than
  635.         variables, performance critical operations can take advantage
  636.         of these.  They may also provide a somewhat more readable
  637.         source.  Here is a list of them:
  638.  
  639.                 =:              \ value =: constant-name
  640.                 !>              \ value !> constant-name
  641.                                 \ assign value into constant-name
  642.  
  643.                 @>              \ @> constant-name ( --- n1 )
  644.                                 \ returns contants of its BODY.
  645.  
  646.                 +!>             \ value +!> constant-name
  647.                                 \ increment constant-name by value
  648.  
  649.                 incr>           \ incr> constant-name
  650.                                 \ increment constant-name by one
  651.  
  652.                 decr>           \ decr> constant-name
  653.                                 \ decrement constant-name by one
  654.  
  655.           These operators are written in assembly, so they will be
  656.         very fast.
  657.  
  658.  
  659.  
  660.  
  661.  
  662.         SEEing into Forth definitions
  663.  
  664.           FF provides the standard F83 decompiler, called SEE.  SEE
  665.         has been modified to display a decompiled source that is in
  666.         most cases the very similar to the source on disk.
  667.  
  668.         TIMER and measurement of execution time
  669.  
  670.           A complete set of time and date manipulation words has been
  671.         provided, here is an explanation of their usage:
  672.  
  673.                 TIMER           ( words --- )
  674.  
  675.           TIMER performs the Forth words following on the same
  676.         command line, and when they finish execution, TIMER prints
  677.         the elapsed time required for their execution.
  678.  
  679.                 TIME-RESET      ( --- )
  680.  
  681.           Reset the accumulated time value in the double variable
  682.         STIME to zero, in effect resetting the current elapsed time
  683.         to zero.  This word is used at the beginning of a sequence of
  684.         operations you want to time.  The word .ELAPSED is used at
  685.         the end of the operations to print the elapsed time since the
  686.         last TIME-RESET.
  687.  
  688.                 .ELAPSED        ( --- )
  689.  
  690.           Print the elapsed time since the last TIME-RESET was
  691.         performed.
  692.  
  693.                 TENTHS          ( tenths_ofa_second --- )
  694.                 SECONDS         ( seconds --- )
  695.                 MINUTES         ( minutes --- )
  696.                 HOURS           ( hours --- )
  697.  
  698.           Time delay words use the system time function to obtain
  699.         very accurate time delays.  Background processing continues,
  700.         as pause is called in the wait loop.  Another deferred word,
  701.         PAUSE-FUNC, is also in the loop, which can be re deferred to
  702.         perform any function you want done while the delay is
  703.         occurring.
  704.  
  705.         DATE Control Words
  706.  
  707.           FF provides several words for getting and setting the date
  708.         and time as follows:
  709.  
  710.                 GETDATE         ( --- d1 )
  711.  
  712.           Return d1 the 32bit binary date from the operating system.
  713.  
  714.  
  715.  
  716.  
  717.                 SETDATE         ( d1 --- )
  718.  
  719.           Given the binary date d1, set the system clock to that
  720.         date.
  721.  
  722.                 GETTIME         ( --- d1 )
  723.  
  724.           Return d1 the 32bit binary time from the operating system.
  725.  
  726.                 SETTIME         ( d1 --- )
  727.  
  728.           Given the binary time d1, set the system clock to that
  729.         time.
  730.  
  731.                 .DATE           ( --- )
  732.  
  733.           Print to the screen, the current date, in the format
  734.         MM/DD/YY, where MM is month, DD is day, and YY is year.
  735.  
  736.                 .TIME           ( --- )
  737.  
  738.           Print to the screen, the current time, in the format
  739.         HH:MM:SS.HR, where HH is hours, MM is minutes, ss is seconds,
  740.         and HR is hundredths of a second.
  741.  
  742.         Multiple line COMMENT words in FF
  743.  
  744.                 COMMENT:        ( lines_of_text --- )
  745.  
  746.           Starts a group of lines that are to be treated as comments,
  747.         until a terminating "COMMENT;" is found.
  748.  
  749.                 .COMMENT:        ( lines_of_text --- )
  750.  
  751.           Starts a group of lines, that are to be printed to the
  752.         terminal, until a terminating "COMMENT;" is found.
  753.  
  754.         SCREEN control words in FF
  755.  
  756.                 FAST            ( --- )
  757.  
  758.           Select the Fast screen output routines that are very
  759.         hardware dependant.  Much faster than BDOS, but requires VERY
  760.         compatible hardware.
  761.  
  762.                 SLOW            ( --- )
  763.  
  764.           Select the SLOW screen output routines, these routines use
  765.         BDOS for screen output, and are less hardware dependant than
  766.         FAST.
  767.  
  768.  
  769.  
  770.  
  771.  
  772.                 >UL             ( --- )         underline
  773.                 >REV            ( --- )         reverse
  774.                 >BOLD           ( --- )         bold
  775.                 >BOLDUL         ( --- )         bold underline
  776.                 >BOLDBLNK       ( --- )         bold blink
  777.                 >REVBLNK        ( --- )         reverse blink
  778.                 >NORM           ( --- )         normal video
  779.  
  780.           Select the various types of attributes available on the
  781.         monochrome monitor.
  782.  
  783.  
  784.  
  785.           COLOR support has been added.  FF as delivered is
  786.         configured for Monochrome, but will work on a color monitor.
  787.         The INSTALL process will automatically install color support
  788.         if a color board is being used during installation.
  789.  
  790.                 >FG             ( n1 --- )      foreground
  791.                 >BG             ( n1 --- )      background
  792.  
  793.           Words from the COLOR.SEQ file that allow setting the
  794.         foreground and background colors on a color monitor:
  795.  
  796.                 >ATTRIB1        ( --- )
  797.                 >ATTRIB2        ( --- )
  798.                 >ATTRIB3        ( --- )
  799.                 >ATTRIB4        ( --- )
  800.  
  801.           Deferred words to allow selection of the various display
  802.         attributes for the current display board.  They default to
  803.         the following attributes for Monochrome and Color.
  804.  
  805.  
  806.                                 MONOCHROME          COLOR
  807.                   word                          bgrnd   fgrnd
  808.                 ---------------------------------------------
  809.                 >ATTRIB1        UNDERLINE       BLUE    GREEN
  810.                 >ATTRIB2        BOLD UNDERLINE  RED     WHITE
  811.                 >ATTRIB3        BOLD            BLUE    WHITE
  812.                 >ATTRIB4        REVERSE         RED     WHITE
  813.  
  814.           These values can be changed by changing either COLOR.SEQ,
  815.         or MONOCROM.SEQ and re-installing the system with INSTALL.BAT.
  816.  
  817.  
  818.                 SAVESCR         ( --- )         save screen
  819.                 RESTSCR         ( --- )         restore screen
  820.  
  821.           These words give you the ability to save the screen
  822.         contents and later restore the screen to its original
  823.         appearance in a simple way. SAVESCR may be used and nested
  824.         up to three times before RESTSCR needs to be done. That is,
  825.         three screens can be saved and sequentially restored.
  826.  
  827.         COMPILATION control words
  828.  
  829.                 OK <enter>
  830.  
  831.           Compile the currently open file, starting at the beginning,
  832.         and continuing through the end of the file or until an error
  833.         is encountered.
  834.  
  835.                 <line_number> LOAD <enter>
  836.  
  837.           Start loading the current file starting at the
  838.         <line_number> specified.  Loads through the end of the file
  839.         or until an error is encountered.
  840.  
  841.  
  842.         PRINTING Source files in FF.
  843.  
  844.           Files can of course be printed while in the editor, but you
  845.         can also print files from the Forth command line as follows:
  846.  
  847.                 OPEN <filename> <enter>         open a file
  848.                 LISTING <enter>                 print the file
  849.  
  850.           The print format is the same as the default format for the
  851.         editor.  Another command which combines the two commands
  852.         above is as follows:
  853.  
  854.                 FPRINT <filespec> <enter>       open and print
  855.  
  856.           Literally opens the file and performs a LISTING. The source
  857.         for the word FPRINT is available in the file FWORDS.SEQ
  858.  
  859.  
  860.         CONDITIONAL COMPILATION
  861.  
  862.           The word #IF has been added, which accepts a boolean flag,
  863.         and determines if the lines following #IF are loaded up until
  864.         the #ENDIF. A TRUE flag causes the lines to be loaded. A
  865.         FALSE flag causes the lines to be skipped.
  866.  
  867.                 TRUE #IF
  868.  
  869.                         .( This message will be printed.)
  870.  
  871.                 #ENDIF
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.         MACROS in FF, and SED
  883.  
  884.           A file called MACROS.SEQ is provided, which implements
  885.         keyboard macros in Forth, at the level of KEY.  These macros
  886.         can therefore be used in the editor also.  The macros are
  887.         used as follows: (the sequence "Alt-M" means hold down the
  888.         "Alternate" key and press the "M" key.)
  889.  
  890.                 Alt-M           start defining a macro.
  891.                 Alt-1           we are defining the Alt-1 macro.
  892.  
  893.                 Enter any keys you want in the macro, up to 128 keys.
  894.  
  895.                 Alt-M           completes the definition of the Alt-1
  896.                                 macro.
  897.  
  898.           Any keys typeable on the keyboard except Alt-m, and Alt-1
  899.         to Alt-5 can be included within a macro.
  900.  
  901.           To execute a macro, simply type its key name:
  902.  
  903.                 Alt-1           executes the macro key sequence for
  904.                                 the Alt-1 key.
  905.  
  906.           Currently macros may be only 127 characters in length,
  907.         although this can be changed by modifying the MAXMAC constant
  908.         and recompiling the system.
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  8.  DOS: the interface
  938.  
  939.           The interface to DOS occurs at several levels.  In this
  940.         section we will discuss the interface to the DOS commands as
  941.         opposed to the DOS system calls.
  942.  
  943.           It is convenient to be able to issue DOS commands from
  944.         within FF.  This avoids having to leave FF to do the normal
  945.         housekeeping things that are regular occurrences in a DOS
  946.         based computer.  In line with this, FF implements a pair of
  947.         commands:
  948.  
  949.  
  950.                 $SYS    ( a1 --- f1 )
  951.                 SYS     ( text --- )
  952.  
  953.  
  954.           These words allow performing almost any DOS command line
  955.         operation you would want to do.  To make things even more
  956.         convenient, several additional words have been coded which
  957.         use the $SYS word for specific functions.  They are as
  958.         follows:
  959.  
  960.  
  961.           DIR  FORMAT  FTYPE  DEL  CHDIR  COPY  REN  RD  MD  PATH
  962.  
  963.           A:    B:     C:
  964.  
  965.  
  966.           These commands may be used as they are in DOS.  The word
  967.         FTYPE replaces the DOS word TYPE for obvious reasons.
  968.  
  969.           If you press Control-C, or Control-Break during the
  970.         execution of any of the above words, operation will abort
  971.         back to Forth.
  972.  
  973.                 ` <command> <enter>
  974.  
  975.           BACKTICK followed by one space and a DOS command sequence
  976.         performs the DOS command sequence and returns to Forth.
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  9.  Memory Management in FF
  993.  
  994.                 FF uses memory as follows:
  995.  
  996.                 |---------------------| ?CS:
  997.          ^      |                     |
  998.          |      |       Forth         |
  999.          |      |       Kernel        |
  1000.          |      |                     |
  1001.          |      |---------------------|
  1002.          |      |       System        |
  1003.          |      |     Extensions      |
  1004.          |      |---------------------| HERE, DP @
  1005.          |      |     Dictionary      | PAD, DP + 80
  1006.          |      |     Free space      |
  1007.         64k     |         |           |
  1008.        bytes    |         v           |
  1009.          |      |         ^           |
  1010.          |      |         |           |
  1011.          |      |     Data stack      |
  1012.          |      |---------------------| SP0 @
  1013.          |      |        TIB          | TIB, 'TIB @
  1014.          |      |         |           |
  1015.          |      |         v           |
  1016.          |      |         ^           |
  1017.          |      |         |           |
  1018.          v      |    Return stack     |
  1019.                 |---------------------| RP0  @, End code space.
  1020.  
  1021.                 |---------------------| YSEG @, Start head space.
  1022.          ^      |       hash table    |
  1023.          |      |---------------------|
  1024.          |      |                     |
  1025.         32k     |       headers       |
  1026.        bytes    |                     |
  1027.          |      |---------------------| YHERE,  YDP @
  1028.          |      |       header        |
  1029.          v      |     free space      | YHERE + 32767
  1030.                 |---------------------|
  1031.  
  1032.                 |---------------------| TSEGB, TSEGE
  1033.          ^      |                     |
  1034.      64k bytes  |     Edit Buffer     |
  1035.          v      |                     |
  1036.                 |---------------------| LSEG
  1037.                 |  Line pointer list  |
  1038.                 |---------------------| DSEG
  1039.                 |  Lines deleted buf  |
  1040.                 |---------------------| RSEG
  1041.                 | Restore display buf |
  1042.                 |---------------------|
  1043.  
  1044.  
  1045.  
  1046.  
  1047.         COLON ":" Data Structure
  1048.  
  1049.           Here is the data structure used for a colon definition in
  1050.         FF.
  1051.  
  1052.         The COLON ":" definition of the word HEX.
  1053.  
  1054.                                      ----------------
  1055.             HEAD SPACE               [ VIEW offset  ] VIEW
  1056.                                      [ LINK pointer ] LINK
  1057.                                      [      83 hex  ] NAME
  1058.                                      [   H          ]
  1059.                                      [   E          ]
  1060.                                      [   X + 80 hex ]
  1061.                 Points to CODE space [ CFA pointer  ] --------v
  1062.                                      ----------------         |
  1063.                                                               |
  1064.                                      ----------------         |
  1065.             CODE SPACE               [     CALL     ] CFA <---<
  1066.                                      [     NEST     ]
  1067.                 Points to LIST space [ LIST POINTER ] BODY >--v
  1068.                                      ----------------         |
  1069.                                                               |
  1070.                                      ----------------         |
  1071.             LIST SPACE               [ cfa of (LIT) ] LIST <--<
  1072.                                      [     16       ]
  1073.                                      [ cfa of BASE  ]
  1074.                                      [ cfa of   !   ]
  1075.                                      [ cfa of UNNEST]
  1076.                                      ----------------
  1077.  
  1078.  
  1079.  
  1080.  
  1081. 10.  The File System and Handles
  1082.  
  1083.           For full information on the file system as used in FF,
  1084.         please see the file FILES.TXT
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102. 11.  Rebuilding the System.
  1103.  
  1104.  
  1105.           If you need to change a parameter or function in the FF
  1106.         system, you will need to re-compile FF and/or PKERNEL.  This
  1107.         is simply done with the provided batch files as follows:
  1108.  
  1109.  
  1110.                 C> PMETA <enter>        re-compiles PKERNEL.COM
  1111.                 C> INSTALL <enter>      re-extends to create FF.COM
  1112.  
  1113.  
  1114.           Either of these may be performed from the keyboard while in
  1115.         DOS.
  1116.  
  1117.                 TURNKEY
  1118.  
  1119.           The word TURNKEY and some associated words are included in
  1120.         the file SAVESYS.SEQ. TURNKEY is used as follows:
  1121.  
  1122.                 ' MYAPPL TURNKEY MYAPP.COM <enter>
  1123.  
  1124.           After completing an application compile, the word MYAPPL
  1125.         is defined to be performed by the program name MYAPP.COM.
  1126.         TUNRKEY automatically sets up the proper memory managment to
  1127.         allocate 64k for your program, but does not save the HEADS.
  1128.         Minimum initialization is performed. A file specified on the
  1129.         command line will be opened, and you can use BL WORD to pick
  1130.         up additional parameters from the command line. You will NOT
  1131.         of course be able to interpret, since heads are not saved,
  1132.         and you applicaton will need to handle all errors and return
  1133.         to DOS when the program completes.
  1134.  
  1135.         BUILDING an APPLICATION
  1136.  
  1137.           Before attempting to build an application, you will need to
  1138.         make a copy of FF.SEQ, for customization. Many of the later
  1139.         files in FF.SEQ are utilities, and will not be needed in your
  1140.         application. Start by writing your program and compiling it
  1141.         on FF.EXE. Work in this environment until you are sure your
  1142.         program works. Now insert your program filename into the copy
  1143.         of FF.SEQ you made, about half way down, and try to compile
  1144.         the copy of FF.SEQ. If it compiles then you can move your
  1145.         application file lower, until you have determined what
  1146.         utilities are needed by your application. Strip out all files
  1147.         above your application file, and load the file SAVESYS.SEQ.
  1148.         Use TURNKEY as previously described to make an executable
  1149.         .COM file.
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157. 12.  FF and Batch Files.
  1158.  
  1159.  
  1160.           FF allow commands to be passed to Forth on the DOS command
  1161.         line in the following manner:
  1162.  
  1163.                 C> FF <filename> <forth words> <enter>
  1164.  
  1165.           This example illustrates how you can start FF with a
  1166.         specified file name, and perform commands on the file.  An
  1167.         example of how this might be used is as follows:
  1168.  
  1169.                 C> FF BANNER OK <enter>
  1170.  
  1171.           Here we are starting FF with the file BANNER.SEQ, and then
  1172.         performing OK to compile the file.  Another way to use
  1173.         command line parameters is:
  1174.  
  1175.                 C> FF - <forth words> <enter>
  1176.  
  1177.           Here we are starting FF, followed by a dash "-" to tell FF
  1178.         we are not opening a file, then telling FF to perform the
  1179.         Forth words following the "-".  Here is an example:
  1180.  
  1181.                 C> FF - FIX DIR <enter>
  1182.  
  1183.           This example starts up FF without a file and tells FF we
  1184.         want to fix the word DIR.  It will locate the word DIR and
  1185.         start up the editor with the cursor located on the first
  1186.         line of the DIR definition.
  1187.  
  1188.           You can get to batch files now, as you can see many types
  1189.         of commands could be given to FF on the command line.  Here
  1190.         are the contents of the PMETA.BAT:
  1191.  
  1192.                 FF - FLOAD META86
  1193.  
  1194.           This single line batch file re-meta-compiles the FF kernel
  1195.         file and re-creates the PKERNEL.COM file.  A similar batch
  1196.         file is provided to extend the system.
  1197.  
  1198.           The one caution on batch files is you must not place
  1199.         commands on the command line which cause the command line to
  1200.         be interpreted again.  The words HELLO and COLD are such
  1201.         words, and should not be used on the command line of FF.COM,
  1202.         or PKERNEL.
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212. 13.  Extra stuff included with FF
  1213.  
  1214.           See the separate file ZIMMER.TXT, CURLEY.TXT and SMITH.TXT
  1215.         for information on the extras provided with each archive
  1216.         file.
  1217.  
  1218. 14.  Forth History, how did we get here?
  1219.  
  1220.           This Forth system started out as an experiment to see if a
  1221.         development environment could be created that would be as
  1222.         interactive as a BLOCK Forth system, with as many of the same
  1223.         tools as possible.
  1224.  
  1225.           Over the past several years, I have observed the
  1226.         Programming community for other languages.  Several years
  1227.         ago, Forth had enormous advantages over Fortran, Pascal, and
  1228.         C in terms of development interactivity.  The Forth
  1229.         development cycle was very short, and new code modules could
  1230.         be put together for experimentation very quickly.  As the
  1231.         years went by, the Programmers for these other languages
  1232.         began to realize there had to be something better than their
  1233.         traditional compile debug cycle, i.e.
  1234.  
  1235.           ----> Enter the editor from operating system.
  1236.           | |   Make changes with LINE editor.
  1237.           | |   Leave editor back to operating system.
  1238.           | |   Start Compiler on source module.
  1239.           | |   WAIT A LONG TIME FOR THE COMPILER.....
  1240.           | |   Discover an error.
  1241.           | |
  1242.           | --< LOOP back up until all compile errors are found.
  1243.           |
  1244.           |     Now start Linker on all modules.
  1245.           |     WAIT A LONG TIME FOR THE LINKER.....
  1246.           |     Discover Link error.
  1247.           ----< Go back to beginning and try again.
  1248.  
  1249.           The above loop could be measured in DAYS, and was normally
  1250.         at least 30 minutes long.
  1251.  
  1252.           Forth did away with much of the above.  The editor was
  1253.         integrated into the Forth/Operating system environment, so
  1254.         the time to start up or leave the editor was zero.  The
  1255.         compiler was incremental, so programs could be debugged a
  1256.         piece at a time, and there was no linker at all.  This
  1257.         naturally resulted in a productivity improvement and a
  1258.         significant reduction in programmer frustration.
  1259.  
  1260.           As the years went by, other programmers noticed how much
  1261.         easier BASIC was to use than other compiled languages, since
  1262.         it had a built in editor, and didn't have to compile at all.
  1263.         Of course it was SO SLOW.., but then along came TURBO PASCAL.
  1264.         It created fast compiled code, had an integrated SCREEN
  1265.         editor, and compiled like BLAZES.
  1266.  
  1267.           We now start to see some similarities to Forth, a much
  1268.         superior development environment, where the development
  1269.         iteration cycle has been reduced to a very small number.  But
  1270.         Turbo Pascal still lacked Forth interactivity, and ability to
  1271.         incrementally debug programs as they are developed.
  1272.  
  1273.           Finally along came the Macintosh (Those who know me knew I
  1274.         would figure out a way to mention it), and Light Speed
  1275.         Pascal.  It had evolved from Mac Pascal, an interactive and
  1276.         pseudo interpreted Pascal for the Mac.  LSP (Light Speed
  1277.         Pascal) had Windows, a Built in Screen editor, Compiled
  1278.         modules, a Very fast compiler and a Light Speed Linker, with
  1279.         the ability to test small segments of code, and two built-in
  1280.         debuggers: one for Pascal, and one for Assembly.  I bought it
  1281.         and liked the environment very much.  The only problem was
  1282.         that is was PASCAL not Forth.  I did, however, like the
  1283.         advantages of sequential files.  Here is a partial list:
  1284.  
  1285.                 Source files are smaller, so backing or
  1286.                 transporting file is easier.
  1287.  
  1288.                 Sequential source files can be manipulated
  1289.                 or viewed by programs that other people
  1290.                 have, not just by the forth block editor.
  1291.  
  1292.                 There is no artificial limitation placed on
  1293.                 definition size.  In the block based system
  1294.                 I was always giving up line zero for a
  1295.                 comment line, and line 15 for nudge space.
  1296.  
  1297.                 There is no artificial limit placed on the
  1298.                 amount of comments I can place with the
  1299.                 source.  Again, compared to blocks with
  1300.                 shadows, 16 lines of shadows was either too
  1301.                 much or too little.
  1302.  
  1303.                 Sequential files provide a much more
  1304.                 natural interface to the operating system.
  1305.  
  1306.                 I love being able to insert room for a new
  1307.                 definition in the middle of a source file,
  1308.                 without having to drop out of the editor,
  1309.                 and use MORE and CONVEY to move things
  1310.                 around, all I have to do is press <enter>.
  1311.  
  1312.  
  1313.           Hmm.  I wonder what Forth would be like with Sequential
  1314.         files?  Well, it has arrived.
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.           So here we are at the end (or beginning) of a long road,
  1323.         looking back at what we have done, and looking forward to
  1324.         the future.  Blocks were certainly very useful for forcing me
  1325.         to modularize my code.  That was a big advantage while I was
  1326.         learning Forth.  Maybe newcomers to Forth should be required
  1327.         to learn the system on a BLOCK version, but now that I have
  1328.         come of age, I think I know where to modularize my code
  1329.         better than the computer.
  1330.  
  1331.         Thoughts on BLOCK
  1332.  
  1333.           One last thought.  Although all references to block
  1334.         operations have been removed from FF, that does not mean you
  1335.         cannot use block type disk operations in your programs.  Here
  1336.         is the equivalent FF source for some simple block read and
  1337.         block write functions:
  1338.  
  1339.                 create blockbuf 1024 allot
  1340.  
  1341.                 : BLKREAD   ( n1 --- a1 )
  1342.                             1024 um* seek
  1343.                             blockbuf dup 1024 shndl @ hread drop ;
  1344.  
  1345.                 : BLKWRITE  ( n1 --- )
  1346.                             1024 um* seek
  1347.                             blockbuf 1024 shndl @ hwrite drop ;
  1348.  
  1349.           These definitions will read and write a block of data from
  1350.         the current file.  While it is true that the above does not
  1351.         provide anything like a complete Forth BLOCKs functionality,
  1352.         like no auto write on update, and no virtual buffering, it
  1353.         does show how simple it is to access random records in a
  1354.         block.
  1355.  
  1356.           Now I hope I have provided some insight into the logic
  1357.         behind the development of FF without BLOCKs.  I hope you can
  1358.         find a use for it as I have.
  1359.  
  1360.                                         Tom Zimmer
  1361.  
  1362.