L.O.V.E. FORTH DEMO PROGRAM 1. INTRODUCTION TO L.O.V.E. FORTH 2. MEMORY USAGE 3. FLEXIBLE SOURCE CODE EDITING AND LOADING 4. VIRTUAL VOCABULARIES 5. GRAPHICS 6. ADDITIONAL FEATURES 7. ORDERING AND LICENSING 8. GETTING STARTED 9. QUIT Demo may be interrupted by pressing ESC key. "Specifications Subject to change without notice" **************************************************************** L.O.V.E. FORTH L_ake O_ntario V_ery E_fficient FORTH Copyright 1991 Homer Seywerd, Wolodymyr R. Elehew and Peter Cavén. **************************************************************** INTRODUCTION TO L.O.V.E. FORTH **************************************************************** o WHY L.O.V.E.-FORTH o WHO WE ARE o IMPORTANT FEATURES OF L.O.V.E. FORTH **************************************************************** WHY L.O.V.E. FORTH **************************************************************** Forth is a very powerful and flexible language, yet whose performance is very much dependent on the internal architecture of computers on which it is running. Almost all languages have problems running on the 8086/88, but these problems for FORTH are especially severe. Most FORTH systems on this architecture are restricted to 64K of main memory for program and data, and are referred to as small memorymodels. This restricts the user and programs to a small amount of memory, but offers the highest execution speed. 32 bit FORTHS have been produced with a large address space, butperformance has been severely degraded. ******************************************************************************************************************************** L.O.V.E. FORTH offers both a large memory size ( 320K ) and very fast execution speed. in addition.. Because all interactive utilties are stored in virtual vocabularies, the developement kernel may be used for final application programs without need to metacompile. ******************************************************************************************************************************** WHO WE ARE **************************************************************** We are three independent FORTH programmers who have been involved in custom FORTH programming. We created L.O.V.E. FORTH to meet our programming needs, and are making it available to others as a solution to FORTH programming on the IBM and compatible machines. Our hope is that it will also increase the general popularity and use of the FORTH language. **************************************************************** IMPORTANT FEATURES OF L.O.V.E. FORTH ****************************************************************General: - On-line hyper-help (TSR) for words definitions. - Separate segments for machine code, threaded addresses, data, stacks and headers allow large application programs. - Virtual vocabularies for full screen editor, assembler and utilities mean that these features do not take up needed RAM. - We consider Forth BLOCK disk usage obsolete, therefore we have removed all such words from the kernel. Complete source for these words, however, is provided. - Flexible source code loading from disk screens, screen files and text files (or intermixed) allowing up to ten levels of file nesting. - MS-DOS shell command allows utilities and editing from FORTH - Source code modules can be used in any program The Forth Assembler Problem Solved Most Forths allow assembly language -- but in a form of syntax foreign to most programmers: either restricted to RPN form or with other syntax limitations. L.O.V.E. Forth allows the usage of any 3rd party assembler such as A86 or MASM to assemble required code words allow standard syntax to be used. In addtion: built in linker allows resulting Microsoft format object modules to reference and create words in high level Forth . This allows considerable interaction between assembler and Forth. RPN Assembler included as virtual vocabulary source code - All 8086 instructions/addressing modes supported. - Most efficient op-codes generated. Utilities: - Memory dump, disk/screen copy/erase/compare - SAVE" forth system to file - APPLICATION" saves stand-alone program to disk - DOS commands may be entered from within Forth or the DOS shell may be entered. Editors: - Ability to use TSR text editors such as Borland's Sidekick - Ability to use almost any stand-alone editor through DOS shell, eg: DOS edlin your.txt - Virtual Forth screen editor (single full screen) with cursor control, ins/del line, word/line buffers, search Features of L.O.V.E. FORTH: - HyperHelp glossary - 83 FORTH model. - File handles used for DOS access. - Load files from within other files or screens or mixed, nested 10 deep. - Uses any available third part assembler or.. - RPN Assembler. - Links object modules in Microsoft format - Very Small kernel. - Many fundamental words implemented in CODE. - Local variables. - Dynamic revectoring of words. Multi-segment approach: The greatest memory enhancing factor in L.O.V.E. FORTH is the separation of the system into 5 logical segments: Machine code, threaded addresses, program data, heads, stacks. As the source code is being compiled it is parcelled into these five segments. There is NO execution time penalty over normal FORTH. Note that this implementation is quite compatible with standard 16 bit models. For example @ (fetch) and ! (store) access the program data segment (the vast majority of FORTH words use @ and! to access data). Another example is that the assembler always puts its code into the code segment. The programmer need not worry that the code has been separated from the rest of the program. Multi-segment compatibility: Even though segmentation is provided for in a logical fashion, some compiler words must be implemented differently than in standard FORTH. Included in the L.O.V.E. FORTH documentation are technical notes and examples to aid the programmer in this. Note also thatcomplete source code is provided to the registered user. Virtual Vocabularies: Many of the words required during interactive development are not required in target programs. The largest body of these are usually the editor and assembler. For maximum flexibility L.O.V.E. FORTH keeps editor, assembler and utilities stored in disk files which are automatically loaded when they are required. The kernel overhead is small. In this way the development kernel can be used directly in final applications. MEMORY USAGE **************************************************************** To provide the programmer with the maximum possible space while still preserving the 16bit model, L.O.V.E. FORTH is stretched across five 64K segments, for a full 320K of memory real-estate that most programmers will find pretty difficult to fill up. **************************************************************** The division is by type of data: CODE segment: contains 8086 machine code. THREAD segment: contains threaded address lists generated by high level words. DATA segment: holds data from variables, alphanumeric strings, and block buffers. HEAD segment: holds the compile-time word headers, and vocabulary links. STACK segment: holds the parameter, return and vocabulary stacks and local variables if used. Each segment has its own dictionary pointer, and some manipulation words such as CS:@ or HS:, - Target systems can be saved without heads. - Segments can be compressed to provide small target systems. - Because machine code is separated from threads it is actually possible to save space in the thread segment by re-coding some words in machine code. This gives L.O.V.E. FORTH a speed and size advantage over other Forths. - L.O.V.E. FORTH conforms closely to the architecture of the 8086/88 microprocessors. CODE SEGMENT **************************************************************** This is the only segment that contains 8086/8088 machine code. Apart from the space taken by a few pointers used in CREATE ... DOES> words, this allows code to reach a full 64K. Because the assembler places the definition body into the code segment automatically, the programmer is spared that burden. Like all segments the code segment has its own set of basic operators: CS:! CS:@ CS:C, etc, allowing the programmer ultimatecontrol. CS:HERE returns the next available address in this segment. THREAD SEGMENT **************************************************************** Forth high-level (:) words are compiled into a sequence of 16 bit addresses, called threads. This segment contains these threads, CONSTANT values, and pointers to data and code. Note that in the majority of applications this segment fills up the fastest. This segment always has an even number of bytes. The words such as TS:@ TS:! TS:, etc are included for easy manipulation of this segment. TS:HERE returns the next available address in this segment. DATA SEGMENT **************************************************************** This segment holds: Data from variables Alphanumeric strings BLOCK buffers Text input buffer: TIB PAD area Programmer defined data structures Most of the usual FORTH memory manipulation words, such as @ ! , TYPE ALLOT operate on this segment. HERE returns an address in this segment. HEAD SEGMENT **************************************************************** The head segment is normally used during compilation only. It contains the header part of a Forth word definition, including name, dictionary links and pointers. This may be discarded when creating a stand-alone system. Utilities such as WORDS and FORGET access this segment automatically. A set of head segment operators is also provided, such as HS:! HS:HERE returns the next available address in this segment. STACK SEGMENT **************************************************************** This segment holds the Forth parameter, return, vocabulary and local variables stacks. During development, allowing a full 64K to the stack segment means that system crashes due to stack overflow are minimized. Space for data may also be allotted in this segment for special applications. SS:HERE returns the next available address in this segment. **************************************************************** Notice in the following interactive demonstration how data is added to each segment as the work progresses: **************************************************************** FLEXIBLE SOURCE EDITING AND LOADING **************************************************************** L.O.V.E. FORTH allows source in: 1. Traditiional screens-only floppy disks. 2. MS-DOS files of screens. 3. MS-DOS text files. The above source files may be intermixed with ten levels of nesting. SCREEN FORMAT FLOPPY DISKS **************************************************************** The traditional Forth source code storage is on floppy disks dedicated entirely to sequential screens. L.O.V.E. FORTH supports both editing and loading of eight and ten sector formats. MS-DOS SCREEN FILES **************************************************************** The next evolution within Forth was to use MS-DOS files to contain Forth screens. L.O.V.E. FORTH supports editing and loading of screen files. A comprehensive screen editor and numerous utilities for screen handling are supplied. MS-DOS TEXT FILES **************************************************************** Text files are convenient and disk space efficient. Therefore L.O.V.E. FORTH accepts source code from text files. Because text editors are a very personal thing, L.O.V.E. FORTH allows you to edit text files with the text editor of your choice. Pop-up editors such as Borland's Sidekick are easily used. Any other text editors can be called up with our handy "DOS" function. Nested loading capability: LOVE FORTH allows files to be loaded from within other files. This permits screen files and text files to be intermixed and nested ten levels deep. LOAD: ===== Screen disk: Screen file Text file:From: Screen disk * * * Screen file * * Text file * * VIRTUAL VOCABULARIES **************************************************************** Forth is an interactive language. The programmer can examine and edit source code, test compiled words and dump memory locations as desired. In most Forths these interactive functions cost memory space. In addition assemblers often consume a large chunk of memory. The kernel used for development cannot be used for large application programs. Not in L.O.V.E. FORTH ! **************************************************************** **************************************************************** Virtual vocabularies are like normal vocabularies, but are stored on disk - in compiled form - until they are needed. Loading is almost instantaneous .. and they are loaded into high RAM so as not to interfere with ongoing development and compilation. There are : 80x86 ASSEMBLER and LINKER UTILITIES FORTH-SCREEN EDITOR SCREEN MANIPULATION UTILITIES 8086/88 RPN ASSEMBLER ********************************************************************************************************************************UTILITIES - memory map MEM-MAP - access to DOS commands and shell - memory DUMP - screen file / screen disk utilities ASSEMBLER / LINKER - allows 3rd party assemblers to be accessed and links resulting code - allows linkage of pre-existing object modules (Microsoft format) FORTH-SCREEN EDITOR - with insert/delete, search, functions ************************************************************************************************************************************************************************************************ In the following session, note the disk activity as the virtual vocabularies are loaded in and come into use. ******************************************************************************************************************************** **************************************************************** LOVE Forth offers a basic set of CGA GRAPHICS Includes: - point, line, circle, box, bar drawing - control of colour pallettes - draw on medium or high-res screens - draws axes - with ticks - integer SIN and COS - basic window control **************************************************************** ******************************************************************************************************************************** ADDITIONAL FEATURES L.O.V.E. FORTH also offers REVECTORING WORD SET LOCAL VARIABLES ACCESS TO DOS COMMANDS UPPER AND lower CASE ENTRY STILL MORE TO COME.. ******************************************************************************************************************************** **************************************************************** Re-defining - any word may be redefined to execute any other word - the redefined word may be restored to its original state Access to MS-DOS commands and shell - any standard command may be typed in and executed - programs such as text editors, debuggers may be run - running the DOS shell allows access to the DOS prompt to perform many activities Local variables allow - naming of parameters entering a word - definition of local variables for use within a word ******************************************************************************************************************************** UPPER / lower case entry - words may appear in upper/lower or a combination of case - optionally, words must match exactly the case compiled into the dictionary - hex numeric entry may be in upper/lower case or optionally upper case only **************************************************************** **************************************************************** Source Code Modules.. - quad precision arithmetic library - multiple code field words allowing intricate programming - self fetching one and two-D arrays with bounds checking Coming soon.. - 8087 support: assembler, floating pt. words, matrix math. - Multi-segment Metacompiler (recompile LOVE or targets). - Object oriented programming extensions. Also available from the makers of L.O.V.E. FORTH: - Z80 cross metacompiler and stand-alone kernel. **************************************************************** **************************************************************** GETTING STARTED **************************************************************** * What to do at 'Ok' * What are the vocabularies * Handy commands **************************************************************** ***************************************************************** The following demonstation illustrates many different commands. * Whenever you desire to see: ' Where am I ?? ' remember the commands ORDER and WORDS ORDER displays all the vocabularies in use and WORDS displays the words in the last vocabulary * The word DEVELOP has been added to set the order to be: ROOT FORTH TOOLBOX which is the usual state during programming or other activities. **************************************************************** **************************************************************** L.O.V.E. FORTH is a shareware product. Feel free to copy it, and give it to others. Only if you make use of this product, must you register. Registered users may make virtually unrestricted use of the compiler and support programs, royalty-free. For ordering information print the file: orderfrm.doc **************************************************************** ╒═════════════════════════════════════════════════════════════╕ │ Lake Ontario Very Efficient Forth │ │ To order, call or write to: │ │ (1) W. R. Elehew 519-767-2867 │ │ (2) Homer Seywerd 416-266-6420 │ │ (3) Peter Cavén 416-842-2662 │ │ │ │ Compuserve: 73700,2242 │ │ │ │ L.O.V.E. FORTH Product Support │ │ 60 Delaware Drive │ │ Guelph, Ontario │ │ Canada N1E 3V8 │ │ │ ╘═════════════════════════════════════════════════════════════╛