*ln6 *cn1;** * * * * * * * * * * * * ** * * * Blazin' Forth for CBM-64 * * * * System Documentation * * * ** * * * * * * * * * * * * ** *ln20 This documentation and the software it describes are Copyright (C) 1985 by Scott Ballantyne Distribution on a not for profit basis is encouraged. Sale or Resale of this manual or software is not allowed.*cn0 *fp0 *ln5 I would like to acknowledge the following people, who contributed time, support or knowledge to this effort: Glen Haydon, author of MVP-FORTH, whose book ALL ABOUT FORTH was my constant companion during the early stages of this project. Henry Laxen, Forth Wizard and writer. Many of the best features of this compiler are due to his ideas, and his columns in Forth Dimensions are among the best and most creative writing on Forth I have ever seen. In particular, Laxen is the creator of the DEFER IS concept. To RMS and WRG, wherever you are, thanks for everything you taught me. Thanks to Chris M. A friend indeed. Special thanks to BJ, who knows what she did. Thanks to all those who put up with various versions of this compiler, and suffered almost as much as I did while debugging it. CBM C64 C128 and Commodore-64 are trademarks of Commodore Business Machines. *ln6 This software is dedicated to the memory of Leonard Rose. *fp0 *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 filli...
Amiga7878