forked from CharleyShattuck/myforth-arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHOWTO
14 lines (7 loc) · 2.21 KB
/
HOWTO
1
2
3
4
5
6
7
8
9
10
11
12
13
This guide is to help you understand the structure of a myforth/arduino application.
The base directory, where this file resides, contains all the primitives for myforth. A generic "job.fs" file is here to help to get started with a new app. "job.fs" is your configuration file. This is where you decide whether to run the interpreter or the application, and all the primitives are loaded and compiled in the correct order. This file really belongs in an app directory though, in this case the "steno-keyboard" directory.
Any applications that you build belong in their own directories off of this one. The "steno-keyboard" directory has the load files and scripts specific to this app. Each app directory will have its own "job.fs". It will also have a file called "main.fs" which should contain your application, including a word named "go" that has the initialization and main loop of your app.
The app directory also contains four script files; "c" for compile, "t" for test, "d" for download, and "m" for monitor (or miniterm to be specific). These are meant to be run from the command line. When things are going well you do some editing and "c" to compile, then "d" to download and "m" to run the terminal and test words interactively. If there is a problem compiling or if you just want to get more information, run "t". This command leaves you in gforth where you can decompile via "see <word>". Press space to see the next line or return to finish decompiling. "bye" quits gforth.
So far I have only run this in Linux, in a bash terminal. The scripts assume that you have installed gforth, the Arduino IDE (for AVRDude) and minicom.
You should know that this is not ANSI Forth. It is more of an assembler made to resemble colorForth. Conditionals such as "if", "-if", "while", "-while", "until" and "-until" do not consume the top of the stack. Though "@", "c@", "!" and "c!" each take an address argument; "@+", "!+", "c@+" and "c!+" do not. They all use the "address" register, which is loaded by "a!" or any of those non-incrementing memory operators. "if/", "while/", and "until/" have been added and pop the data stack like classic Forth would. Sometimes that's what you want.
See the file "vocabulary.fs" for descriptions of all the primitives.