The SDK-MainMemory-functions operate on the private
Add-In-directory, which is based on the application's name.
The name is fetched by syscall 0x0462 (GetAppName).
If the following syscalls are used with a directory, which name differs from the default (AppName), the directory has to be created beforehand (syscall 0x0829).
The system maintains one global MCS-handle.
Every Add-In maintains a private MainMemoryHandle-table. This table is of no importance, if the syscalls are used directly.
syscall 0x0840 (MCSGetDlen2); detects, if the object to create already exists
syscall 0x082B (MCSPutVar2); creates the object. Sets the global MCS-handle.
syscall 0x0840 (MCSGetDlen2); sets the global MCS-handle.
syscall 0x0836 (MCSDelVar2); deletes the MCS-item and clears the global MCS-handle.
Bfile_ReadFile( MainMemoryHandle, ... )
syscall 0x0840 (MCSGetDlen2); checks, if the object exists and sets the global MCS-handle.
Under normal circumstances, this already has been done by Bfile_OpenMainMemory.
syscall 0x0841 (MCSGetData1); fetches the data.
Bfile_WriteFile( MainMemoryHandle, ... )
syscall 0x082B (MCSPutVar2); fails, if the object already exists, which is the case under normal circumstances.
syscall 0x0830 (MCSOvwDat2); if MCSPutVar2 has failed.
Bfile_CloseFile( MainMemoryHandle, ... )
Does not use any syscall. It clears the corresponding entry of the Add-In's private MainMemoryHandle-table.