               MS-DOS 7.00/Windows 95 Memory Management Tips



These are my own tips on how to squeeze a few more KB of low (conventional)
memory (RAM) for your DOS programs/games (under Windows 95 OS) and on how to
optimize your AUTOEXEC.BAT and/or CONFIG.SYS in Windows 95:


I included here my Windows 95 versions of AUTOEXEC.BAT and CONFIG.SYS and my
MS-DOS 6.22 startup files: AUTOEXEC.DOS and CONFIG.DOS (dual-boot users, that
kept their ol' Windows 3.1x/MS-DOS 6.xx copies, may be interested to view these
two .DOS files).
You can read all these files by opening them in Windows (any version) with
Notepad, or in MS-DOS mode (any version above 5.00) with EDIT.COM (the MS-DOS
default text editor).
The *.DOS files are the names given to the DOS 6.xx startup files by Win95 OS,
when using the dualboot feature (after you installed Win95 on your system) and
you booted up into Win95.
A nice thing is that you can successfully use Win95's MS-DOS mode memory
managers versions (HIMEM.SYS and EMM386.EXE) in your MS-DOS 6.xx CONFIG.SYS
(if you're using the dual boot feature in Win95, and kept your old DOS/Windows
files on your hard drive!).
I also suggest to load Win95's DOS mode MSCDEX.EXE (version 2.25) in your MS-DOS
6.xx version of AUTOEXEC.BAT, to give your CD-ROM drive full potential and
compatibility with the newer software.
My CONFIG.SYS also uses QEMM ver 8.01 updated and NetRoom ver 3.04 updated,
comercial third party 386 enhanced memory managers. Read DOS95MEM.TXT (for my
outside Win95 memory configuration) and WIN95MEM.TXT (for an MS-DOS session
inside Win95 memory configuration), and MSD95.TXT (my outside Win95 memory
configuration shown by running MSD.EXE version 2.1, included with the Win95
install CD-ROM).
MSD95.TXT was created by running this MSD.EXE command:
MSD /P C:\path\MSD95.TXT
from the DOS prompt command line, outside Win95.

NOTE: All the CONFIG.SYS and AUTOEXEC.BAT command lines in these examples are
      customized to my system, and you'll need to follow the guidelines in
      this text file, and then edit your OWN files (only after you've made
      BACKUP copies) to adapt them to your own SYSTEM configuration !


                   MY CONFIG.SYS AND AUTOEXEC.BAT EXPLAINED

Bellow are my CONFIG.SYS and AUTOEXEC.BAT command lines explained (most of
these tips are ALSO VALID for my Win31's startup files included here:
AUTOEXEC.DOS and CONFIG.DOS, if not specified otherwise):

DEVICE=C:\W95\HIMEM.SYS /NUMHANDLES=128 /TESTMEM:OFF
For more info on "himem.sys" parameters, type:
HELP HIMEM.SYS
from any DOS prompt and press Enter (MS-DOS 6.xx and up users).
/NUMHANDLES=128 represents the maximum number of extended memory block
handles (has no influence in Windows).
/TESTMEM:OFF loads HIMEM.SYS without taking an extra few miliseconds to test
all your system's extended memory. Most of the newer Pentium based system
BIOS-es do this at bootup time anyway.
NOTE: the HIMEM.SYS and EMM386.EXE memory managers MUST be loaded in
      CONFIG.SYS by the "DEVICE" command, before ANY OTHER DEVICE or/and
      DEVICEHIGH command !
      The CONFIG.SYS commands DEVICE AND DEVICEHIGH, and the AUTOEXEC.BAT
      commands LOADHIGH and LH are internal DOS commands, built into the OS.

DEVICE=C:\W95\EMM386.EXE X=C000-C7FF I=EE00-EFFF I=E000-ECFF I=B000-B7FF M3
A=64 H=128 D=256 RAM AUTO ALTBOOT
For detailed help on EMM386.EXE parameters, run (MS-DOS 6.xx users):
HELP EMM386.EXE
from any DOS prompt, to READ the EMM386.EXE topic!
Generic EMM386 line (fits almost all systems with a standard Win95 setup):
DEVICE=C:\WINDOWS\EMM386.EXE X=C000-C7FF I=B000-B7FF D=256 RAM AUTO ALTBOOT
valid for both Win95 and MS-DOS 6.xx versions of CONFIG.SYS (if the dualboot
option is a choice on your system).
Change the path to EMM386.EXE if different than C:\WINDOWS.

Including and excluding addresses in upper memory (using the "I" and "X"
switches) depends on your system CMOS, ROM and Video BIOS configuration and
video card upper ROM memory addresses and can be tricky. Use these switches
with extreme caution (if not properly set, you can hang your machine, or
worse, lose data!). You can see how these regions of upper memory are set on
your system, by running MSD.EXE from a DOS prompt, and pressing M (for the
memory config screen). To visualize the upper ROM regions (color coded in
grey) occupied by VGA/Video, CMOS and Extended BIOS memory hardware
configuration you can click "Utilities" on MSD's menu bar and then click
"Memory Browser".
A classical method to make more upper memory available to drivers/devices is
to add these 2 switches:
X=C000-C7FF I=B000-B7FF
to the EMM386.EXE line. C000-C7FF is usually reserved for the video ROM BIOS,
and B000-B7FF region is only used for text on black and white (monochrome)
monitors, so it's safe to add these addresses to your EMM386 line.
The "M3" switch loads EMM386's page frame to the C800 upper memory address
(hex). On my system this gives maximum contiguous Upper Memory Blocks (UMBs)
used for loading drivers/TSRs "high".
The switch "NOTR" is not documented (prevents EMM386 from detecting a Token
Ring Network Adapter, which detection may hang some machines). "NOTR" is NOT
enabled by default (you need to add it to EMM386.EXE's line yourself, if you
don't use a network card connection!).
Try to avoid the "HIGHSCAN" switch on the EMM386.EXE line! It may be dangerous
to your health (it may hang your machine on bootup!). The "RAM" switch does
the same job on searching the Upper Memory Area (UMA) for unused UMB-s (Upper
Memory Blocks).

NOTE: for info on HIMEM.SYS/EMM386.EXE parameters, pop in your Win95 install
      CD-ROM (if you have it), change to your CD-ROM drive, go to the
      \OTHER\OLDMSDOS folder (found on the Win95 install CD-ROM only) and run
      "HELP" from the CD-ROM (HELP.COM is a DOS program):
HELP EMM386.EXE
and press Enter, and then:
HELP HIMEM.SYS
and press Enter.

It is useful to load drivers/devices/TSRs with the "DEVICEHIGH" command, to
gain more low (conventional) memory (RAM). Use MEMMAKER to gain more memory.
(MS-DOS 6.00 and up users only!). Or change the order of loading drivers in
config.sys and autoexec.bat until you're satisfied with the amount of
conventional memory reported by the "MEM /C /P" command. You can fiddle with
the "/L:1", "/L:2", "/L:3", etc. switches to determine your own best high
memory loading configuration. Example:
DEVICEHIGH /L:3 C:\DOS\ANSI.SYS
to load the ANSI.SYS driver in Upper Memory (UMA)--region 3 (located on my
system between hex addresses EE00 and EFFF).

NOTE: READ REGIONS.TXT (Courtesy of Mr. Dale F. Ogden, and included here)
      FOR PRECIOUS INFO ON MS-DOS UPPER MEMORY MANAGEMENT AND UPPER MEMORY
      REGIONS MAPPING, IF YOU WANT TO MASTER YOURSELF THE WAY DEVICES,
      DRIVERS AND TSR-S LOAD IN YOUR CONFIG.SYS AND AUTOEXEC.BAT.

The order of loading the devices/drivers/TSRs is of utmost importance
(bigger first, smaller last). Same principles apply to loading TSRs high in
AUTOEXEC.BAT, using "LOADHIGH" ("LH" for short). Example:
LH /L:2 C:\MOUSE\MOUSE
This means that my MS-DOS mode Mouse.com Driver loads in the 2nd upper
memory region, located between C800 and ECFF (addresses in hex), on my
system.

NOTE: THE EMM386.EXE LINE MUST FOLLOW THE HIMEM.SYS LINE IN CONFIG.SYS!
      All "DEVICE"/"DEVICEHIGH" commands in CONFIG.SYS MUST follow the
      HIMEM.SYS and EMM386.EXE lines!

SWITCHES=/F - skips the 2 second delay before processing the startup files
	      after bootup (valid for all MS-DOS versions above 6.00 and
              including Windows 95).

SWITCHES=/E:288 - use this switch ONLY in Win95's CONFIG.SYS.
                  Moves 288 bytes of extended BIOS (EBIOS) to the conventional
                  memory area. Valid values for /E: are 48-1024. You may
                  gain up to 1KB of conventional memory by using this switch.
                  Use both these switches on the same line:
                  SWITCHES=/E:288 /F
                  Make this your first CONFIG.SYS line (Win95 only).
                  NOTE: Also read the "SWITCHES" topic in MYTIPS95.TXT !

DOS=HIGH,UMB - loads the DOS kernel high and provides UMBs (upper memory
               blocks) for loading devices/drivers/TSRs in UMA (upper memory
               area).
               NOTE: Windows 95 has added another useful switch: AUTO (or
                     NOAUTO) to the DOS= line in CONFIG.SYS:

DOS=HIGH,UMB,NOAUTO or

DOS=HIGH,UMB,AUTO - Win95 OS can now move the FILES, STACKS, LASTDRIVE and
                    FCBS to the upper memory area (above the 1st 640KB).
                    The BUFFERS are moved to the high memory area (HMA), the
                    first 64KB of RAM above the first meg. These new features
                    are implemented in the Win95 OS and can be achieved by
                    adding these lines to the beginning of your CONFIG.SYS
                    (the numeric values here are only the average example,
                    and you should change them to suit your own system):
DOS=HIGH,UMB,NOAUTO
BUFFERSHIGH=10,0
FILESHIGH=60
LASTDRIVEHIGH=H
FCBSHIGH=1,0
STACKSHIGH=0,0
                    or go with the "conservative" version (let the OS do the
                    work for you):
DOS=HIGH,UMB,AUTO
BUFFERS=10,0
FILES=60
LASTDRIVE=H
FCBS=1,0
STACKS=0,0
                    The AUTO switch doesn't need to be mentioned (it's the
                    default). By using AUTO, you may gain 256 bytes of low
                    memory compared to using DOS=NOAUTO and the HIGH switch
                    added to each of the above lines (BUFFERS, STACKS, FILES,
                    FCBS and LASTDRIVE).

FILES=n - where 'n' MUST be at least 40 to run MS Windows 95 and CPU intensive
          DOS applications/games. Set files to at least 50 in your config.sys
          to play safe!

FCBS=1,0 - not to take extra memory. Higher values are needed only by older
	   DOS programs (very probable that you'll never need more than that)
	   If you don't specify a value for FCBS (File Control Blocks),
           MS-DOS loads the default value of 4. Newer programs use the
           "FILES" setting instead.

BUFFERS=10,0 - if you use ANY hard disk cache utility (SMARTDRV.EXE is
	       strongly recomended if you run any MS-DOS programs that
               access your hard disk frequently: use Smartdrv.exe to cache disk
               writes/reads in DOS mode). Avoid 3rd party disk caches that may
	       crash your hard disk, especially if you run Windows 95/3.1x !
	       The first number here (10) is the number of disk buffers.
	       Its value must be between 1-99. Default is 30 (if not
               mentioned) and occupies too much memory (30 buffers are not
               needed, and cannot fit into the HMA).
	       The second number here (0) is the number of buffers in the
	       secondary buffer cache. Its value must be between 0-8.
	       Default is 0 (no secondary cache buffers).
	       Secondary cache buffers are needed ONLY if your hard disk
	       (a SCSI disk) is not recognized or cached by SmartDrive.
               Use Smartdrv with Win95 (add a SMARTDRV line in Win95's
               AUTOEXEC.BAT), if you use any DOS programs/games that require
               frequent file access (huge files/directories).
               Doing so, it won't interfere with the Win95 disk operations.

STACKS=n,m - where "n" can be: 8-64 and "m" can be: 32-512. If you are
	     running older programs that rely on DOS stacks, set STACKS to
	     at least 12,128 (default is STACKS=9,256, set by DOS if you don't
             mention a STACKS= line in config.sys!). Newer DOS programs and
             Windows 3.1x/95 do NOT use DOS stacks! Set STACKS=0,0 in your
             config.sys to save conventional/upper RAM, if you're sure your
             programs don't use STACKS (your older software specifications
             should tell you if you should increase the STACKS number/s).

LASTDRIVE=n - where "n" is the letter following your last drive on your system
              (counting all your floppy, hard, CD-ROM, removable, Dblspace,
              Drvspace, Stacker, or other compressed drives, Network drives,
              and RAM virtual drives, if you installed any). You can specify
              any letter from A to Z. Default is Z, which represents the
              maximum number of logical drives on an IBM compatible system
              If you are not using a Network Card connection, set LASTDRIVE to
              show your last drive letter installed in your system.
              Example:
              LASTDRIVE=E

DEVICEHIGH /L:1 C:\path\CD_ROM.SYS /D:MYCDROM -> loads your CD_ROM device
                                                 driver.
You also NEED to load MSCDEX.EXE in your AUTOEXEC.BAT, for your CD-ROM drive
to be recognized by the system! Typical mscdex line:
LH C:\path\MSCDEX /D:MYCDROM /M:xx /E
with EMM386 configured to provide expanded memory (EMM386's "RAM" switch) to
load the buffers in expanded memory ("/M:xx") with the  "/E" switch.
"/D:MYCDROM" is the cd-rom drive's "name" and MUST be the SAME as the one on
your cd-rom device driver line in your config.sys!

DEVICEHIGH /L:1 C:\WINDOWS\IFSHLP.SYS -> loads MS Windows 95/3.1x 32 bit disk
                                         access support device driver

NOTES: You can use any other third party memory manager on the market:
QEMM 7.x/8.01, NetRoom 3.x, 386MAX 7.x/8.00 with similar (or better) results,
to replace Microsoft's HIMEM.SYS / EMM386.EXE memory managers that ship with
Windows 95.
Do not use these memory managers' "DosUp/DosHigh" features with Windows 95 OS!
Also if you use any 3rd party memory managers, I recommend to NOT enable the
moving of Video / ROM BIOS to high / extended memory (like QEMM's Stealth or
NetRoom's VidCloak / SysCloak features!).
Also try to use MS-DOS's internal "DEVICEHIGH" (in your config.sys) and
"LOADHIGH" ("LH" for short in your autoexec.bat) commands to load devices,
drivers, TSR-s high, instead of your third party memory managers external
high memory loaders (like QEMM's "LOADHI", or NetRoom's "XLOAD") for better
compatibility reasons.

The Win95 version of the SHELL line in CONFIG.SYS:
SHELL=C:\COMMAND.COM C:\ /E:512 /L:160 /U:160 /P /F
provided you have a copy of COMMAND.COM in C:\ root  (change C: to your
actual boot drive letter, if different).
If you don't specify the /E: switch of 1024 or smaller (you won't need an
environment size bigger than 1024), Win95 will set it to 2048 by default,
which is much bigger than needed, and it will take a lot of valuable upper
and low memory space.
If you don't have a SHELL line in your CONFIG.SYS, Windows 95 loads its GUI
(Graphical User Interface) automaticaly after processing your CONFIG.SYS and
AUTOEXEC.BAT files at bootup, and sets a default evironment size of 2048.
The purpose of starting Win95 on demand (and not right after processing the
startup files), is if you'd like to have a custom Win95 startup, let's say
from a DOS batch file, or from AUTOEXEC.BAT, or/and if you use the dual boot
feature implemented in the Win95 OS.
NOTE: Windows 95 is a combined 32bit AND 16bit (for backward compatibility
with DOS and Win31 programs) graphical (GUI) application (... sorry,
operating system) that still loads on top of DOS anyway!
GUI stands for Graphical User Interface.

* To load devices/drivers high, you can also use the INSTALLHIGH command
ONLY in your CONFIG.SYS. INSTALLHIGH is needed only if you have, for
example, a big size driver that you want to load before the smaller ones
that load in your AUTOEXEC.BAT (using LH command).
Example:
INSTALLHIGH C:\WINDOWS\MOUSE.COM <parameters>
A disadvantage to using this command, is that you can't specify an upper
memory region (by using the /L:x switches, as you can use with DEVICEHIGH
and LH). Therefore, a particular driver will load into the largest
contiguous upper memory area if you use INSTALLHIGH.

* Lines you might need in your AUTOEXEC.BAT (MS-DOS 6.xx and Windows 95):

LH C:\WINDOWS\COMMAND\MSCDEX /D:MYCDROM /M:24 /E
The cd-rom drive's name (/D:MYCDROM in this example) HAS TO BE EXACTLY THE
SAME as the one specified on your CONFIG.SYS cd-rom driver line (read the
config.sys cd-rom driver topic above);
/M:24 - gives MSCDEX 24 buffers to handle the cd-rom cache (if you don't
specify this switch, the default is 8, which could be too small for some DOS
programs to read huge cd-rom files);
/E - loads MSCDEX's buffers into expanded memory, provided you have a line
for EMM386.EXE in your config.sys (example of EMM386 line to provide expanded
memory):
DEVICE=C:\WINDOWS\EMM386.EXE X=C000-C7FF I=B000-B7FF D=256 RAM AUTO ALTBOOT
These lines are valid for both Win95 and MS-DOS 6.xx versions of CONFIG.SYS.
NOTE: Always use the latest version of MSCDEX.EXE (the newest is 2.25, the
      one included with Win95). This is valid for both Win95 and MS-DOS 6.xx
      users (using Win95's dualboot feature).

C:\WINDOWS\COMMAND\SMARTDRV 2048 A+ C+ D /N
I presumed that A is your 3.5 inch floppy drive, C is your hard drive, and D
your CD-ROM drive. Change the drive letters if different on your system.
Load Smartdrv AFTER the MSCDEX line, if you want your CD-ROM drive to be
cached in DOS mode!
Run SMARTDRV /? at DOS prompt to see all Smartdrv related parameters, and to
understand how to adapt Smartdrv to your system.
NOTE: If you run any DOS games/programs OUTSIDE Win95 (in "Command prompt
      mode"), Smartdrv IS A MUST (customized to cache ALL your drives)!

SET MOUSE=C:\MOUSE
LH C:\MOUSE\MOUSE <parameters>
to load your DOS mode mouse driver. You only need it in Win95, if you use
any DOS programs/games that use a mouse, outside win95. The above line allows
your mouse driver to load the custom settings from the MOUSE.INI file located
in the directory specified (C:\MOUSE in this case).
Change the DOS mouse driver's directory if different and adapt the parameters
to your own mouse driver specifications, and to your mouse hardware type.

* My Win95 (and MS-DOS 6.22) CONFIG.SYS and AUTOEXEC.BAT files, with
EVERYTHING loaded high, give me 625KB of free low (conventional) memory (RAM)
and 5KB of free upper memory (with MS-DOS 7.00's own HIMEM.SYS and EMM386.EXE
memory managers). This IS ENOUGH to run ANY memory hungry DOS program/game in
MS-DOS mode (outside Win95)!
ALWAYS make sure to alocate ALL your computer's memory as expanded or
extended memory with your expanded memory manager (use EMM386's "RAM" switch
to provide expanded memory combined with "AUTO", OR use "NOEMS" to provide
ONLY extended memory).
NOTE: DO NOT USE "NOEMS" IF YOUR DOS PROGRAMS/GAMES NEED EXPANDED MEMORY in
      DOS MODE (OUTSIDE WIN95)!

* If you don't use any DOS communications software, or if you're not
connected to a network, DO NOT LOAD SHARE.EXE in your autoexec.bat!
To make this possible under Win95, you have to DELETE the file SHARE.EXE
from the \WINDOWS\COMMAND directory, and remove the:
C:\WINDOWS\COMMAND\SHARE.EXE
line from the Win95's autoexec.bat (if any).
Windows 95 has its own 32bit (VXD) driver for loading VShare, that loads at
boot time in extended memory:
device=*vshare
this being a line in your Win95's SYSTEM.INI file, the [386enh] section
(no need to load a Share DOS driver in your autoexec.bat).
The file VSHARE.VXD is located in your \WINDOWS\SYSTEM folder (default).

* There is a good probability that if you're using a relatively new computer
(486DX/33 or better) and not using a network (or an old ESDI hard disk, or
an old hard disk compression utility), you won't need SETVER.EXE loaded in
your config.sys file.
If you determined that you don't need SETVER.EXE loaded (you're not using
any older IBM or third party ESDI/IDE hard disk drivers, or old disk
compressors, or older DOS network drivers), delete the file SETVER.EXE from
\WINDOWS\COMMAND (Win95 users default location) and remove the:
DEVICE=C:\WINDOWS\COMMAND\SETVER.EXE
line from your Win95's config.sys file.
If you'll need it later on, you can extract the file SETVER.EXE again and
copy it to your hard disk from your Win95 system install disk(s).


NOTE: ALWAYS BACKUP YOUR DOS / WINDOWS STARTUP FILES BEFORE MAKING ANY
      MODIFICATIONS !!!

* MS-DOS 6.xx STARTUP FILES (default location is C:\ root):
AUTOEXEC.BAT
CONFIG.SYS
* WINDOWS 3.1x STARTUP FILES (located in your Win31 directory, \WINDOWS
is default):
SYSTEM.INI
WIN.INI
* MS-DOS 7.00 STARTUP FILES (default location is C:\ root):
AUTOEXEC.BAT
CONFIG.SYS
MSDOS.SYS
* WINDOWS 95 STARTUP FILES (located in your Win95 directory, \WINDOWS
is default):
SYSTEM.DAT
SYSTEM.DA0
USER.DAT
USER.DA0
SYSTEM.INI
WIN.INI



Final Note:

I uploaded all these memory management tips in the hope that people like you
will find useful to have plenty of low free RAM to run any "nasty" (read
"memory hungry") DOS program/game on the planet!

Good luck!