Color Forth 2000
Dear MISC readers:
Chuck Moore gave an interesting presentation yesterday
to the Silicon Valley Chapter of the Forth Interest Group
on his Color Forth 2000.
Although I have had many years of working with Machine Forth
and understand the stuff that came from Machine Forth
Chuck has dropped many of the odd things in Machine Forth
and returned to more traditional ways of doing these
things. He has also introduced other new wierd stuff.
He is still using the A register concept and he still
uses "-" to specify one-complement as he did in
Machine Forth. But IF does a DROP like traditional
Forth and there is no -IF (IF CARRY) as there is
in Machine Forth.
I am not focused entirely on writing my own CAD systems
like Chuck so much of what he is doing is not directly
applicable to what I am doing at this time. There were
some interesting ideas that I might try at some time.
Color Forth 2000 is a version that boots from floppy
rather than the one that is embedded in OKAD. But it
is still intended to be a platform to host Chuck's
OKAD so it still has many CAD related things.
Chuck has a idea of how the user interface in OKAD
should work after spending most of his time using
OKAD for the last decade. As he has said, he has
used this application program more than anything
else he ever wrote. The way he uses the keyboard
in Color Forth is a superset of what he has
been doing for years.
He began his presentation by talking about his new
keyboard arrangement. (which got a big laugh. ;-)
He is no using 27 keys and they can change function
depending on what he is doing. He displays the
current keyboard definition on the screen to help
him find the keys he needs.
He still has his own character set designed for
OKAD and for increasing the speed of the compiler.
He is now using huffman encoded keys and a keyboard
layout that resembles a Dvorak keyboard.
Color Forth still uses colors instead of a lot of
the words in traditional Forth. Chuck has changed
some of the colors he is using.
Color Forth now has a more complicated method of
packing (preprocessing) source code. This makes
for a much more complicated editor and a somewhat
more complicated compiler, and it was done to
get about a 2x speedup in the compiler. The
source code is packed into 32 bit words using
a Huffman encoded scheme.
The compiler still benefits from the Color Forth
approach by the preprocessed source and color
tokens identifying what type of quantity is
about to be compiled. It appeared to me that
there are interpreter and compiler wordlists
like in cmForth for increased speed and
simplicity. Numbers are already in binary
form from what I could tell. This means that
the compiler does not search through the whole
list of Forth words and then upon failing
try to convert a string into a number in the
current number base. Instead there is no
dictionary lookup (let alone one that must
go through the whole dictionary each time)
or conversion for numbers so the compilation
is very fast.
The name dictionary is just a simple linear
list. It does not use hash tables to speed up
searches. But since Chuck's applications
are very small and have few words it doesn't
cry out for optimization like it does on
larger systems.
Chuck has said that it is interesting that
traditionally Forth has been used on resource
starved systems and that Color Forth is
designed for a resource rich system. So
instead of trying to optimize for small size
he actually tried to use as much as he could
force himself to use. The compiler is still
about 1K and remains resident in memory.
Since compiles are instantaneous Chuck
intends to keep things in source and compile
them when needed. Source and object code
are about the same size.
The name dictionary is also about 1K. This
sounds very much like ancient Forth systems.
But unlike those old systems that used a
small kernal that was the minimal needed to
compile anything and then extended this
by compiling the full Forth compiler and
interpreter to extend the system to a full
Forth before you can do something useful
his complete compiler/interpreter is about
as big as the old kernels. Also with
compile times many thousands of times faster
compiling modules is faster than loading
precompiled object code in other systems.
He is using his ATI graphics card to do the
work of displaying. He says it was more work
than it would have been to write code and just
do it in software, but it does take advantage
of the hardware that is there. He is working
in 1024x768 mode with a display routine as
a background task with 5 to 30 screen redraws
per second. He is still using large characters
and has 40x25 on the screen in a block. Blocks
are 1K bytes, 256 32 bit words. It is a word
addressing system which is a close match to
his Forth chips and bytes are not important
for his OKAD work.
He is booting from the boot sector on the floppy
in protected mode with access to the full memory.
The boot sector also contains the floopy driver.
He is just reading and writing complete tracks on
the diskette. Later he will provide a hard disk
driver that he will need for the OKAD port.
He has technical docs for the sound card and
network card and will add drivers in the future
to use these in his Color Forth.
I am sure I left out lots of stuff. He talked
for an hour and a half and then took questions.
In short Chuck is doing a lot of wierd stuff
in his Color Forth and says he is having a
lot of fun doing it. He said, Forth is a game,
life is a game, and it should be fun.
Jeff Fox
http://www.UltraTechnology.com