home *** CD-ROM | disk | FTP | other *** search
- September 14, 1988
-
- Jerry:
-
- The three files on this disk are the result of my starting to "reverse
- engineer" Martin Tracy's ZEN forth to create source code. After
- getting into it, I became quite discouraged with his multitude of
- headerless words (both code and otherwise). In addition, I found a
- serious bug in the way he handles DO and LOOP.
-
- If one is compiling a DO-LOOP construct that requires more than one
- line (either from a disk file or from the keyboard), the program goes
- away and the computer locks up. This is due to the way Martin uses the
- return stack for handling addresses for his immediate LEAVE function.
- Unfortunately he needed to remove one more level from the return stack,
- but didn't. MINIforth takes care of this problem.
-
- A second major bug in ZEN is the 64-byte keyboard buffer. You can't
- even type in a full screen line while compiling! There's no warning
- when you fill the TIB, so you can easily 'crash' while defining words.
- And, because of the placement of the TIB (between the two stacks), it
- cannot easily be increased in size. Again, MINIforth takes care of
- this problem. Like ZEN, it uses DTC and keeps TOS in a register for
- very fast execution.
-
- You can have MINIforth, including the source code, for use on your
- board, if you'd like. I am presently up to version 2.5, and I think
- that will be it. Anyone interested in getting updated versions can
- call or write me. I have extensions to the MINI.MIN file that add more
- standard words, but have not yet begun the tutorial promised. That
- will come.
-
- As indicated in the source code file, MINI is rather radical and may
- not appeal to true FORTHers, as it makes extensive use of TO variables.
- From an execution and readability point of view, however, the TO
- variables appear to me to be the way to go. Consider the statement:
-
- STATE @ IF
-
- and compare it to the MINI equivalent:
-
- COMPILING IF
-
- In addition to eliminating the fetch operator, it "reads" better, and
- executes faster. This is what I like about this type of variable. You
- might also consider use of perhaps the most often used FORTH word --
- HERE. In most FORTHs, this is a high-level word :
-
- : HERE DP @ ;
-
- that uses a user variable and a code word (plus the overhead of DOCOLON
- and EXIT). In MINIforth, HERE is the dictionary pointer, a user TO
- variable, thus much faster execution, etc.
-
- Anyway, enough defense of my version of MINIforth. Here are some
- additional "features" of it.
-
- 1. It is written to run on 808X machines under MS-DOS or PC-DOS. As
- such, it takes full advantage of the resources afforded by DOS, and
- doesn't re-invent everything. For example, KBD is the code word that
- does effectively what EXPECT does in other FORTHs, but MINI uses the
- DOS buffered keyboard input service. This gives the user all the
- features found at the DOS prompt for command line editing (using the
- function keys, INS, DEL, etc.). In addition, the extended version will
- access "screens" as ASCII files, which one can create using any sort of
- text editor. There will be no EDITOR as a result (unless one wants to
- make one, that is).
-
- 2. It was NOT written with the intention of having code ultimately
- being put into ROM (i.e. the "toaster"). However, it WAS written with
- the idea in mind of being able to do target compiling to create a
- standalone disk application program. It is easily de-compilable,
- including code words. Kernal words are grouped together at the very
- beginning of the program. In-line code words have a byte-count
- imbedded in them so the de-compiler can find the end for relocation.
- User variables (often referenced by code words) are also fixed at the
- beginning of the program, making code words relocatable. User
- variables, TIB and kernal words amount to about 830 btes -- a VERY
- tight little package!
-
- Later versions also include a small system stack that operates almost
- as fast as a "real" stack, and that is included 'up front' with the
- kernal code and user variables.
-
- 3. With the right help, MINI can handle multi-users and multitasking.
-
- 4. MINI has the kernal code needed to implement Eakers' CASE words.
- This is the 'of' word that does essentially OVER = IF DROP in code. It
- needs CASE, OF, ENDOF, and ENDCASE to make it work. These will be
- provided in later files of MINI.MIN.
-
-
- So, I guess that's it. I have had fun creating MINIforth, and it could
- be used by almost anyone to learn and/or use FORTH for whatever
- reasons. Enjoy.
-
- Ted Beach
-
-
-
-
-
-