Freeing up RAM without burning new ROM

Hello –

I’m new to just about every aspect of this area of computing: assembly, Forth, 65c02, etc. :slight_smile: I’m trying to learn more about the Planck environment and how to customize it. Please advise if this is too basic or if it’s wrong or just not interesting to the group!

The command unused . shows 2177 bytes free just after boot. The unused word + the value of here should equal the total amount of RAM in the system (32K).

hex unused here  + . 

which returns $7fff or 32767. (This result actually surprised me as I thought that some memory was also reserved for the history buffer.)

In any case we only have about 2K free for user words and data. This is probably plenty for a newbie like me, but how can you create more space?

Here’s one way to create more space. You can edit the user_words.fs. This is the file that holds user-defined words for the system. It includes a set of mandelbrot programs that can be removed to free up more working RAM. One way to do this would be to comment out the beginning of each unwanted line, by adding \ at the beginning of each line. Note the required space after the backslash comment character. Once you do that, you need to save your changes and then rebuild the ROM. For example,

cd Software/fos/forth_code
vim user_words.fs
cd ..
Make fos-planck.bin

Burn the new fos-planck.bin to the ROM for the system and go from there.

Here is a better alternative, however. This way you will have access to the Mandelbrot words until you need the space for your own experiments. It works like this. Reorganize the code in user_words.fs so that all of the mandelbrot-related words are at the end of the file. Before the start of the mandbrot-related words, insert the following line:

marker dump-mandel

Save the changes, compile, and burn a new ROM as above.

This will create a marker that allows you to forget all of the words defined after the marker. Once you’ve experimented with the Mandelbrot words, you can then issue dump-mandel at the forth prompt to regain the space for your own words. After executing dump-mandel, unused showed 4098 bytes free for use.

Be sure to issue dump-mandel before you’ve defined any new words yourself, as they will also be erased by dump-mandel.

That is a very good idea @benchapman! You claim to be a beginner but you already understand forth better than me :smile:
Anyway, that’s a nice trick! If you feel like it do not hesitate to send me a merge request on Gitlab.

Could you create another marker after the mandelbrot stuff to be able to recover your words if your forgot to call dump-mandel?

Hi, Jonathan,

Thanks for the kind words. I renamed “dump-mandel” to “drop-mandel” and submitted (I think!) a merge request.

As for your other question, I don’t think there’s a way to use marker like that. It seems to drop everything after the spot in the code where it is placed. Pretty drastic. :slight_smile:

Everything looked good, so I merged it straight away. I’ll give it a try later today. Thanks a lot for this!

1 Like