Moves HIMEM safely and allocates or frees memory as appropriate from the TI-OS.
BBC BASIC allocates as much memory as it can from the TI-OS when it first loads, restricting HIMEM to a maximum value of &C000. You may wish to increase HIMEM to give BBC BASIC more memory for a large program, or you may wish to decrease HIMEM to give the TI-OS more memory to create new files in.
Assuming that HIMEM was at &C000,
would raise HIMEM to &D000, supplying BBC BASIC with 4KB more memory than it would usually have. If there was insufficient RAM available, a No room error is triggered and HIMEM is not moved.
would drop HIMEM back down to &C000. Unlike the HIMEM statement, the memory between the old value and new value is freed back to the TI-OS, so do not use *HIMEM to allocate memory for persistent assembly routines.
If you do not pass a value to *HIMEM then HIMEM is restored to its upper bound. This is useful if you have previously moved HIMEM yourself, for example:
REM Reserve 100 bytes at the top of memory. HIMEM=HIMEM-100 ... REM Move HIMEM back up to let BBC BASIC reclaim that memory. *HIMEM
You can use *HIMEM and EXT#-1 together to allocate all free memory to BBC BASIC.
OSCLI "HIMEM "+STR$~(HIMEM+EXT#-1)