Overview
amforth is an interactive and extendable command interpreter for the Atmel AVR8 Atmega microcontroller family. It features a simple turnkey-solution for embedded use as well.
The command language is FORTH. amforth implements an almost compatible ANS94 indirect threading 16bit Forth with very few missing CORE words, some words from the extension word sets (including some words from the Forth200x) and a few of its own words.
The system runs completly on the controller. It does not need additional hardware beyond a power supply. It places no restrictions for hardware extensions that can be connected with the controller, e.g. external RAM.
The interactive feature requires a serial line via RS232 (usb2serial converters work well). Other connections like TCP/IP telnet or radio links are possible as well, may require some implemention work however.
amforth is published under the GNU Public License v2 (GPL).
amforth needs less than 8KB Flash memory, approx 50 bytes EEPROM and 100-150 bytes RAM for the core system (including the compiler words).
amforth can be downloaded from the project page.
Karl Lunt has written an excellent User guide on how to use and work with amforth. For those who want to take a deeper look into the system is the Technical Documentation (PDF, 24.1.2010). which is slowly growing.
News
24.1.2010: release 3.7
- core: atxmega 128 support (no compiler yet).
- core: new word
>number.numberaccepts trailing (!) dots to enter double cell numbers. - lib: enhanced multitasker with turnkey support. Thanks to Erich Wälde for in depth debugging and testing.
- lib: new word
anewdrops word definitions if already defined, starts a new generation. - core: USER area is now split into system and application user areas, system user area is pre-set from EEPROM.
- new: source repository incubator for not-yet-ready-but-interesting projects, volunteers welcome.
1.10.2009: release 3.6
- core: new word
environment. It provides the environment wordlist identifier, thus make it possible to create own environment queries as standard words. - core: new word
d=. - core: amforth runs partially on an atmega2561 and atxmega's, there is still no
working flash store word (
i!) therefore only the interpreter is available yet. - core: moved the usart init values to appl section.
- core: added a poll-only receive word, selectable at compile time. Disable the rx interrupt to use it.
1.9.2009: release 3.5
- core: re-structure the usart code, added a non-interrupt based transmit word (TX), selectable at compile time.
- lib: added
xt>nfathat goes from the XT to the name field address. - core: bugfix
recurse. - core: restructured EEPROM, never depend on fixed addresses for system values.
- core: added a
dict_wl.incfile with most of the non-core wordlist commands.
Notes
amforth uses the serial line uart0 (can be changed at compile time) as the terminal. Serial line settings are 9600 8N1, no flow control.
Development hardware are a few evaluation boards running varios atmega's at 8 MHz or 16MHz with a few led's and pushbuttons. Some special notes for the Atmel Butterfly.
The source is developed with Atmels avrasm2 and avra (linux) and sometimes debugged in the simulator from the AVR Studio 4 (Windows).
Known Bugs
These are known effects that one may call bugs for the lastest development revision (trunk). They may or may not get fixed for the next release(s).
-
The following code does not work:
: x0 ." " ;(compiling a string with len 0 (zero)). This is due to the fact that."useswordinternally which skips the leading characters used as delimiters. Thanks to Michael Kalus for this analysis. - up to and including core version 2.6 double cell values have the order: TOS low part, NOS high part. Since 2.7 this is
the other way around. You should always use
s>dandd>sfor conversion.
Not Really Bugs
amforth has the following known effects, that someone may call bugs. This list is not complete. And the entries are not considered bugs.
-
The return stack has an off-by-one effect when using it's addresses:
> : rstest 1234 >r rp@ @ . r@ . r> ; ok > rstest 3405 1234 ok > : rstest2 1234 >r rp@ 1+ @ . r@ . r> ; ok > rstest2 1234 1234 ok >
+loopassumes signed values for both loop counter and loop limit.