Win32Forth

Overview of the Architecture

Architecture

Version 6.10.00 of Win32Forth is a linear 32bit addressing Forth that uses absolute addressing within the Forth dictionary. That is, Win32Forth is always loaded at physical address 0x40000. (This was not always so; earlier versions used a relative addressing mode, the hangover of which can be seen in the use of the register EDI as a base address to turn relative addresses to absolutes. Now Win32Forth builds true executable files; previously "image" files were loaded by a C wrapper.)

In January 1996, Win32Forth had grown to over 5000 words and 550k bytes of dictionary, which seemed like a lot of overhead to add to a small application program. The solution Andrew came up with was to split the forth dictionary architecture into two parts, application and system. The Application dictionary holds "bodies" of all the words that an application might need to use at program run-time. The System dictionary holds all the non-application words, like those used only during program compile time. These include vocabularies, windows constants (they are compiled as literals), assembler, disassembler and the headers for all the words in both dictionaries. Using this split or dual dictionary architecture reduces a TURNKEYed applications overhead by over 200k bytes. We realize of course that not all applications can be turnkeyed, so the old standby FSAVE (from F-PC) continues to be provided, so that applications that need full forth dictionary access can still be created. A new program save word APPLICATION allows saving programs like TURNKEY, but allows setting the amount of free application dictionary and system dictionary space for the application to use at runtime. APPLICATION also saves the program with all headers and the system dictionary, so it can be easily debugged using the Integrated debugger interface.

Meta-Compilation

Win32Forth uses a meta-compiler to build a small kernel that can be extended to a full-blown WIN32FOR.EXE. This technique allows W32F to bootstrap itself form source; a small setup program (actually just the kernel and some supporting code that is FLOADed, rebuilds the kernel, extends the kernel into a full system, then compiles the applications that come with the system.

In Depth

For in depth architecture details, go here.


Document $Id: p-architecture.htm,v 1.1 2004/12/21 00:18:55 alex_mcdonald Exp $