udamonic.com
  • Start
    • What is a Scamp?
    • Getting Started
    • Getting Started (Windows)
  • Learn
    • What is Forth?
    • Arithmetic
    • The Stack
    • Creating Words
    • Compilation Tricks
    • Decompilation
    • Comments
    • Characters and Strings
    • Accessing Memory
    • Constants, Variables and Values
    • Flow Control
    • Loops
    • Data Structures
    • Doubles, Triples and Quads
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Extras
    • Interrupts
    • Timers
    • Multitasking
    • Delays and Tick Count
    • Processor Words
    • Starting up with turnkey
    • Changing the Prompt
    • Formatting Text on Screen
  • Interfacing
    • Using the LED Array
    • Temperature Sensor
    • Input/Output
    • Analog Input
    • Serial >
      • Serial Communication
      • Scamp2 UART Pins
    • I2C >
      • I2C Overview
      • I2C Commands
    • SPI
    • PWM
    • Peripheral Pin Select
    • Input Capture
    • Digital Signal Modulator
  • Create
    • Creating PCBs >
      • Designing PCBs
      • Fabricating PCBs
      • Soldering
    • Sensing >
      • Measuring Temperature
    • LEDs >
      • Adding LEDs
      • LED arc-welder effect
    • Displays >
      • Adding a 7 Segment Display
      • Adding a Touch LCD
      • Touch LCD GUI
      • Game of Pong
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • FizzBuzz
    • Adding MRAM
    • Model Train Control
    • Adding a Real Time Clock
    • Scamp Projects on Youtube
  • Resources
  • Store
  • About
  • Contact
If you want to test drive Forth, there's an interactive Forth emulator and tutorial at https://skilldrick.github.io/easyforth/
​

What is Forth?
​

Forth was created by Charles (“Chuck”) Moore in 1968, to control radio telescopes. When he wrote Forth, Charles Moore envisioned that the “fourth” generation of computers would be distributed controllers, in essence embedded systems (although that term had not yet been invented). Hence, he called his programming language “Fourth.” However, since the IBM 1130 that he used for development only allowed for five-character file names, the programming language became known simply as Forth. 

Forth is unlike any other conventional programming language. Forth is an extensible, highly-interactive, stack-based language. It is extremely efficient and extremely versatile. The functionality of the language makes it ideal for debugging both system hardware and software. 

Forth is commonly used in systems under development and is often retained by manufacturers in their computers. Forth was the first resident software on the then new Intel 8086 chip in 1978, and MacFORTH was the first resident development system for the Apple Macintosh in 1984. NASA’s Voyager spacecraft run Forth, providing for both efficient firmware and the ability to interactively debug across the vastness of space, and Forth was also used by NASA in the Space Shuttle's Star Tracker subsystem. 

Forth is typically coded directly in assembly language both for speed of operation and to take advantage of the characteristics of the embedded computer. 

Charles Moore has said that his concept for Forth is that each implementation of the language should be optimised to take advantage of the machine on which it is running, even if this optimization compromises the portability of the language. This philosophy is a major departure from conventional programming ideology. With Forth, speed and robustness are the goals, not the ability to port applications between platforms. One version of Forth can be quite different to another.

The Forth running on your Udamonic computer is FlashForth, written by Mikael Nordman for the PIC and AVR processors. The website for FlashForth is http://flashforth.com where you can find the original source code for version 5.0, as well as documentation. FlashForth is free and open source, released under GPL. FlashForth was modified to run on the Udamonic computers, and has additional support specific to the Udamonic hardware. The source code for standard FlashForth may be found on our Resources page. You can use the about command on your Udamonic computer to display version number and copyright information.

Forth is at once a compiler, an interpreter, a debugger and, in a fashion, an operating system too. Languages typically fall into one of two categories, they either compile to machine code for their target computer (C and C++), or they generate bytecodes to be interpreted by a virtual machine (Java and Python). Generally, interpreted languages are interactive (to varying degrees), while compiled languages are typically not interactive at all. Forth is also a compiled language, but it is a compiled language with a difference. It is interactive, yet runs with an efficiency not far removed from hand-written machine code. Commands (known as words in Forth) get an immediate response. This, coupled with Forth’s ability to talk directly to hardware, makes it an excellent environment for embedded system applications.
Forth words are the equivalent of functions in C, Python or Java, or subroutines in assembly language. Forth allows the execution of any word in isolation from the command line. Thus, words can be independently tested and verified outside of the main application. So rather than writing a single, large program, small segments of code are written and tested independently. These words are then combined to create new words, eventually ending up with a single word that is the whole application. This new word is also available to the developer, and in this way the language both grows and becomes richer as the developer works with it. In addition, the words used to create the new word are still available and can be run as programs in their own right, or used to create other new words. Forth is both versatile and powerful.
​
This form of program construction makes Forth a “bottom-up” language rather than the conventional “top-down” programming methodology. Words written to interact with specific aspects of hardware (at the initial debugging stage) may be later incorporated in higher-level diagnostics or in the final application itself.

Next, learn how to do simple arithmetic in Forth.
Site powered by Weebly. Managed by Hostwinds
  • Start
    • What is a Scamp?
    • Getting Started
    • Getting Started (Windows)
  • Learn
    • What is Forth?
    • Arithmetic
    • The Stack
    • Creating Words
    • Compilation Tricks
    • Decompilation
    • Comments
    • Characters and Strings
    • Accessing Memory
    • Constants, Variables and Values
    • Flow Control
    • Loops
    • Data Structures
    • Doubles, Triples and Quads
    • FlashForth Dictionary Reference
    • Scamp Dictionary Reference
  • Extras
    • Interrupts
    • Timers
    • Multitasking
    • Delays and Tick Count
    • Processor Words
    • Starting up with turnkey
    • Changing the Prompt
    • Formatting Text on Screen
  • Interfacing
    • Using the LED Array
    • Temperature Sensor
    • Input/Output
    • Analog Input
    • Serial >
      • Serial Communication
      • Scamp2 UART Pins
    • I2C >
      • I2C Overview
      • I2C Commands
    • SPI
    • PWM
    • Peripheral Pin Select
    • Input Capture
    • Digital Signal Modulator
  • Create
    • Creating PCBs >
      • Designing PCBs
      • Fabricating PCBs
      • Soldering
    • Sensing >
      • Measuring Temperature
    • LEDs >
      • Adding LEDs
      • LED arc-welder effect
    • Displays >
      • Adding a 7 Segment Display
      • Adding a Touch LCD
      • Touch LCD GUI
      • Game of Pong
    • Adding Extra GPIO
    • Adding a Low Side Switch
    • FizzBuzz
    • Adding MRAM
    • Model Train Control
    • Adding a Real Time Clock
    • Scamp Projects on Youtube
  • Resources
  • Store
  • About
  • Contact