variable x
ok<$,ram>
x
, which executes by leaving the address
of its storage location as TOS: x
ok<$,ram>f170
FlashForth V3.8 marker -play ok<$,ram> variable x ok<$,ram> 3 x ! ok<$,ram> x @ . 3 ok<$,ram>For FlashForth, the dictionary entry,
x
,
is in the Flash memory of the microcontroller but the
storage location for the number is in static RAM (in this instance).
FlashForth provides the words ram
, flash
and eeprom
to change the memory context of the storage location.
Being able to conveniently handle data spaces in different
memory types is a major feature of FlashForth.
To make another variable in EEPROM, try
eeprom variable y
ok<$,eeprom>
We can access this new (nonvolatile) variable as we did for the RAM variable x
,
but y
retains its value, even when we turn off and on the power to the microcontroller.
4 y ! ok<$,eeprom> y @ . 4 ok<$,eeprom> x @ . 3 ok<$,eeprom> FlashForth V3.8 y @ ok<$,ram>4 x @ ok<$,ram>4 0