home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / seemem25.zip / SEEMEM.DOC < prev    next >
Text File  |  1992-08-16  |  15KB  |  331 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                      SEEMEM.EXE 
  10.                                      Version 2.5
  11.                                      August, 1992
  12.  
  13.  
  14.  
  15.           Author:   Tedrick A. Housh, Jr.
  16.                     5811 West 85th Terrace
  17.                     Overland Park, KS 66207 
  18.  
  19.  
  20.  
  21.           Electronic Mail: CompuServe 72466,212
  22.                            GEnie      R.HOUSH 
  23.  
  24.  
  25.  
  26.           The objective of SEEMEM is to display information about the
  27.           current use of MS-DOS memory by the operating system, and
  28.           resident processes and data.
  29.  
  30.           It is designed to make full use of the new memory facilities
  31.           provided by DOS version 5.0, and to provide information similar
  32.           to that provided by the DOS utility MEM.  However, it provides
  33.           this information even when DOS does not control Upper or Extended
  34.           memory, and even when HIMEM.SYS and EMM386.EXE are not loaded,
  35.           and recognizes UMB's created by other programs, such as
  36.           Quarterdeck Software's QEMM386 (for 386 and higher) and QRAM (for
  37.           286 cpu's with EMS version 4.00 hardware or Chips and
  38.           Technologies Shadow Ram).  It works with these programs on all
  39.           versions of DOS greater than 1, and on all CPU chips, 8088 and
  40.           higher, although the memory detail displayed increases with
  41.           increase in CPU version.  As of SeeMem version 2.00, it provides
  42.           full support for DR-DOS 6.00 also. 
  43.  
  44.           SEEMEM was written in Turbo Pascal 6.00, as an exercise in the
  45.           use of the Built-In Assembler (BASM).  In that connection, all
  46.           necessary DOS functions were specifically coded in BASM, as were
  47.           all functions which necessarily interface with the extended
  48.           memory (XMS) driver provided by HIMEM.SYS, or its counterparts
  49.           such as QEMM386.SYS, or QEXT.SYS, or EMM386.SYS. This completely
  50.           eliminates the need for the Turbo Pascal DOS unit, or a unit to
  51.           interface with the XMS and UMB device drivers. All the low level
  52.           functions necessary for this purpose are included directly in the
  53.           SEEMEM.PAS file as BASM code, and the .PAS file is independent
  54.           and completely self-supporting. 
  55.  
  56.           The display output for SEEMEM is in three parts.  The first part,
  57.           which may include several screen pages, displays every memory
  58.           control block (MCB) between Segment 0 and the top of conventional
  59.  
  60.                                           1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           memory (Segment 9FFFh on a 640k machine), and also between the
  74.           top of conventional memory and the start of the High Memory Area
  75.           (HMA) if any, or the top of Upper Memory (Segment 0FFFFh).  For
  76.           each MCB SEEMEM displays its segment address (in hex), its size
  77.           (in both Kilobytes and bytes), the segment of its "owner," its
  78.           type (e.g. TSR or Environment), and its name (if determinable). 
  79.  
  80.           The second part is a display of EMS (Expanded Memory) if
  81.           applicable.  This displays the version number of the EMS device
  82.           driver, the page frame segment, the total size of the installed
  83.           EMS memory, the number of mapping register sets available,
  84.           whether or not nonvolatile handles (will survive warm boot) are
  85.           available, the number of DMA channels , the maximum number of EMS
  86.           handles supported, the number of free handles, free pages, page
  87.           size, and free memory, and for each handle in use, the handle
  88.           number, the number of EMS pages, the page size, the memory used,
  89.           and if available, the handle name.  This second part may occupy
  90.           more than one screen page. 
  91.  
  92.           The third part displays XMS information (if a driver is
  93.           installed), including XMS version number, revision number, the
  94.           XMM Control Vector in segment:offset form, total XMS free memory,
  95.           and largest free XMS block.  With respect to the High Memory Area
  96.           (HMA) SEEMEM shows whether the A20 line is currently enabled,
  97.           whether HMA is implemented, whether the HMA is available for use.
  98.           If the DOS version is 5.00 or greater SEEMEM also will say
  99.           whether DOS is resident in the HMA (DOS=HIGH in config.sys), and,
  100.           if so, how much of the HMA DOS has left available for additional
  101.           buffers, etc.  SEEMEM also displays the location of DOS when it
  102.           is located elsewhere (i.e. ROM or Conventional memory). 
  103.  
  104.           The third part also displays information about Upper Memory
  105.           Blocks (UMB's) if available:  whether UMB's are implemented,
  106.           whether they are controlled by device driver or by DOS itself
  107.           (with DOS 5.00 and higher), whether UMB's are linked to
  108.           conventional memory (DOS 5.00) or are independent, and whether
  109.           UMB's are implemented by DOS=UMB in CONFIG.SYS (DOS 5.00). 
  110.  
  111.           Seemem does NOT display device driver information loaded under
  112.           DOS version 4.xx or higher's "secondary" MCB's, although it will
  113.           display such primary MCB's other software may use to load such
  114.           device driver's "high" in UMB's if each is given its own MCB.
  115.           This was a design decision to avoid "clutter."  Plenty of
  116.           programs are available to "walk" the device chain and display
  117.           this information. 
  118.  
  119.           A word about resident code names is in order. Under DOS 2.xx the
  120.           name of resident loading programs is not determinable.  With DOS
  121.           3.xx the name may be determined from the environment, unless that
  122.           was released back to DOS's pool on installation.  With DOS 4.xx
  123.           and higher an eight character name is inserted in the last eight
  124.           bytes of the 16 byte MCB, and therefore is always available. Some
  125.  
  126.                                           2
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.           other programs which control UMB's insert the eight character
  140.           name in the MCB under any DOS version, but this is not used by
  141.           SEEMEM.  SEEMEM uses the most detailed information available
  142.           through DOS.  Therefore, if the DOS version is 4 or higher, and
  143.           the environment pertaining to the process is still resident, the
  144.           program name and extension is taken from the environment
  145.           (although the drive and directory information is stripped from
  146.           the filename before display). 
  147.  
  148.           A full explanation of the XMS, UMB, and HMA standards is not
  149.           within the scope of this documentation, however an understanding
  150.           of a few of the more obscure facts will help understand SEEMEM's
  151.           operation.   The "XMS Specification" for extended memory is
  152.           similar to the EMS spec for expanded memory.  It provides
  153.           functions for implementing use of extended memory with handles in
  154.           a manner very much the same as EMS does for expanded memory.  The
  155.           High Memory Area (HMA) is the 64 kilobyte (less 16 bytes) just
  156.           above the 1 megabyte limit of the 8086 and 8088 chips. Obviously,
  157.           then XMS extended memory and the HMA require a 80286 chip or
  158.           higher.  However, through a clever addressing scheme, and an
  159.           additional hardware address line, an 80286 or higher can address
  160.           the HMA in "real" mode, i.e. as "non-extended" memory. Although
  161.           XMS drivers existed before DOS 5.00, and some alternative
  162.           DOS-like operating systems allowed the use of this space for some
  163.           things, DOS 5.00 now allows DOS itself to be loaded there,
  164.           substantially increasing the possible useable memory space in
  165.           lower memory previously used by DOS. 
  166.  
  167.           Although the protocols and specifications for Upper Memory Blocks
  168.           (UMB's) are contained in the original XMS specifications, they
  169.           are NOT necessarily part of the XMS driver itself, and in fact
  170.           were not implemented by the first MicroSoft driver, HIMEM.SYS.
  171.           The XMS specification only provides one control vector however,
  172.           so if all UMB calls need be implemented through that vector, a
  173.           UMB driver must be integrated with the XMS driver, or must hook
  174.           that vector (necessarily implying that it must be loaded after
  175.           the XMS driver has installed the vector) unless it is completely
  176.           integrated.  However DOS 5.00 has supplied interrupt 21h function
  177.           calls to manipulate the use of existing UMB's for detecting the
  178.           existence, state and governing the rules of use of UMB's, and
  179.           these function calls are not dependent on the existence of any
  180.           device driver, nor for that matter, the existence of any extended
  181.           memory, or a chip higher than that 8088-8086.  The thought may
  182.           take some getting used to, but this means that UMB's can exist
  183.           without any driver or control vector at all.  In fact there is at
  184.           least one program available which acts as though it were a device
  185.           driver, creates UMB's from the shadow ram available through some
  186.           motherboard chipset implementations, hands it over to DOS, and
  187.           then just aborts, itself disappearing from memory.  DOS then
  188.           owns, and makes available some UMB's with no device driver to
  189.           control them.  SEEMEM can also detect this type of UMB and
  190.           display its state. 
  191.  
  192.                                           3
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.           DOS 5.00 provides greatly increased support for XMS, HMA, and
  206.           UMB's, and SEEMEM uses all of it, where it is possible to do so.
  207.  
  208.           In order that it may support full display redirection SEEMEM does
  209.           not do any direct video memory-mapped display.  All display is
  210.           through DOS or BIOS.  Each screen is paged with a "MORE" line at
  211.           the bottom UNLESS the /N ("NO PAUSE") switch is used.  The only
  212.           other switch available is the help /H or /? switch, which
  213.           displays a simple help message.  The output may be directed to a
  214.           file or a device such as a printer, in which case you will
  215.           probably wish to bypass paging also, with the /n switch.  As of
  216.           SeeMem version 2.00 SeeMem detects this redirection and turns
  217.           paging off by itself.
  218.  
  219.           For example SEEMEM /N > PRN  would send the output of the program
  220.           to the printer for a permanent record.  In order to speed the
  221.           output slightly the DOS IOCTL function is used to switch to "raw"
  222.           output mode, and is returned to its prior state, probably
  223.           "cooked," upon program termination.  This speeds up output by
  224.           eliminating checks for ^S, ^Q, ^C and expansion of tabs, etc., so
  225.           you cannot manually pause the program or "break" it.  No tabs or
  226.           other characters requiring interpretation are used however, so
  227.           you should see no difference due to disallowance of "cooked"
  228.           mode. 
  229.  
  230.           If you insist on a "scrollable" output I have successfully used
  231.           the J.P. Software's 4DOS command shell internal LIST command with
  232.           SEEMEM to provide this with the following command line: 
  233.  
  234.           SEEMEM /N | LIST /S 
  235.  
  236.           This provides an output which uses LIST to scroll from top to
  237.           bottom. 
  238.  
  239.           I have made the source code available in Turbo Pascal 6.0 on the
  240.           Borland Support area on GEnie and in the Borland Programming Area
  241.           on CompuServe.  The program is copyright but donated to the
  242.           public domain without any restriction, except that it be
  243.           distributed in its original form with appropriate authorship
  244.           credit, with no charge other than reasonable fees for duplication
  245.           and distribution, including by electronic means.  It is
  246.           specifically intended and permission is granted for distribution
  247.           by commercial electronic sources for their regular and customary
  248.           access and membership fees even though they may be operated for
  249.           profit.  No warranties of any kind accompany SEEMEM, and the
  250.           author assumes no responsibility for any consequences of its use,
  251.           either direct or consequential.
  252.  
  253.           The basic idea for SEEMEM is not new, of course and all parts of
  254.           it borrow heavily upon prior, similar programs.  Perhaps it
  255.           should be named YAMEM (Yet Another MEMory display program).
  256.           Nevertheless it does do some things no other does (that I know
  257.  
  258.                                           4
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.           of) and it is a demonstration of Turbo Pascal 6's BASM facility
  272.           which clearly shows the practicality of the TP environment for
  273.           low level system programming.  In fact, I don't think the same
  274.           thing could be done in C with faster or smaller code resulting.
  275.           Yeah, I know, TP is primarily a shell for the assembly stuff, but
  276.           at least it can do that now, and very adroitly, too.
  277.  
  278.                                   New in Version 2.5
  279.  
  280.           Since version 2.0, a number of fixes have been made, support for
  281.           MS-DOS 5.00, DR-DOS 6.00, and 4DOS 4.00 has been expanded
  282.           considerably.  In addition adjustments have been made for Windows
  283.           3.10 enhanced mode.
  284.  
  285.           Most of the fixes were necessary because arithmetic has never
  286.           been my forte' and calculations of block sizes, etc. were not
  287.           quite accurate enough.  Most user's apparently didn't notice but
  288.           a few did call my attention to this, for which I thank them.
  289.  
  290.           A switch was added, /L for "Long" which sets the page length in
  291.           each section of the report to 55 lines so that redirection to the
  292.           printer will look better.  SEEMEM now automatically detects
  293.           redirection and turns off pausing when the output is redirected
  294.           to anything but the standard output (normally the screen). 
  295.           Nevertheless, the /P switch remains just in case you want it.
  296.  
  297.           The owner names were changed somewhat.  Most are self explanatory
  298.           to those who need the information.  "TSR" represents a resident
  299.           program (if it's resident it's really a "process"), and if in
  300.           upper memory says "LoadHi" also.  In addition DR-DOS 6.00
  301.           provides more detail of the loader of TSR's so, in addition,
  302.           under DR-DOS version 6.00 a UMB TSR may say either "LoadHi" if
  303.           the LoadHigh or DeviceHigh or HighInstall loaded it, or "AutoHi"
  304.           if it loaded itself in an UMB without help.  4DOS is an example
  305.           of a program which can do that, and there are a number of others.
  306.  
  307.           There were a number of other technical changes since version 2.00
  308.           which are mentioned in SEEMEM's history file SEEMEM.HST, which
  309.           accompanies this documentation.
  310.  
  311.           Enjoy,
  312.  
  313.                  Rick Housh
  314.  
  315.            
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.                                           5
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.