The PowerDOS Memory Status Program

This program is used to show the memory allocation table of PowerDOS.
It runs as a background task, and can be called into service by
holding down both shift keys and the control key. Every second, the
program checks these keys, and if they are all down, the current
memory configuration is written to disk. The pathname for this file
is given as a command line parameter when the program is run. This
file is written in append mode, so multiple runs will result in the
file becoming larger and larger. Also note that if you want the
information written to the screen or printer, just give it a pathname
of con: or prn:. If the output is sent to the screen, the display
will just scroll by unless you halt it with a control-s; control-q
will resume.

Below is a sample output of the program taken while this document was
being prepared:

PowerDOS Memory Status version 1.0

 MDB     Start      Block     Owner       Owner        Owner
Index   Address     Length     PID        Name         Link
-----   --------   --------   -----   --------------   -----
 001      174474     105986    --     System            000
 002      280460       3908    --     System            001
 003      284368        338    --     System            002
 004      284706          4    --     System            003
 005      284710       2988    --     TSR               004
 007      287698      15750    02     Nmon_0            000
 008      303448       1022    02     Nmon_0            007
 006      304470       2172    02     Nmon_0            008
 009      306642         12    02     Nmon_0            006
 010      306654         84    --     TSR               005
 011      306738       1336    --     TSR               010
 012      308074       4550    --     TSR               011
 014      312624       8534    --     TSR               012
 015      321158       8360    --     TSR               014
 016      329518      43286    --     TSR               015
 017      372804       6282    --     TSR               016
 018      379086      69504    --     TSR               017
 019      448590         14    01     GEM_Desktop       000
 013      448604        256    01     GEM_Desktop       019
 021      448860         14    03     GEM_Desktop       020
 020      448874        384    03     GEM_Desktop       000
 023      449258       1024    03     GEM_Desktop       021
 022      450282      29826    03     GEM_Desktop       023
 024      480108         14    03     GEM_Desktop       022
 025      480122       2064    03     GEM_Desktop       024
 027      482186       2226    03     GEM_Desktop       025
 026      484412         14    03     GEM_Desktop       027
 028      484426      50992    03     GEM_Desktop       026
 030      535418       2226    03     GEM_Desktop       028
 029      537644         14    03     GEM_Desktop       030
 031      537658      66140    03     GEM_Desktop       029
 033      603798       2226    03     GEM_Desktop       031
 032      606024         14    03     GEM_Desktop       033
 034      606038      49818    03     GEM_Desktop       032
 036      655856       2226    03     GEM_Desktop       034
 035      658082         14    03     GEM_Desktop       036
 037      658096       7984    03     GEM_Desktop       035
 039      666080         14    04     MEM_STAT.TTP      074
 054      666094      15986    --     Free              000
 038      682080      51208    03     GEM_Desktop       037
 040      733288       9106    03     GEM_Desktop       038
 041      742394        566    03     GEM_Desktop       040
 042      742960        566    03     GEM_Desktop       041
 043      743526        566    03     GEM_Desktop       042
 044      744092        566    03     GEM_Desktop       043
 045      744658        566    03     GEM_Desktop       044
 046      745224        566    03     GEM_Desktop       045
 047      745790        566    03     GEM_Desktop       046
 048      746356        566    03     GEM_Desktop       047
 049      746922        566    03     GEM_Desktop       048
 050      747488        566    03     GEM_Desktop       049
 051      748054        566    03     GEM_Desktop       067
 069      748620        566    03     GEM_Desktop       051
 070      749186        566    03     GEM_Desktop       069
 071      749752        566    03     GEM_Desktop       070
 072      750318        566    03     GEM_Desktop       071
 073      750884      16000    03     GEM_Desktop       068
 055      766884         14    05     GENST2.PRG        056
 057      766898        308    05     GENST2.PRG        055
 058      767206        678    --     Free              000
 052      767884      12490    03     GEM_Desktop       050
 053      780374      23514    05     GENST2.PRG        057
 060      803888      88224    --     Free              000
 066      892112        308    03     GEM_Desktop       052
 067      892420      89114    03     GEM_Desktop       066
 068      981534     195584    03     GEM_Desktop       072
 074     1177118      13530    04     MEM_STAT.TTP      000
 056     1190648      59560    05     GENST2.PRG        000
 059     1250208     500000    05     GENST2.PRG        053
 061     1750208    2411328    --     Free              000

Free memory: 2516216
Largest block of free memory: 2411328
Memory used for system resources: 110236
Memory used by TSR programs: 144924

Memory used by programs:

01 GEM_Desktop: 270
02 Nmon_0: 18956
03 GEM_Desktop: 599520
04 MEM_STAT.TTP: 13544
05 GENST2.PRG: 583396


The blocks whose owner is System are memory areas used by PowerDOS
itself. Blocks marked TSR are owned by the system, but came from
programs that used the Terminate-Stay-Resident function call. All
other blocks belong to active processes and are labeled with their
names. (Note that the name is usually the disk file name, but not
always). Also, if you use this program on a TT with alternative ram,
two separate areas will be listed, the one for ST ram, as above, and
one for TT ram. The totals will also reflect the two different kinds
of ram.

The first column heading, MDB, stands for Memory Descriptor Block.
The last column heading contains an owner link (free blocks have no
link). For instance, in the above listing, MEM_STAT.TTP has two
blocks. The first is MDB number 39, and its link is 74. MDB 74 has no
link and so only those two blocks are owned by MEM_STAT.TTP.

The Owner PID column tells you the process ID of the process that
owns the block, if the block is owned by an active process. Note that
in the above examples there are two GEM_Desktop processes. You can't
tell the difference by the name, but the process ID is different (one
and three). (BTW, the reason that there are two desktop processes is
that in recent versions of the TOS roms, the first desktop started by
the system actually launches a second desktop, then waits around for
the second to terminate, which it does when you change resolutions.)
