everybody knows the structure of a basic files is:
- size (2 bytes) - 0x01 (control character for basic file) - name + password (8 + 8 bytes) - 2 bytes (base...) - data (size - 24 bytes) - a NULL char - size (2 bytes again)
(the size is at start and at end because the calc cover the memory in two directions).
IMPORTANT NOTE: almost each other type of data has a different control character (0x01 for the basic file, 0x05 for the lists) but it follows a similar structure than the b files. These memory zone are placed in order of control characters (if this order isn't respected the calc just crash).
To create a basic file or another of these memory zone is almost the same...
Well at fisrt I thought that we simply had to add such a structure at the right place to create a new basic file (or new zone) but it's wrong: if I do so, the new b file doesn't appear in the list and its size doesn't appear in basic prog total size in the system menu but it is yet counted as used memory so the calc detect it but "doesn't know that it exists".
After a lot of tests and experiments I was driven to the conclusion that it must be, somewhere, in the memory an area where is stored the current state of the main user memory (memry after 0x1c20:A).
After several hours (I will not decribe the way I found it, unless you ask me ;-) ) I found that this area is placed at 0x1BF2:D till 1BF8:2, I tried to damage it to see its influence: by replacing all the bytes of this zone by a single character for example "F" (not 0xFF) I returned to the system menu and see that there was 0 byte free whereas there was nothing in the memory ! So that's it, we can call it the "MAT" (Memory Allocation Table).
But for now I'm unable to understand its format: As soon as a new zone is created (by using the run mode or creating a list or a b file...) the entire MAT change ! We can see that some offset increase with the total zone number but it is really strange (try yourself using TOUCHE memory viewer and do not forget to use the cursor mode (pressing C viewing the memory) to check a particular offset value).
So I request your help to find out what this MAT format is exactly so we can dynamicaly create basic files and use the memory that appears in the system menu for program who have an Icon in the main menu, I discovered how to do it too, it's the same thing that the b files but the control character is 0x0C, and the "0x03FNAME" zone (right after the basic files) is used to do so: it contains the name of the last program executed from the main menu and enable programs to create a 0x0C zone with the name after the 0x03FNAME (I'm absolutely sure about that, I have done severals experiences that prove that, just ask me if you want details).
Well take a look to the MAT if you have time because I can't figure it out.
PS: During my experiments I found several zones that were not cleared after a whole reset : 1BE2:3 -> 1BE3:F and 1BE8:D -> 1BF1:F.