Memory Layout

RetroForth has a pretty simple memory layout. It's divided into five sections:

Kernel (About 2-3 K)
TIB (1 K)
Dictionary (256 K)
Heap (1 M)
Block Buffer (128 K)

The kernel contains the barebones compiler and the initial bootstrap code. The other sections are mentioned in the terminology section. The memory in TIB and beyond is considered ok to mess with. (We recommend not directly modifying the kernel portion unless you're very familiar with RetroForth's internals)

To get at each of these areas we provide a number of words:

tib Returns the address of the tib
last Returns the address of the most recent dictionary entry
h0 Variable pointing to the top of the heap
here Returns the address of top of the heap by fetching from h0
offset Returns the address of the block buffer

Those are the provided words for accessing these areas

To get to a specific section, just add the offsets starting with ‘tib’

: dictionary [ tib 1024 + ] literal ;
: heap [ dictionary $40000 + ] literal ;

There are some dictionary headers outside the dictionary region, but these are defined in the assembly source. It is possible to get access to them by walking through the dictionary.