home *** CD-ROM | disk | FTP | other *** search
- Memory manager: ‘MemUtil’ By Andrew Bower (Aged 15) 19 August 1994
- ========================= ========================= ==============
-
- MemUtil provides a method to control the machine's memory allocation out of
- the desktop, which is more flexible the *ChangeDynamicArea.
-
- To use the utility double-click on ‘CSD_here’ and type *MemUtil.
-
- The utility does the following:
-
- -help Displays a help message in the style of *Help.
- -display Displays the current size and free space of the dynamic areas.
- -interactive A means of using the program without learning the syntax.
-
- [-system] [+|-|=]<size in kilobytes>
- [-RMA] [+|-|=]<size in kilobytes>
- [-screen] [+|-|=]<size in kilobytes>
- [-sprite] [+|-|=]<size in kilobytes>
- [-font] [+|-|=]<size in kilobytes>
- [-RAMFS] [+|-|=]<size in kilobytes>
-
- These options allow the respective dynamic areas to be altered in one of four
- ways:
-
- +n increases area by nK
- -n decreases area by nK
- =n sets area TO nK
- n ensures nK FREE in area (perhaps the most useful)
-
- e.g.: -rma +32 increases the RMA size by 32K
- -f "-48" reduces the font area by 48K
- -screen =320 sets the screen memory to 320K
- (useful for non-desktop graphics demonstrations)
- -sprite 23 ensures at least 23K FREE in sprite area.
-
- If this utility is included within the library of a hard disc, then its use
- is more powerful. For example, it could be used within a boot sequence as a
- convenient way of setting the size of several dynamic areas. E.g.:
-
- *MemUtil 0 32 =160 0 =96 =48
-
- .. will shrink the system area as far as possible,
- ensure 32K free in RMA (useful when programming outside desktop)
- force 160K screen memory (e.g. for screen bank swapping)
- shrink sprite area if possible.
- set the font cache size to 96K
- create a 48K RAM disc.
-
- A game or graphical demo like those masterpieces in *Info, may be less
- annoying to the user if he does not have to change the memory allocations
- manually with the Task Manager on receiving the error ‘Bad mode’. The
- following command in an Obey file would do the trick.
-
- *MemUtil -screen =160 -sprite 50
-
- .. will set the screen memory to 160K (2 × MODE 13 banks),
- ensure 50K free in the sprite area (for naughty programs!).
-
- In interactive mode, this program will prompt the user for the area to change
- and the new size for it.
-
- Depending on whether RISC OS 3.50 uses a compatible method for handling
- dynamic areas or not, this program may be able to handle them in interactive
- mode and may also be able to accept modifications to the program.
-
- I think this program is compatible with RISC OS 2, but I cannot test that
- point. The only difference would be that the free space in RAMFS would not be
- displayed. ****** It must first be reassembled however. ********
-
- If *MemUtil is used with no parameters, it will use the default environment
- string (‘-d-h-i’) which is null-terminated and can be found at the end of the
- object code thus can be altered using any text editor.
-
- Technical information
- =====================
-
- The source code can be found in the BASIC program ‘MemSource’.
-
- It should be necessary to convert the utility into a module, as mentioned
- within the source code, but certain alterations would be necessary.
-
- If you need to reassemble the code, remember to change the path names in
- lines 170 and 180.
-
- .change is the subroutine used to change the sizes. It parses the string
- supplied for each area and takes slightly different actions according to the
- preceeding character (-,+ or =).
-
- The names of the dynamic areas are held in the form of an ‘OS_PrettyPrint’
- dictionary, using ‘FNname’.
-
- In order to display the memory sizes intelligently, the program uses
- ‘OS_ConvertFixedFileSize’ and doctors the output slightly.
-
- To display the free space in a particular area it is necessary to use calls
- indepent to each area, thus the table at .table contains the offsets of
- routines to call which return the free space in R0 and preserve all other
- registers. If the offset is zero, no free space is displayed.
-
- RMA free space: ‘OS_Module’, describe RMA
- screen free space: ‘OS_ClaimScreenMemory’.
- sprite area space: ‘OS_SpriteOp’, read control area
- font cache space: ‘Font_CacheAddr’
- RAMFS free space: ‘OS_FSControl’ 49
-
- The free application memory is read with ‘OS_GetEnv’ but does not include the
- Wimp free pool.
-
- The total memory is found by multiplying the page size with the number of
- pages (‘OS_ReadMemMapInfo’)
-
-
- Andrew Bower 19 August 1994
- ================================