Christopher,
The allot mechanism is intended for static memory allocation.
You would need to implement allocate and free yourself in some static
area reserved by allot
There is a system variable called CSE that tells which is the current
data section. But there is no word to read it.
It is really not needed. The intended use is to always return to ram
after eeprom or flash has been used.
i, is used for creating new compiler words, but it is just a short cut
for 'flash , ram'
Actually ',' could always use the flash context, there is not much use
for creating constant data in ram or eeprom.
But to keep the symmetry of the memory management words, ',' can be used
for ram and eeprom also.
Mikael
On 2021-04-13 01:44, Christopher Howard wrote:
> Hi, I'm kind of new to forth in general, so bear with me: but I see in FF the effect of `,' and `c,' and `allot' are affected by which data section is set. I was wondering if there was a way in FF to determine what data section is currently set, so you could restore that setting after changing it. The use case I was thinking of would be if I had a word which temporarily allots some array space in ram to perform some matrix calculations or whatever. My word can't really assume that data section is already pointing to ram. But if I set it to point to ram, I might be destroying the previous state.
>
> I see in the reference that there is a special word 'i,' for allot'ing just to flash data section, but I also see there aren't words like 'r,' or 'rallot'.
> _______________________________________________
> Flashforth-devel mailing list
> Fla...@li...
> https://lists.sourceforge.net/lists/listinfo/flashforth-devel
--
--
Mikael |