Main memory resides in RAM 0x88030000..0x8803FFFF (OS
1.02..1.05, OS 1.10..1.11)
or in RAM 0x88030000..0x8803FBFF (OS 2.00).
AlphaMem-variables reside in RAM 0x880020D8..0x880020D8+29*24 (OS 1.02..1.05, OS 1.10..1.11).
The main memory directory resides at offset 0x100..0xA20. It provides for space of 0x93 (147) entries.
62 (63 with OS 2.00) of these entries are occupied by some default-directories.
Every addin needs one directory.
The rest can be used freely (by MCS syscalls).
The default-directories are:
system, library, @REV3, @REV2, @REV1, @LOCAL40..@LOCAL1, @EACT
...offset 0x3E0..0x920 (0x910 with OS 2.00) is the space for 85 (84 with OS 2.00) addin- or any other entries
@E-CON2(OS 2.00 only), @MEMORY, @SYSTEM, @LINK, @TABLE, @SSHEET, @FINANCE, @PROG, @EQUA,
@CONICS, @RECUR, @DYNA, @GRAPH, @STAT, @RUNMAT, main, @APLWORK
The directory number, which is used by some MCS syscalls,
starts at "@APLWORK" with 1 and ends at "system" with 0x93.
A directory entry looks like:
If the member count is above zero, the member addr points to the start of the directory's item-array.
If the member count is zero, the member addr is insignificant.
A directory's item-array consists of a variable count of TItemEntry-instances.
Every item has a name.
The pointer to the data is calculated by adding the pointer to the start of the item-array and offset.
length is the length of the data stored.
Bit 6 of flags is set, the data may not be changed by some syscalls.
The meaning of the other flags-array-bits is not known yet.
"system" is the directory (dirno=0x93) leading to the BASIC programs.
The count-member holds the count of BASIC programs currently stored.
addr points to the start of the BASIC-programs item-array.
The offset-member points to the start of the BASIC-program's data,
calculated from the start of the BASIC-programs item-array.
a BASIC-program's data start with an eight bytes password, which defaults to zeros.
An int-member follows, which defaults to zero and is 0x01000001, if created with the "BASE"-flag.
After those members, the program itself starts. BASIC-programs seem to be stored 4-aligned.
All those RAM-data are flushed to the flash memory, every time the calc is switched off.
RESET does not save these data.
OS versions below 2.00:
The flash sectors 0xA0230000..0xA0250000 are used for this purpose in a rotating scheme.
One sector holds Alpha- and Setup-Backup in 8 kByte blocks.
One sector holds the last saved main memory.
One sector holds the second last saved main memory.
OS version 2.00:
The flash sectors 0xA0250000..0xA0260000 are used for this purpose alternating.
Alpha-data, setup-data and main memory are backuped in one 64k-sector. To achieve this main memory size has been reduced by 1 k with OS 2.00.
Since OS 1.03, the power-off-logo-display procedure contains a function call, which flushes MCS to the flash memory.
It works well, but it is not a syscall, t. i. it depends on the OS version.
To use such a function, you have to read the OS version, set a corresponding function pointer and call the function via this function pointer.
The function saves the complete MCS, even if you changed just a bit! It needs about a second.
Has been tested on OS 1.03 to OS 1.10 and on OS 2.00.