text
stringlengths 0
99.6k
|
|---|
*cn1;Introduction*cn0
|
This manual describes the special features of the Blazin' Forth compiler. It is not necessary to read the entire document before using the compiler.
|
I would strongly urge you to at least glance through the first part paying special attention to the sections describing MOUNT and the EDITOR.
|
Once this has been taken care of, you may proceed immediately to the portion you are most interested in. Blazin' Forth supports the sound chip, Turtle Graphics, and Sprites, as well as containing a complete string handling package. Please feel free to start with the sections which interest you the most.
|
*fp0
|
*hd3:Blazin' Forth Documentation,System Information,-#-
|
*cn1;Description*cn0
|
Blazin' Forth is a complete Forth-83 system for the Commodore-64 computer. It includes all the words from the Required Word Set, the Double Number Extension Word Set, and the Assembler Extension Word set. It also includes almost all of the Controlled Reference Word set, and applicable words from the Uncontrolled Reference Word Set. The words omitted from the Controlled Word Set are --> , K , and Octal , all others are included. This system also contains its own versions of the System Extension Word Set, which include various compiler security features.
|
In short, this is a complete implementation of the Forth-83 standard, suitable for developing programs which may be ported to other systems, or running programs developed on other systems.
|
There are also various extensions to the standard system, which include additional boolean operators, words like ?KEY , ?DO, and ?LEAVE , which are very useful, but not yet part of the standard Forth language.
|
When I first started writing this compiler, I had two main goals in mind. The first was to have a fast Forth-83 compiler on the C64. The other was to provide access to all of the nifty hardware features of this computer. Blazin' Forth includes words which make it simple to access the sound chip, and graphics chips of the 64. In particular, it includes a Turtle Graphics extension, which is by far the fastest implementation on the C64 I have ever seen.
|
This document describes all of the features specific to Blazin' Forth. For information on Forth, I would suggest you obtain a copy of the Forth-83 standard, which is available from the Forth Interest Group (FIG) for a few dollars. If you are new to Forth, the book Starting Forth, by Leo Brodie, contains a very complete tutorial on the Forth Language. There is a file available, Start Blazin' Forth, which is intended to help you over the hurdles caused by the differences between the Starting Forth dialect of Forth (which is an earlier implementation of Forth) and Forth-83. Note that there are not many differences between the two.
|
This system, its documentation and source code are Copyright (C) 1985 by Scott Ballantyne. Free distribution of this compiler is encouraged, distribution for profit is not allowed. (Users Groups and SYSOP's of bulletin boards may charge a small fee to cover their operating expenses. If in doubt, please ask.) Note that this system is not public domain, nor is it freeware. I don't want your money. If you like this system, why not contribute some software of your own? On the other hand, if you don't like it, why don't you contribute some software of your own? We all badly need good software.
|
Blazin' Forth has been very carefully tested by a group of several people, some old Forthers, and some new ones. I believe this system is free of bugs, but suggestions for improvement are welcome, as are bug reports, should any new ones be discovered. A version for the C128 is planned which will include more features, such as Multi-tasking, a hashed dictionary structure (for super fast compiles) and other stuff. Dynamic vocabulary chaining is also being examined. Comments on any of these topics, or any other suggestions for improvements are very welcome. If you do communicate with me, please include the version number of your Forth system, (obtainable by typing .VERSION). I may be reached through Electronic mail:
|
Compuserve: 70066,603
|
Sourcemail: BDE712
|
Enjoy - and may the Forth be with you!
|
SDB
|
System Configuration, SAVE-FORTH
|
Forth differs from other languages in many ways - one of the nicer ones is that it gives you a choice of the final configuration of your own system. When you first run Blazin' Forth, everything will be present in the dictionary - the string extensions, the Turtle Graphics words, the Sound Words, all utilities, everything. Since source code is provided for all system extensions starting with THRU , you may FORGET up to that point, and selectively compile the words you need. It is even possible to have many different Forth versions available. You may choose to compile only the editor, and the sound extensions, for example, to give more room for music applications. You may then save the new system by using the word SAVE-FORTH . You will be prompted for a filename, and the new system will then be saved to disk. Note that the modules are relatively independent (the sound extensions, string extensions, and graphics extensions are completely independent), but all require that the assembler be loaded, and may also use a few, but by no means all, of the Utility words.
|
If you FORGET THRU , you will have 41167 bytes of available memory, which you can use in any way you wish. (Warning: You will also remove the Assembler, and the Editor from memory if you do this!) This is a *lot* of memory, since Forth code is extremely compact.
|
Note that this also gives you the freedom to define your own system extensions - if you want more or different utilities, you can add them. If you don't like the way the string functions work, you can change them. There is no need to work around a system word that doesn't do exactly what you want - you can customize this Forth to your liking. ( Warning: Do *not* save a new Forth system to a disk which contains Forth source screens. See the EDITOR section for more info.)
|
CONFIGURE
|
Using CONFIGURE, you may alter the actual memory configuration of the system. At power up, Blazin' Forth has 4 virtual disk buffers, located from $C000 to $D000 . Should you want more or less ( adding buffers subtracts from the dictionary space, and cuts down on disk accesses, removing buffers increases dictionary space) you can do this as by using CONFIGURE .
|
Example: Configure to use 1 disk buffer:
|
1 IS #BUF ( tell Forth how many buffers)
|
CONFIGURE ( reconfigure)
|
You can also lower the top of memory. This could be useful to reserve memory for an RS-232 buffer, sprite data, or machine language programs.
|
Example: Lower top of memory to $C000
|
HEX ( use Hexidecimal base)
|
$C000 IS LIMIT ( tell Forth how high it can go)
|
CONFIGURE ( reconfigure the system)
|
STARTUP
|
You can have FORTH come up running a resident application. STARTUP is a system variable that holds the code field address of the first word to execute when first run, on an error, or on a RESTART. Your word must take over the functions of the FORTH word QUIT . For example, to have FORTH run a word processing application when first run, we define a word FOO , that will execute this program:
|
: FOO BLK OFF SP! BEGIN RP! ( take on functions of QUIT)
|
PROCESS-WORDS ( execute the program ) AGAIN ; ( forever)
|
Now that this is done, we change STARTUP :
|
' FOO STARTUP ! ( store code-field of FOO in STARTUP )
|
And then save this as a new system file. Warning: Be careful not to cause an error at this point, or the system will dump you into your word processing program!
|
MISC:
|
This Forth ignores case, unless you are entering literal strings between quotes. So, for example, whether you type EMIT emit Emit or EmIt , the result will be the same - EMIT will be executed. This allows you to program in a mixture of upper and lower case.
|
Hitting RUN/STOP RESTORE will cause the FORTH system to warmstart. Default screen colors will be restored, the stack will be cleared, and decimal will become the current numeric base. Channels to the disk are unaffected, as are user programs and source screens in memory.
|
Typing RESTART will cause a cold start of the Forth system. This will return the system to the same configuration it had when first powered up.
|
Typing BYE will exit FORTH, and return to BASIC.
|
THRU is the best way to compile a sequential range of screens. It is far better than filling a screen with a series of LOAD commands. Example: 5 25 THRU will load screens from 5 to 25 inclusive.
|
*cn1;EDITOR*cn0
|
The EDITOR included with the system is the same as the one included in the book STARTING FORTH. All the editor commands described there are included in Blazin' Forth.
|
VERY IMPORTANT !!
|
Before accessing the disk drive, you must first type MOUNT, to initialize Forth's virtual memory system, and the disk drive. (Make sure a disk is in the drive before using this command.) This command must be used before LIST , INDEX , TRIAD , LOAD or THRU . MOUNT should also be used after changing disks. You only need to execute MOUNT once, at the start of an editing session, or before compiling (unless you RESTART , or change disks), but you can't get to the disk without it.
|
Forth uses random access files. Random access files don't show up in the directory. A disk can be filled with Forth screens and a directory listing will still show an empty disk. Therefore, it is very important not to mix Forth source screens with standard CBM files. (Note: You can use standard CBM file types from forth - you just shouldn't mix them with your source code!)
|
The disk drive light will remain lit while the system is enabled. This is normal, and should not cause you any concern.
|
The word DCLOSE will close all of the channels to the disk drive, and turn off the light on the drive.
|
*cn1;PROGRAM DOCUMENTATION*cn0
|
The following words are included to aid in program documentation:
|
xx LIST Lists screen# XX to the current output device. Enters the Editor.
|
xx TRIAD Lists the three screens including XX as a member to the current output device. The screens are formatted to fit on one normal sized sheet of printer paper. Example: 7 TRIAD will list screens 6, 7, and 8 to the screen. Includes PAUSE.
|
XX YY TRIADS list all triads from XX to YY . Note that this word assumes your printer has automatic paging. Includes PAUSE.
|
XX YY INDEX Lists all first lines of all the screens starting with XX through and including YY. If you follow the FORTH editing convention of starting each screen with a comment, you can use this word to quickly locate words. Includes pause.
|
WORDS Lists all the words in the current search order. Note that WORDS includes PAUSE. See PAUSE for more information.Same as the older VLIST.
|
*cn1;PROGRAM DEVELOPMENT AIDS*cn0
|
LOCATE
|
Forth Screens are great, allowing you to break up your programs into small modules, and even form interchangable libraries. One drawback, particularly in debugging, is the need to remember what screen number a particular word is located on. LOCATE removes this problem. For example, if you have a word, FOOBAR, which is in an application which you are currently testing, all you have to do is type LOCATE FOOBAR - and the system will list the screen which includes FOOBAR on the screen, and enter the editor. LOCATE will even access the disk if necessary! This is an extremely handy word. Try it, you'll soon wonder how you got along without it. Note that words in the pre-compiled portion cannot be LOCATEd.
|
DEBUGGING
|
Blazin' Forth contains several aids to assist in debugging and developing programs. Perhaps the most powerful word is TRACE. TRACE allows you to single-step through a Forth word, and observe it's execution step by step. For example, to trace a word called XYZZY , all you have to do is type TRACE XYZZY . Nothing will appear to happen, but the next time XYZZY is executed, Forth will enter single step mode. The word about to be executed will be displayed, along with the current stack contents. You have two options here. You can hit the RUN/STOP key, which will halt the program, and turn off the trace, or you can type CONTROL-P, which will enter PAUSE mode. Forth will display a P? prompt, and wait for you to do something. At this point, you can do anything you want. Alter the stack contents, LIST a screen, define a new word. You can also decide to trace a new word. This can be useful in tracing through levels of execution. To continue where you left off, type CONT . When the word has finished executing, normal program execution will resume. Once tracing has been enabled, there are only two ways to turn it off. Hitting the run/stop key during a trace, as described above. Or typing NOTRACE, either during a pause, or after the program has executed. Note: If you cause an error while in PAUSE mode, you will be dumped out of the current trace, but the trace is still enabled.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.