xcall MIAMEX, MX_USRMAP, idx, name, size {,flags, ver}
MX_USRMAP (MIAMEX 107) is analogous to the AMOS SRCH monitor call, allowing you to locate modules in user memory. The maximum number of modules which can be loaded into user memory per job is 96.
This function is used by the MAP.LIT utility, which would be the normal way to see what modules you have loaded.
Background
Although an attempt has been made to provide some of the same user memory functionality as AMOS, the design here is considerably different. The most notable difference is that under AMOS, user memory is one contiguous chunk of physical memory, and the modules are stacked end to end, starting from the lowest available address. The BASIC runtime system then typically takes over the space from the top of the last loaded module to the top of the partition. Deleting a module under AMOS causes all subsequent modules to be shifted down, which might be disastrous to a program that was currently running (and counting on the prior physical location of some memory structures).
Under A-Shell, the user memory partition (defined by the MEMORY statement in miame.ini, or by the use of MEMORY.LIT or the MX_MEMORY) is mainly used just for the BASIC runtime system’s work area. Any modules, including the RUN program itself, are loaded into dynamically allocated, non-contiguous, memory chunks. Thus the nominal partition size has no real effect on the number or size of the modules which can be loaded, and loading and deleting of individual modules has no effect on any other modules or currently running programs. A-Shell keeps track of the modules which are loaded via an index table, which is analogous to a disk directory, containing the module name, size, location, and other flags.
Parameters
idx (Num) [in/out]
indicates the starting position in the memory index table to search forward from (0 to start at the beginning). It will be returned with the position of the located module, (0=not found), allowing it to be used in a subsequent call to scan forward from there.
name (String) [in/out]
should be set to the name and extension of the module to locate (e.g. "EMAILX.SBX"), or blank to locate the first module after the position specified by idx. It will be returned with the name of the located module.
size (Num) [out]
will return the size of the located module, in bytes.
flags (Num) [in] optional
will return flags relating to the module status, from the following table:
Symbol |
Value |
Description |
---|---|---|
USRMEM_INUSE |
&h0001 |
Module currently running. Cannot be deleted under any circumstances. |
USRMEM_LOCKED |
&h0002 |
Module is locked in memory. This prevents it from being deleted (with a special switch) and can be set by specifying this flag on the load operation. |
USRMEM_PERM |
&h0004 |
Module was manually loaded and will be left in memory until manually deleted. |
USRMEM_CACHE |
&h0008 |
Module was auto-loaded and will be cached in memory for a "reasonable" amount of time. |
USRMEM_UNLOCK |
&h0010 |
This is a command flag, not a module flag, but is listed here because it is needed with the delete function to delete a module that has the USRMEM_LOCKED flag. |
USRMEM_NOFILE |
&h0020 |
Needed in order to load a memory module directly from a variable. |
Definition file: ashell.def |
ver (String, 13+) [out] optional
will return the version of the module if it is a LIT, SBX, or RUN.
See Also