Memory Management

CamelForth is of necessity a bad application, and uses the default bad application size (this is 8K for unexpanded Z88s and 40K for expanded Z88s) just like BBC BASIC.

Unlike BBC BASIC, however, CamelForth does not by default give any memory back to the system when pre-empted, since it's not necessarily obvious what memory regions are in use. Generally though, space from HERE to the end of RAM (4000h on unexpanded machines; C000h on expanded machines) could be given back without problems.

To do this, and make your application a bit friendlier to the system, you should set the double variable HOLE. If both cells of this variable are the same, CamelForth gives no memory back to OZ (this is the default). If they are different, CamelForth gives back memory starting at the value in the low cell and ending at the value in the high cell (excluding the final address).

So, on an expanded machine, if you were prepared to give back memory from HERE+100h onwards, you should do:

    HEX HERE 100 + C000 HOLE 2!

You should be careful with this if you're going to be alloting any further memory (by adding more definitions, for example), and change HOLE as appropriate.

More about CamelForth

Back to the Z88 home page