The first thing to do is take a copy of both your Config.Sys and Autoexec.Bat files. Then enter the command Mem. This will give you some information on how your memory is used and will look something like the following:-

   Memory Type        Total =  Used  +  Free
   ----------------  ------   ------   ------
   Conventional        640K     195K     445K
   Upper                 0K       0K       0K
   Adapter RAM/ROM     384K     384K       0K
   Extended (XMS)    15360K    2703K   12657K
   ----------------  ------   ------   ------
   Total memory      16384K    3282K   13102K

   Total under 1 MB    640K     195K     445K

   Largest executable program size       445K  (455296 bytes)
   Largest free upper memory block         0K       (0 bytes)
   The high memory area is available.

The important line here is third from the end, which gives the size of the largest program which you can run. As you can see in this case the largest program is only 445 Kb - not very large.

So how can we improve things?

Well the first thing is to look at the Config.Sys and Autoexec.Bat files. The ones used to give the above result are shown below.

Config.Sys
~~~~~~~~~~
   Device=c:\Dos\HiMem.Sys
   Device=c:\Dos\Emm386.Exe NoEMS x=ce00-ceff

   Device =c:\Dev\Hit-Ide.Sys /D:MSCD020 /N:1
   Device =c:\proaudio\mvsound.sys d:5 q:10 s:1,220,1,5 m:0 j:0
   Device =c:\Mouse\Mouse.Sys
   Device =c:\Dos\ANSI.Sys

   Shell=c:\Dos\Command.Com c:\Dos\ /e:1024 /p
   Country=44,,C:\Dos\Country.Sys

   Stacks=9,256
   Buffers=15,0
   Files=60
   FCBS=4,0
Autoexec.Bat
~~~~~~~~~~~~
   @Echo Off
   Rem *****************************************************************
   Rem * Autoexec.Bat                                                  *
   Rem * ~~~~~~~~~~~~                                                  *
   Rem *   Batch file to set up initial configuration.                 *
   Rem *****************************************************************

   C:\AntiV\Solomon\Guard

   Set Comspec=c:\Dos\Command.Com
   PATH C:\DOS;C:\Windows;c:\;c:\Bat;c:\Bin;c:\scsi;c:\proaudio
   Prompt $P$G
   set blaster=A220 D1 I5 T3

   C:\DOS\MSCDEX.EXE /D:MSCD020  /M:8
   C:\Dos\SmartDrv.Exe /X

   C:\DOS\KeyB.Com UK,,c:\Dos\KeyBoard.Sys /Id:166
   C:\DOS\DosKey

   DosKey Dir=Hdir $* /2
   DosKey Win=Do Win $*
   DosKey VDU=Mode Con Lines=50

   Set TEMP=C:\Windows\Temp
   Set WSWWORK=C:\Temp

   Echo On

Since the Config.Sys file loads before the Autoexec.Bat file we must look at it first. The first two lines start up the two device drivers I mention earlier. These are necessary if we are going to make use of the Upper memory area. The Emm386 driver is shown with two parameters which are used to modify the command. These are:-

NoEMS       Which simply says that we do not want any memory
            configured as EMS ie we want all XMS

x=ce00-ceff This is telling the Emm386 driver that it is not to use
            the memory area between ce00 and ceff in hexadecimal which
            is about the 820 Kb area even though it looks as though it
            is available.  Don't worry about why I have excluded this
            area, it's not important at this stage.

Since we have loaded these two drivers we can let Dos know that the Upper Memory area is available and ask it to make use of it. We do this by adding the following line:-

Dos=High,UMB

The word High is telling Dos to load part of itself in the Upper Memory area. The UMB says make the Upper Memory Blocks [areas of memory in the Upper memory area] available.

Just adding the above line gives an improvement in the amount of conventional memory available. The Mem command now gives:-

   Memory Type        Total =  Used  +  Free
   ----------------  ------   ------   ------
   Conventional        640K     118K     522K
   Upper               151K      28K     123K
   Adapter RAM/ROM     384K     384K       0K
   Extended (XMS)    15209K    2552K   12657K
   ----------------  ------   ------   ------
   Total memory      16384K    3082K   13302K

   Total under 1 MB    791K     146K     645K

   Largest executable program size       522K  (534112 bytes)
   Largest free upper memory block       104K  (106336 bytes)
   MS-DOS is resident in the high memory area.

The largest possible program is now 522 Kb, and increase of 77 Kb. Mind you part of this increase is because SmartDrive is clever enough to notice that the Upper Memory Area is available and make use of it.

But we can do better.

Look at lines 3 to 6 in the above example. These load the CD Rom driver, the sound card driver, the mouse driver and ANSI.Sys which is used for some fancy displays and prompts I like to use. All of these are being loaded into conventional memory, but there is no reason why they couldn't be loading into the upper memory blocks. To do this just replace the Device= with DeviceHigh=.

After doing this the Mem command gives the following:-

   Memory Type        Total =  Used  +  Free
   ----------------  ------   ------   ------
   Conventional        640K      76K     564K
   Upper               151K      70K      81K
   Adapter RAM/ROM     384K     384K       0K
   Extended (XMS)    15209K    2552K   12657K
   ----------------  ------   ------   ------
   Total memory      16384K    3082K   13302K

   Total under 1 MB    791K     146K     645K

   Largest executable program size       564K  (577216 bytes)
   Largest free upper memory block        62K   (63216 bytes)
   MS-DOS is resident in the high memory area.

A gain of another 42 Kb.

Now lets look at the Autoexec.Bat file, specifically the following lines:-

   C:\AntiV\Solomon\Guard

   C:\DOS\MSCDEX.EXE /D:MSCD020  /M:8
   C:\Dos\SmartDrv.Exe /X

   C:\DOS\KeyB.Com UK,,c:\Dos\KeyBoard.Sys /Id:166
   C:\DOS\DosKey

These lines load an Anti-Virus program, the Microsoft CD Rom extensions, SmartDrive, the Keyboard driver for the UK keyboard and a handy little Dos program called DosKey. All of these programs can also be loaded into Upper Memory by using the LoadHigh command, Just put LoadHigh at the start of the line. For example:-

LoadHigh c:\AntiV\Solomon\Guard

Doing that gives the following:-

   Memory Type        Total =  Used  +  Free
   ----------------  ------   ------   ------
   Conventional        640K      25K     615K
   Upper               151K     121K      30K
   Adapter RAM/ROM     384K     384K       0K
   Extended (XMS)    15209K    2552K   12657K
   ----------------  ------   ------   ------
   Total memory      16384K    3082K   13302K

   Total under 1 MB    791K     146K     645K

   Largest executable program size       615K  (629760 bytes)
   Largest free upper memory block        15K   (15104 bytes)
   MS-DOS is resident in the high memory area.

We now have 615 Kb available - a massive increase of 170 Kb over the original 445 Kb.

Now I must confess that while the above is a real example, it is in fact my own standard set-up, it is also an easy one to deal with. The reason is that all the programs fit into upper memory. In some cases you may well find that you do not have enough space in the Upper Memory Area to fit all your programs. In that situation the only thing you can do is try and arrange it so that you get the maximum possible in the Upper Memory area. And, unfortunately, the only real way of doing that is trial and error.

There are a couple of things which can help. The first of these is the mem command with the parameter /p. This will give you a much more detailed description of just what is in memory. For example:-

Modules using memory below 1 MB:

     Name           Total       =   Conventional   +   Upper Memory
     --------  ----------------   ----------------   ----------------
     MSDOS       17,341   (17K)     17,341   (17K)          0    (0K)
     HIMEM        1,120    (1K)      1,120    (1K)          0    (0K)
     EMM386       4,144    (4K)      4,144    (4K)          0    (0K)
     COMMAND      3,696    (4K)      3,696    (4K)          0    (0K)
     KEYB         6,944    (7K)          0    (0K)      6,944    (7K)
     DOSKEY       4,144    (4K)          0    (0K)      4,144    (4K)
     MOUSE       12,080   (12K)          0    (0K)     12,080   (12K)
     ANSI         4,256    (4K)          0    (0K)      4,256    (4K)
     SMARTDRV    29,024   (28K)          0    (0K)     29,024   (28K)
     Free       702,240  (686K)    628,864  (614K)     73,376   (72K)

   Memory Summary:

     Type of Memory       Total   =    Used    +    Free
     ----------------  ----------   ----------   ----------
     Conventional         655,360       26,496      628,864
     Upper                129,824       56,448       73,376
     Reserved             393,216      393,216            0
     Extended (XMS)     7,210,208    2,323,680    4,886,528
     ----------------  ----------   ----------   ----------
     Total memory       8,388,608    2,799,840    5,588,768

     Total under 1 MB     785,184       82,944      702,240

     Largest executable program size        628,768   (614K)
     Largest free upper memory block         40,784    (40K)
     MS-DOS is resident in the high memory area.

The important thing here is the first block titled, Modules using memory below 1 MB: which lists all the programs. The first column shows how big the program is. Since we now know the size of all the programs and the size of the Upper Memory, from the second block - Memory Summary:, it is possible to work out which programs will best fit.

The second thing which can help get the most into the Upper Memory area is to put the largest in first. Programs often need more memory to install them selves than they need to run. Thus putting the smallest in last can often mean you will get more in.

 +--------------------------------------------------------------------+
 | Page |  Start Address  | End Address | Remarks                     |
 +------+-----------------+-------------+-----------------------------+
 |      | Decimal |  Hex  |   in Hex    |                             |
 +------+---------+-------+-------------+-----------------------------+
 |  0   |       0 | 00000 |       0003F | Hardware Interrupt Vectors  |
 |      +---------+-------+-------------+-----------------------------+
 |      |      64 | 00040 |       0007F | BIOS Interrupt Vectors      |
 |      +---------+-------+-------------+-----------------------------+
 |      |     128 | 00080 |       002FF | DOS Interrupt Vectors       |
 |      +---------+-------+-------------+-----------------------------+
 |      |     768 | 00300 |       003FF | Stack area during POST and  |
 |      |         |       |             | bootstrap routine           |
 |      +---------+-------+-------------+-----------------------------+
 |      |    1024 | 00400 |       004EF | BIOS Data Area              |
 |      +---------+-------+-------------+-----------------------------+
 |      |    1264 | 004F0 |       004FF | Intra-Application           |
 |      |         |       |             | Communications Area         |
 |      +---------+-------+-------------+-----------------------------+
 |      |    1280 | 00500 |       005FF | DOS reserved communication  |
 |      |         |       |             | area                        |
 |      +---------+-------+-------------+-----------------------------+
 |      |    1536 | 00600 |             | IBMBIO.COM DOS interface to |
 |      |         |       |             | ROM I/O routines            |
 |      |         |       |       006FF | IbmDos.Com - Dos interrupt  |
 |      |         |       |             | handlers and service        |
 |      |         |       |             | routines (int 21 functions) |
 |      +---------+-------+-------------+-----------------------------+
 |      |    1792 | 00700 |             | DOS buffers, control areas, |
 |      |         |       |             | and installed device        |
 |      |         |       |             | drivers.                    |
 |      |         |       |             | Resident portion of         |
 |      |         |       |             | COMMAND.COM                 |
 |      |         |       |             | Interrupt handlers for int  |
 |      |         |       |             | 22h, 23h, 24h,              |
 |      |         |       |             | Code to reload the transient|
 |      |         |       |             | portion                     |
 |      |         |       |             | Master environment block,   |
 |      |         |       |             | default 64 bytes            |
 |      |         |       |             | Environment for next        |
 |      |         |       |             | program                     |
 |      |         |       |             | External commands or        |
 |      |         |       |             | utilities (COM or EXE       |
 |      |         |       |             | files)                      |
 |      |         |       |             | User stack for COM files    |
 |      |         |       |             | (256 bytes)                 |
 |      |         |       |             | Transient portion of        |
 |      |         |       |             | COMMAND.COM                 |
 +------+---------+-------+-------------+-----------------------------+
 |  1   |     64k | 10000 |       1FFFF | This is the User memory.    |
 +------+---------+-------+-------------+ The lower portion is used   |
 |  2   |    128k | 20000 |       2FFFF | up by the overspill from    |
 +------+---------+-------+-------------+ Page 0 and any TSRs which   |
 |  3   |    192k | 30000 |       3FFFF | have been loaded.           |
 +------+---------+-------+-------------+                             |
 |  4   |    256k | 40000 |       4FFFF |                             |
 +------+---------+-------+-------------+                             |
 |  5   |    320k | 50000 |       5FFFF |                             |
 +------+---------+-------+-------------+                             |
 |  6   |    384k | 60000 |       6FFFF |                             |
 +------+---------+-------+-------------+                             |
 |  7   |    448k | 70000 |       7FFFF |                             |
 +------+---------+-------+-------------+                             |
 |  8   |    512k | 80000 |       8FFFF |                             |
 +------+---------+-------+-------------+                             |
 |  9   |    576k | 90000 |       9FFFF |                             |
 +------+---------+-------+-------------+-----------------------------+
 |  A   |    640k | A0000 |       AFFFF | EGA and VGA Graphics Screen |
 |      |         |       |             | memory                      |
 +------+---------+-------+-------------+-----------------------------+
 |  B   |    704k | B0000 |       B1000 | Monochrome Display|         |
 |      |         |       |             | Adapter Screen    |Hercules |
 |      |         |       |             | Memory            |         |
 |      +---------+-------+-------------+-------------------+         |
 |      |    736k | B8000 |       BC000 | CGA Screen Memory | Cards   |
 |      |         |       +-------------+-------------------+         |
 |      |         |       |       BFFFF | EGA and VGA Text  |         |
 |      |         |       |             | Screen Memory     |         |
 +----------------------------------------------------------+---------+
 | Note The PCjr and early Tandy 1000 BIOSs revector direct writes to |
 |      the B8 area to the Video Gate Array and reserved system RAM   |
 +--------------------------------------------------------------------+
 |  C   |    768k | C0000 |       C3FFF | 16k EGA BIOS C000:001E      |
 |      |         |       |             | contains the EGA BIOS       |
 |      |         |       |             | signature (the letters      |
 |      |         |       |             | IBM)                        |
 |      |         |       |             | The IBM Token Ring BIOS     |
 |      +---------+-------+-------------+-----------------------------+
 |      |    784k | C4000 |       C7FFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      |    800k | C8000 |       C9FFF | IBM Expanded Memory Adapter |
 |      |         |       |       CBFFF | 16k hard disk controller    |
 |      |         |       |             | BIOS, drive 0 default       |
 |      +---------+-------+-------------+-----------------------------+
 |      |    816k | CC000 |       CFFFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      | Note The contents of page C are very variable and the       |
 |      |      details given above are a guide only.                  |
 +------+-------------------------------------------------------------+
 |  D   |    832k | D0000 |       D7FFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      |    848k | D4000 |       D7FFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      |    864k | D8000 |       DBFFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      |    880k | DC000 |       DFFFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      | Note The contents of page D are very variable               |
 +------+---------+-------+-------------+-----------------------------+
 |  E   |    896k | E0000 |       E3FFF | PCjr second ROM cartridge   |
 |      |         |       |             | address area                |
 |      +---------+-------+-------------+-----------------------------+
 |      |    912k | E4000 |       EFFFF | Usually Unallocated         |
 +------+---------+-------+-------------+-----------------------------+
 | Note The area from E0000h to EFFFFh is hard wired to an empty ROM  |
 |      on AT machines                                                |
 +------+---------+-------+-------------+-----------------------------+
 |  F   |    960k | F0000 |       F3FFF | PCjr optional Rom cartridge |
 |      |         |       |             | address area cartridge      |
 |      |         |       |             | Basic                       |
 |      |         |       |             | Reserved by IBM on other    |
 |      |         |       |             | machines                    |
 |      +---------+-------+-------------+-----------------------------+
 |      |    976k | F4000 |       F5FFF | ?                           |
 |      +---------+-------+-------------+-----------------------------+
 |      |    984k | F6000 |       FBFFF | ROM Basic                   |
 |      +---------+-------+-------------+-----------------------------+
 |      |   1008k | FC000 |       FFFFF | Original BIOS               |
 |      |         |       |             | (Compatibility BIOS in PS/2)|
 |      +---------+-------+-------------+-----------------------------+
 | Note The area from E0000h to FFFFFh on a PS/2 is used by the       |
 |      System ROM                                                    |
 +--------------------------------------------------------------------+
 

Dave Wadler (dwadler@cix.compulink.co.uk)

| Contents | Reviews | Features | News | Tips | Links | Contributors |
Game-Over! magazine is produced and published by Game-Over
Editor: Tony Burnett - Web Editor: Gary Kinson
All material © Game-Over! 1997