On 5/29/18 5:13 AM, Jeffrey Birt wrote:

>>> Anytime a new scalar (i.e. non-array) variable is created, the addresses of the array variables must all change to make room for the new scalar variable.

So BASIC copies all the arrays to a new memory address? That does not seem very efficient.


Hey Jeff,

Yeah, the M100 does a lot of stuff that is inefficient like this to maintain it's RAM filesystem. Adding / removing any bytes from a BASIC program will cause the ROM to copy all TEXT and .CO files to a new memory address, plus any BASIC programs that exist past the edit. Likewise, editing any TEXT document will cause the ROM to copy all .CO files to a new memory address, plus any TEXT files past the edit point.

Actually when you enter TEXT, the ROM expands the .DO file being edited such that it occupies the remaining free RAM. It does this by copying all files past the edit point to the highest RAM location possible. That way individual keystroke edits don't have to perform copy, copy, copy operations. Then when you exit, it shrinks the file back to the minimum size and copies .CO and higher RAM TEXT files back down to their new location in RAM.

In general, files / Data in RAM are ALWAYS stored in the order and RAM is copied as needed to ensure this order is maintained:

.BA
Unsaved BASIC program
.DO
.CO
BASIC scalar variables
BASIC string variables
BASIC array variables

The ROM maintains a RAM pointer containing the start address of each of these location, and it has a routine to recalculate each of those pointers that it can call as needed (i.e. when you want to edit a specific TEXT file, etc.).

Ken

Reply via email to