MPE Logo
MicroProcessor Engineering,
Limited
"More real, less time."

Main page & What's new?
Information and Services 
MPE Software 
MPE Hardware 
Development Hardware 
Free Downloads  
Pricelist 
Contact Us or Place an Order 


VFX Forth

Last updated 26 May 2009


Visit our papers page to download our VFX Flier and benchmark code and results.

Click here for the VFX Forth v4 change history; or hhere for change notes for earlier versions.

Get the free download of the evaluation version of VFX Forth. No time out!

A customer with a CPU simulation system sent the following comment about VFX Forth v3. Naturally v4 is faster still!
"I get some interesting results when I do:
1000000 BENCHMARK
BigForth 57 seconds
Win32Forth 78 seconds
SwiftForth 56 seconds
VFX Forth 5 seconds"

Features  

PDF help system

The new help system allows you to type

HELP 
from the console to access the correct page of the PDF manual.

VFX Code Generator

MPE's VFX Forth for Windows has consistently proven itself to be the fastest Windows Forth available by a considerable margin. The benchmarks to prove it are on our web site. The v4 release includes many detailed changes to the code generator making v4 even faster than before with no increase in code size.

VFX Forth‘s VFX code generator generates native code with optimisation and inlining. Using mainstream compiler techniques the VFX optimiser can merge many Forth words and reduce memory access to a minimum. At its most elementary level the effect of the optimisation is impressive:

: n>char \ n -- char
dup 9 >
if 7 + endif
[char] 0 +
; ok

dis n>char
N>CHAR
( 00463D44 83FB09 )       CMP EBX, 09
( 00463D47 0F8E03000000 ) JLE/NG 00463D50
( 00463D4D 83C307 )       ADD EBX, 07
( 00463D50 83C330 )       ADD EBX, 30
( 00463D53 )              RET
16 bytes ok

However, unlike other Forth code generators, VFX can optimise all data stack traffic to a mimum sequence. VFX Forth includes constant folding and may other techniques from compiler theory. The result is code generation that is within 25% of hand-written assembler sequences. A set of benchmarks and further papers on the VFX optimiser are available from our downloads page.

The user has control of the inlining level, so that trade-offs between speed and space can be investigated. The default levels are:

NO INLINING
NORMAL INLINING
AGGRESSIVE INLINING
ABSURD INLINING

The VFX code generator also tokenises many small definitions that are expanded during compilation, so removing not only the call/return overhead but also permitting the optimiser to operate across the call/return boundaries.

Even with all optimisation options enabled, VFX Forth compiles extremely quickly. Fast compilation speed and ease of testing provide a rapid, interactive, and productive compile-debug-fix cycle. Incremental compilation means that only new code needs to be compiled, leading to even shorter compilation times. 

A set of application benchmarks follow. The columns show VFX Forth v3.4, iForth v1.11, and SwiftForth 2.0. The current benchmark code and results are available from our downloads page.

Test including overheads (all times are in milliseconds, Athlon 900Mhz, 256Mb RAM, Windows 2000)
VFX Forth 3.40.0686
iForth 1.12.1121
SwiftForth 2.00.3
Erastothenes Sieve – 1899 primes 380  326  441 
Fibonacci recursion (34 -> 9227465) 300  543  511 
Hoare’s QuickSort (reverse order) 260  892  651 
Generate random numbers (1024 kb array) 271  336  8071 
LZ77 Compressor (100kb, random data in mem.) 340  2852  5508 
Dhrystone (integer) 271  440  882 
Total 1893  5445  16103 
Ratio 1.0  2.88  8.51 

Users of previous threaded code systems such as ProForth for Windows 2.2 should note that applications can be expected to run over ten times faster, and that writing CODE definitions is now unnecessary.

Studio Development Environment

The Developer Studio IDE is provided as full source code, and includes features such as the dictionary browser which allows you to find, decompile, and locate the source code of any word in your application, or even in the VFX Forth kernel. The Studio IDE provides user definable hooks to any text editor for editing or source location. You can add your own extensions to the Studio IDE for improved productivity.

  • Browser
  • Debug Console
  • Breakpoints
  • State Monitor
  • Calculator
  • DLL scanner
  • ASCII chart
  • RC file stripper
  • Win 32 API help
  • State save/restore
  • Click here for more details.

    DFX debugger

    Provided with the Studio IDE is the DFX debugger, featuring single stepping, tracing, instruction logging and watchpoints at the assembler or Forth source code levels. Like the rest of the Studio IDE, DFX is provided as source code.

  • Breakpoints
  • Register display
  • Assembler view
  • Instruction trace
  • Stack displays
  • High level view
  • LOCATE and XREF hooks
  • Memory views
  • State save/restore
  • Debug Forth Interpreter in a separate thread
  • "Narrow down" mode for rapid fault location
  • Click here for more details.

    Resource File Compiler

    VFX Forth includes a resource file compiler that permits the use of standard resource files. Unlike other applications, these files are compiled directly as part of the normal compilation process, and can be edited by hand or by a resource editor. VFX Forth supports all the standard Windows controls. The following code is taken from the VFX Forth front end.

    #define IDW_FORTHWINDOW $3801

    IDW_FORTHWINDOW WINDOW 0, 0, 100, 100
    BEGIN

    Caption "Forth Console"
    Style WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
    ExStyle WS_EX_MDICHILD
    ClassStyle CS_HREDRAW | CS_VREDRAW
    Icon IDI_APPLICATION
    Cursor IDC_ARROW
    Brush WHITE_BRUSH
    Menu NULL
    WndProc ForthWindowProc
    END

    GUIgen

    GUIgen is a way of simplifying construction of GUI interfaces in a "Forth-like" manner. It has been used for several years to build production user interfaces. A number of features have emerged which are generally and genuinely useful. These are (in no particular order):

    • Window classes, windows, dialog boxes and controls are each defined in a similar way.
    • The difference between "modal" and "modeless" dialog boxes is largely hidden.
    • All Windows controls are "automatically" subclassed which allows you to add control-specific message handlers simply without dealing with subclassing in Windows.
    • New window controls can be defined extremely easily.
    • Controls can be "placed within" dialog boxes as is usual but in addition they can be placed within normal windows and within other controls.
    • Each window, dialog box and control has its own private data area.
    • Words which are designed to be executed inside a WndProc procedure can be tested at the keyboard.

    The following code is for a dialog box and is taken from one of the example files.

    DialogBox:  TextDlg
        50 10 110 50 Position&Size
        Modal
        Caption "Enter Text"
    
        WS_VISIBLE  Style
        WS_CAPTION WS_POPUP or Style+
        WS_BORDER Style+
    
        8 100 0 Font "MS Sans Serif"
    
         5 5 100 12 IDC_EditBox z" Hello"   EditBox
        10 25 40 15 IDC_OK      z" &OK"     PushButton
        60 25 40 15 IDC_CANCEL  z" &Cancel" PushButton
    
        WM_INITDIALOG   does TB-DoInit
        WM_COMMAND      does TB-DoCommand
    
    end-dialog
    

    GUIgen is documented in a separate manual, which is currently over 160 pages.

    Windows API Access

    VFX Forth can access all the standard Windows API calls, as well as functions in any other DLLs. The function interface allows API calls to be defined by cut and paste from other language reference manuals, for example:

    EXTERN: int PASCAL CreateDialogIndirectParam( HINSTANCE, void *,HWND, WNDPROC, LPARAM );
    EXTERN: int PASCAL SetWindowText( HANDLE, LPSTR );
    EXTERN: HANDLE PASCAL GetDlgItem( HANDLE, int );

    Windows Constants

    VFX Forth incorporates a support DLL that provides development-time access to over 28,000 named Windows constants without impacting the size of the application. Windows constants such as GENERIC_READ are treated as literals and are fully optimised.

    Local Variables

    Windows programming regularly requires the use of temporary buffers and variables. VFX Forth incorporates MPE’s extended local variable syntax as well as the default ANS syntax. Of course these are fully optimised by the VFX code generator. The following example is taken from a RichEdit handler:

    : DoContextMenu { hwnd posx posy | hmenu pt[ POINT ] -- }

    ;
    This declares three named inputs (hwnd, posx and posy), a local variable (hmenu) and a local array (pt[) of size POINT.

    Robust Exception Handling

    VFX Forth uses the ANS Forth CATCH and THROW mechanism for nested exception handling, but also integrates this with the Win32 exception mechanism so that all exceptions can be handled by VFX Forth applications, and all information is available to the user for post-mortem analysis or error recovery.

    Source Management

    VFX Forth includes a cross reference tool that allows you to find out and display where words are used, and also to find out which words are unused for final code reduction. Just type LOCATE <name> and the source code for <name> is there on the screen for viewing or editing. XREF <name> will tell you where the word is used, and XREF-UNUSED will tell you which words in your application have not been used.

    Examples and Libraries

    VFX Forth comes with a wide range of application examples including versions of the classic examples from Charles Petzold's book "Programming Windows".

    Libraries include floating point, serial communications, DDE, benchmarks, BNF parsers, a state monitor, binary overlays, full file system support, and more than a dozen application-oriented examples to get you off to a flying start. Any standard console mode output can be redirected to a window. Naturally full use can be made of the Win32 multitasking. More examples include the SuperTed editor, a webserver, serial terminal emulator, turnkey application generation, as well full source code for Studio IDE and DFX debugger.

    PowerNet

    The PowerNet Echo, Telnet and Web servers have been ported to VFX Forth and are shipped with the Professional and Mission versions. These are multi-threaded servers. The Web server supports CGI and ASP, with Forth being used as the scripting language. SOAP, XML and Web Services are provided for direct interchange of information between VFX Forth and and any web service enabled product such as Excel, and Project. The PowerNet shipped with VFX Forth is an enhancement of the code in the embedded verion, so see the PowerNet page for more details of PowerNet

    PowerNet can be embedded inside your applications to provide fully Web enabled systems.

    DocGen Documentation and Help Generator

    Built into VFX Forth, the DocGen system can produce documentation for code while it is being compiled. DocGen processes formal comments in your source code, extracts them, and formats them into word processor files in HTML, PDF, TEX or user definable formats. Now your source code can include an up to date manual for your project! The VFX Forth manual is itself built this way. The following example is part of the source code for selector chains.

    : exec-chain? \ i*x n addr -- j*x true | n FALSE ; MPE.0000
    ( *G Run through a given chain using TOS as a selector. If a match is )
    ( ** made execute the relevant code block and return TRUE otherwise )
    ( ** the initial selector and a FALSE flag is returned. )
       ...
    ;

    The result is the automatic generation of the glossary entry for this word in the manual. DocGen allows multiple files and sections, table of contents, titlepage generation, several levels of headings, special facilities for examples, and a choice of public or internal release documentation.

    Note that DocGen can work with any Forth source code files, not just those for VFX Forth for Windows, making it ideal for use with MPE's Forth cross compilers.

    A special version of DocGen has been developed for safety critical applications. DocGen/SC generates documentation to the US Food and Drug Administration requirements. For a client's application, DocGen/SC generates over 1500 pages of documentation in PDF format from the project source code in under two minutes!

    The CD distributions of VFX Forth include a version of LaTex2e which will generate PDF files directly from DocGen output.

    Internationalisation

    The file LIB\INTERNATIONAL.FTH permits full internationalisation of applications according to the ANS draft standard for internationalisation.

    You can define text messages to be internationalised. A simple set of hooks allow you to export text for translation and later reloading at run time.

    The supplied code is based on techniques used in a major Forth application running all over the world.

    Rapid Development

    Conventional Windows programming requires you to use an editor, language compiler, resource compiler, and finally a linker before even a small change can be tested. With VFX Forth, you just make your change using your favourite Windows editor and recompile directly into executable form in seconds. You can drop code from your editor directly into the VFX Forth console for immediate testing of any definition, or you can just type it at the keyboard.

    VFX Forth includes all the tools you need to create bound turnkey Windows applications.

    Powerful Testing and Debugging Aids

    VFX Forth includes extensive programming aids, including the ability to run your application in one or more windows while you monitor its functions using a separate State Monitor window and the Studio debugger.

    Tools such as the Dictionary Browser and online help make programming a breeze. The Dictionary Browser lets you call up any of the hundreds of functions supplied with VFX Forth or added in your application, and either decompile it or dump its memory area. On-line help documents all standard VFX Forth words using HTML help. You can modify these and produce your own help files, which can be added to the Studio IDE.

    System Resources Give You Full Control

    VFX Forth for Windows provides a complete set of system resources and development tools to give you maximum control over your application. These include:

    • Binary overlays
    • Dynamic heap management
    • 80386/387 assemblers
    • Turnkey application generator

    VFX Forth includes all tools required to compile, test and create bound versions of your applications for distribution.

    Fully Compatible with Windows 98, NT, 2000, XP, Vista

    VFX Forth for Windows is a 32-bit Forth implementation for all 32 bit versions of Windows. You can write applications that are fully compatible with both Windows 9x systems, or take advantage of specific features of Windows 2000, XP and Vista. VFX Forth supports access to all third-party DLLS.

    System Requirements:

    • Any version of Windows 98, NT, 2000, XP, Vista.
    • A maths co-processor is required for floating-point maths.

    Compatibility with other MPE Products

    The VFX Forth kernel is source-code compatible with MPE’s Forth 6 cross compilers, and compatibility for earlier versions of VFX Forth for Windows and MPE's Forth 83 standard products has been made simple. A harness exists to ease conversion from ProForth for Windows v2.x.

    Ordering

    VFX Forth is available in four editions, which differ in the level of source code provided:

      Evaluation: Free download from this website. The full system with a short nag screen, no timeout, no kernel sources, no turnkey generation and no PowerNet.
      Standard: Full system with turnkey application generation, full kernel sources except for the VFX code generator but no cross compiler or tool source code. No PowerNet. 90 days of tech support and upgrades.
      Professional: Full system with the PowerNet web server, all kernel sources and the MPE Forth 6.2 VFX 386+ cross compiler. With this system you can modify and extend the VFX Forth system. Requires a Non-Disclosure Agreement to be signed. One year of tech support and upgrades.
      Mission: Full system with all sources and cross compiler, and full source for all support tools, including the cross compiler, EXE file generator, support DLL, resource stripper. Requires a Non-Disclosure Agreement to be signed.

    Note that educational users can obtain all the VFX Forth editions at a 50% discount.

    Upgrades are available from one version to another.

    Support Services

    MPE has been supporting professional Forth users since 1981. We offer the following services:

    Standard Support

    Fax and email hotline technical support on the use of VFX Forth. Within 3 months of purchase any updates are provided free of charge.

    Extended Technical support

    • All upgrades as they are released from development, usually 4 times per year
    • Direct access to the development team
    • Involvement in the development cycle
    • Annual fee

    Advanced Technical Support

    • Forth Programming Courses
    • Custom Application Design
    • Programming Services
    Courses, Consultancy

    MPE can provide start up courses or consultancy using VFX Forth for Windows. The MPE course ‘Cleaner Windows’ is for VFX Forth, “Embedded Software for Hardware Engineers” covers cross compiling, and “Architectural Introduction to Forth” is a Forth conversion course. Contact MPE to find out more.

    Go to the pricelist page


    TopReturn to Top HomeReturn to HomePage