home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / program / k / memutil / !ReadMe next >
Encoding:
Text File  |  1994-08-19  |  4.5 KB  |  114 lines

  1. Memory manager: ‘MemUtil’   By Andrew Bower (Aged 15)        19 August 1994
  2. =========================   =========================        ==============
  3.  
  4. MemUtil provides a method to control the machine's memory allocation out of
  5. the desktop, which is more flexible the *ChangeDynamicArea.
  6.  
  7. To use the utility double-click on ‘CSD_here’ and type *MemUtil.
  8.  
  9. The utility does the following:
  10.  
  11. -help         Displays a help message in the style of *Help.
  12. -display      Displays the current size and free space of the dynamic areas.
  13. -interactive  A means of using the program without learning the syntax.
  14.  
  15. [-system] [+|-|=]<size in kilobytes>
  16. [-RMA]    [+|-|=]<size in kilobytes>
  17. [-screen] [+|-|=]<size in kilobytes>
  18. [-sprite] [+|-|=]<size in kilobytes>
  19. [-font]   [+|-|=]<size in kilobytes>
  20. [-RAMFS]  [+|-|=]<size in kilobytes>
  21.  
  22. These options allow the respective dynamic areas to be altered in one of four
  23. ways:
  24.  
  25.   +n  increases area by nK
  26.   -n  decreases area by nK
  27.   =n  sets area TO nK
  28.   n   ensures nK FREE in area    (perhaps the most useful)
  29.  
  30. e.g.:   -rma +32         increases the RMA size by 32K
  31.         -f "-48"         reduces the font area by 48K
  32.         -screen =320     sets the screen memory to 320K
  33.                             (useful for non-desktop graphics demonstrations)
  34.         -sprite 23       ensures at least 23K FREE in sprite area.
  35.         
  36. If this utility is included within the library of a hard disc, then its use
  37. is more powerful. For example, it could be used within a boot sequence as a
  38. convenient way of setting the size of several dynamic areas. E.g.:
  39.  
  40. *MemUtil 0 32 =160 0 =96 =48
  41.  
  42.     .. will shrink the system area as far as possible,
  43.        ensure 32K free in RMA (useful when programming outside desktop)
  44.        force 160K screen memory (e.g. for screen bank swapping)
  45.        shrink sprite area if possible.
  46.        set the font cache size to 96K
  47.        create a 48K RAM disc.
  48.  
  49. A game or graphical demo like those masterpieces in *Info, may be less
  50. annoying to the user if he does not have to change the memory allocations
  51. manually with the Task Manager on receiving the error ‘Bad mode’. The
  52. following command in an Obey file would do the trick.
  53.        
  54. *MemUtil -screen =160 -sprite 50
  55.  
  56.     .. will set the screen memory to 160K  (2 × MODE 13 banks),
  57.        ensure 50K free in the sprite area (for naughty programs!).
  58.        
  59. In interactive mode, this program will prompt the user for the area to change
  60. and the new size for it.
  61.  
  62. Depending on whether RISC OS 3.50 uses a compatible method for handling
  63. dynamic areas or not, this program may be able to handle them in interactive
  64. mode and may also be able to accept modifications to the program.
  65.  
  66. I think this program is compatible with RISC OS 2, but I cannot test that
  67. point. The only difference would be that the free space in RAMFS would not be
  68. displayed. ****** It must first be reassembled however. ********
  69.  
  70. If *MemUtil is used with no parameters, it will use the default environment
  71. string (‘-d-h-i’) which is null-terminated and can be found at the end of the
  72. object code thus can be altered using any text editor.
  73.  
  74. Technical information
  75. =====================
  76.  
  77. The source code can be found in the BASIC program ‘MemSource’.
  78.  
  79. It should be necessary to convert the utility into a module, as mentioned
  80. within the source code, but certain alterations would be necessary.
  81.  
  82. If you need to reassemble the code, remember to change the path names in
  83. lines 170 and 180.
  84.  
  85. .change is the subroutine used to change the sizes. It parses the string
  86. supplied for each area and takes slightly different actions according to the
  87. preceeding character (-,+ or =).
  88.  
  89. The names of the dynamic areas are held in the form of an ‘OS_PrettyPrint’
  90. dictionary, using ‘FNname’.
  91.  
  92. In order to display the memory sizes intelligently, the program uses
  93. ‘OS_ConvertFixedFileSize’ and doctors the output slightly.
  94.  
  95. To display the free space in a particular area it is necessary to use calls
  96. indepent to each area, thus the table at .table contains the offsets of
  97. routines to call which return the free space in R0 and preserve all other
  98. registers. If the offset is zero, no free space is displayed.
  99.  
  100. RMA free space:     ‘OS_Module’, describe RMA
  101. screen free space:  ‘OS_ClaimScreenMemory’.
  102. sprite area space:  ‘OS_SpriteOp’, read control area
  103. font cache space:   ‘Font_CacheAddr’
  104. RAMFS free space:   ‘OS_FSControl’ 49
  105.  
  106. The free application memory is read with ‘OS_GetEnv’ but does not include the
  107. Wimp free pool.
  108.  
  109. The total memory is found by multiplying the page size with the number of
  110. pages (‘OS_ReadMemMapInfo’)
  111.  
  112.  
  113.          Andrew Bower      19 August 1994
  114.          ================================