The 32-bit word header layout is somewhat different from the 8-bit word layout of the original Amforth. The header field order is different and the header and all its fields are always cellsize aligned.

In AmForth the execution token (XT) is the CFA.

Field Size Description
LFA .word link field: points to FFA of prior word
FFA .word flag field: word flags
NFA .bytes name field: length prefixed string containing the name of the word padded to cell alignment
CFA .word code field: points to executable code implementing the word
    for code-words (CFA) = PFA
PFA .bytes parameter field: word parameters compiled into the word definition
    for colon-words PFA is a sequence of .words interpreted by the inner interpreter ending with XT_EXIT
    for code-words PFA is machine code implementing the word ending with NEXT macro expansion
    for other word types the contents of PFA can be interpreted in completely arbitrary way

Words that are pre-compiled into the AmForth binary have corresponding address symbols defined that map to:

  • LFA - VE_ symbol
  • CFA - XT_ symbol
  • PFA - PFA_ symbol

Wordlists and search order

A wordlist maintains a pointer to the latest word added to it, specifically it points to the last word’s FFA. The full list of the words can be traversed by following the chain of LFA pointers in the words. The predefined wordlists are

  • environment - a predefined wordlist containing words describing the AmForth system itself (a standard Forth wordlist)
  • core-wordlist - contains the pre-compiled core words
  • forth-wordlist - contains words compiled to FLASH at runtime, it also includes the core-wordlist
  • ram-wordlist - contains words compiled to RAM at runtime, this wordlist is always empty when the system starts up

A wid, referenced by stack signatures of some words, is the XT of a wordlist word, e.g. forth-wordlist. The current value contains the wid of the wordlist that new words are compiled into. When switching between FLASH and RAM mode current will be set to the corresponding wordlist.

A search order is a list of wordlists to be searched for an existing word. Search order is primarily used to look for known words when new word definitions are compiled. Current search order that is used for these lookups is dictated by cfg-order. There are several pre-defined search orders

  • order.core - core-wordlist, environment
  • order.forth - forth-wordlist, environment
  • order.only - ram-wordlist, forth-wordlist, environment

These orders can be assigned to cfg-order with words core, forth and only. order.forth is used when in FLASH mode, and order.only is used when in RAM mode. Changing the order is important to avoid compiling FLASH words with references to RAM words, which would yield corrupted FLASH words after restart.


This site uses Just the Docs, a documentation theme for Jekyll.