Configuring DOS Properly

Embed Size (px)

Citation preview

  • 8/6/2019 Configuring DOS Properly

    1/6

    Configuring your MS-DOS properly

    Table of Contents

    1. History2. MSDOS.SYS3. CONFIG.SYS4. AUTOEXEC.BAT5. Comments6. Smartdrive7. Ramdrive8. Windows 959. Full Hard Disks

    10. Defrag, Scandisk

    0) Preface

    I have noticed that many users have little or hardly any knowledge of the basic configuration topics. In the last years I have been asked veryoften to have a look at someone's "autoexec", because something was not working as expected. Perhaps you have had (or still have) thoseproblems. If you think you're an config.sys expert I would suggest you still read this document, as it contains perhaps some tricks and featuresyou do not know yet.

    1) History

    In the good old days there was MS-DOS (sometimes people used PC-DOS, the clone from IBM for their pc-series. Later on DR-DOS wasused for some days mainly because it was some $ cheaper...). When IBM designed their first PCs they only had the MDA textmodecapability. The MS-DOS that was delivered had (and still has) relatively good support for textmode (have a look at INT10h). But some yearslater everybody was able to purchase graphic adapters that could display bitmapped graphics. The PC design was not really prepared forthis and most software still used textmode. But with the introduction of Microsoft Windows things changed. Microsoft presented a standard forgraphic user interfaces, so nearly everybody could use the new look. And hardware manufactores supplied drivers for their products, andsoon the complete PC world only wanted Windows. (I herewith omit the fact that Win1 and Win2 were no real successes. The hurry started in1990, when Windows 3.0 was introduced).But there was still lots of software to run on MS-DOS and people wanted to use those old software packages. So Microsoft did not programWindows as a standalone operating system (which they could have done, if they wanted), but rather as a graphical add-on for MS-DOS.Again some years later some companies shouted MS-DOS is "out", mostly to sell their own operating systems (mainly IBM with OS/2). SoMicrosoft had to react. In fact they always tell you that their product Windows 95 is a complete operating system no longer relying on MS-DOS. But don't trust them. It is all the old way! Every time you start up your Windows 95 machine, MS-DOS (in this case v7.0) is started.Command.com then starts a file called win.com in your windows directory. If you don't trust me, then rename your win.com to some othername and reboot your machine. You will notice, that you have the classic command.com interface. If you quit windows again you will get a nicepicture telling you that you can turn off your computer. But the whole truth is, that you are now back to MS-DOS, but your graphic card is stillswitched to gfx mode. If you type mode co80and press enter you will get the classic command prompt.Summary: Windows95 behaves just as Windows 3.x did and we can get some advantages of this fact.

    2) MSDOS.SYS

    In fact Microsoft has prepared their software for the things we want to do. So at first you should rename your renamed win.com to the originalname again. Then you have to go to the command prompt, either with a shell in Windows or from boot disk, or which ever way you prefer. Nowwe want to have a look at the file MSDOS.SYS. Before Win95 this file was needed to boot up the machine together with IO.SYS and everycomputer has this file on its hard disk in the root directory. With windows 95 and dos 7.0 things changed. MSDOS.SYS is not longer a binaryfile. But of course it is hidden, system and protected, so at first we have to set some proper attributes:attrib -r -s -h msdos.sys

    no we can have a look at this fi le in our favourite text editor:edit msdos.sys

    Mine look like this:

    [Paths]Windir=c:\windowsWinbootdir=c:\windowsHostwinbootdrv=c

    [Options]

    BootMulti=1BootGui=0Logo=0Network=1

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    and there are a couple of ; lines more to follow...

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDF
  • 8/6/2019 Configuring DOS Properly

    2/6

    As in all Microsoft configuration files this file is seperated in sections. Each section starts with a key word in brackets []. The PATHS sectionshould be no mystery to you and you normally don't need to change it. But very interesting is the next section, the OPTIONS section. Here wefind 4 entries. If some of the entries above are not listed in your msdos.sys that is somewhat normal. But you can just insert them.

    BootMultithis option enables multiple boot configurations. Even if you only want on configuration it does not hurt to enable this option.

    BootGuinow this is a real highlight. Window's Setup enables this option and therefore the command processor load windows every time themachine starts. By disabling this option you will get the command line at startup and can start windows easi ly by typing "win". Sodisable this.

    LogoMany people find it totally cool to have big background and startup pictures. I personally prefer the classic style of a black screen. Thisoption enables the startup picture, so I disabled i t.

    NetworkIf you want to use Network enable this.

    If you've modified the file according to your needs save it. Then exit your editor and make it protected again with:attrib +r +h +s msdos.sys

    3) CONFIG.SYS

    Now we go a little bit deeper into the configuration. We will now handle our config.sys file. But before we edit i t, we have to get some overviewof what our system think it needs. The mem programm fits our needs. type:mem /c/p

    my output look like this. you will later notice (when you are an expert) that the above command is the best utility when optimizing yourconfiguration. Here is my output (of course it is optimited for my needs already):

    Name Gesamt = Konventioneller + oberer Speicher-------- ---------------- ----------------- ----------------SYSTEM 34.640 (34K) 10.640 (10K) 24.000 (23K)HIMEM 1.168 (1K) 1.168 (1K) 0 (0K)EMM386 4.032 (4K) 4.032 (4K) 0 (0K)4DOS 4.784 (5K) 432 (0K) 4.352 (4K)TEAC_CDI 8.048 (8K) 0 (0K) 8.048 (8K)EANSI 1.920 (2K) 0 (0K) 1.920 (2K)IFSHLP 2.864 (3K) 0 (0K) 2.864 (3K)SETVER 832 (1K) 0 (0K) 832 (1K)KEYB 6.944 (7K) 0 (0K) 6.944 (7K)MSCDEX 23.904 (23K) 0 (0K) 23.904 (23K)MOUSE 29.712 (29K) 0 (0K) 29.712 (29K)HYPERKEY 2.816 (3K) 0 (0K) 2.816 (3K)UNIVBE 12.560 (12K) 0 (0K) 12.560 (12K)Frei 711.248 (695K) 638.384 (623K) 72.864 (71K)

    hmm, seems I have a german version of windows installed. But on other language version things should look similar, so I guess you won'thave any difficulties. The above is not the complete output ofmem /c/p, but everything we have to know now. We clearly see that DOS

    manages two di fferent memory blocks, the conventional and the upper memory block. I think the best would now be to explain those termsnow. again some history:

    The original PC in 1980 had a 8088/8086 which could handle 1MB of memory. But 1MB of RAM was very expensive, so the designers madea hardware design for the pc using the lower 640K for the operating system and user loadable programs. The memory from A000-CFFF wasreserved for the graphic card. As the user could plug in additional cards which could need some memory too, D000-EFFF was reserved forcard roms. Finally the BIOS of the computer needs some memory adresses to image their ROMs too, which was located from F000-FFFF.So the whole addressable memory from 0000-FFFF was used in the pc-design.

    But things turned out to develop in a different way. Today no card uses the memory from D000-EFFF. The VGA BIOS which could use C000-CFFF is often smaller. The same applies for the system BIOS which often only needs 32K. And modern computers have more than 1MB ofRAM installed so there is physical memory which can/should be used!I would suggest that you take a look the the programm UMBINFO now. Although this is a german programm to present a card, which wasneeded about 10 years ago it has a very interesting feature which lets you explore you dos memory. Select Speicherbelegungand you can

    browse through your lower 1MB memory and explore the installed programs and tables. Have a close look on the points System Bios andROM Erweiterung(the one starting at C000) and write down their start/and adresses.

    But now back to ourmem /c/p printout. All programs listed here are drivers and tsr programs currently loaded. Please write down theirmemory usage now. For example my cd-rom driver TEAC_CDI uses 8K of ram. If you notice that your HIMEM.SYS driver uses about 45K ofmemory you have installed a Win95b version, which has a bug in the IO.SYS file. There is a patch from Microsoft which you should definativelyapply!

    Now we have to manipulate our config.sys so load it into your editor:

    DEVICE=C:\windows\HIMEM.SYS /testmem:offDOS=HIGH,UMBLASTDRIVE=zCOUNTRY=049,850,C:\windows\COMMAND\country.sysSHELL=c:\4dos\4dos.com c:\4dos /p /e:1024DEVICE=C:\windows\EMM386.EXE noems d=64 x=a000-c7ff i=c800-f7ff x=f800-ffff

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://www.cubic.org/docs/download/umbinfo.com
  • 8/6/2019 Configuring DOS Properly

    3/6

    rem DEVICE=C:\windows\EMM386.EXE 28000 ram d=64 x=a000-c7ff frame=c800 i=d000-f7ff x=f800-ffffDEVICEHIGH=c:\utils\TEAC_CDI.SYS /D:TEACDEVICEHIGH=C:\utils\eansi.sys

    If you have never touched this file before and installed some programs it is normally in a very bad order. But we will make it orderd and goodnow. If your config.sys file does not include lines I talk about you can just add them. The first line should definativly start the HIMEM.SYS driver.

    This driver is needed for memory management and most programs rely on its presence. But himem is a very critical program and wants tocheck your memory every time you boot up. Modern RAM chips do not break down, so there is no need to check every single bit whenbooting each time. You should apply the /testmem:off switch. You will notice that himem now boots in 0.5s!

    The second line should consist ofdos=high,umb. high tells you system to load the main part of dos into the High Memory Area (HMA, a 64K

    segment above 1MB, which can be used with a trick on i386). This will save you 64K of conventional memory. umb is a directive for emm386

    (we'll cover it soon) to be able to load normal dos programs into the upper memory area (remember? the memory between C800-F7FF).lastdrive is not really needed, but does not hurt. normally this is set to f. But if you have some hard disks, cd-rom, and perhaps otherremovable media drives installed fcan lead to a problem. Or if you want to install network drives. So set this to Zand be save.The line with the Country code is normally created by the setup program and prepares your keyboard for nation specific standards. Leave thisline as it is.The next line is perhaps the most important line in your config.sys file. The second driver loaded should be EMM386. This multi purposeprograms handles two things. It provides additional memory manangement routines needed by many programs and it is able to load DOSprograms and drivers into the UMB. Note that you can not load Himem or Emm386 "high" as these two programs provide the option to loadother programs high. They can't load themselves high.The memory above 1MB can be configured in three different ways. If you do not load himem.sys the memory is not configured at all and canonly be accessed by protected mode programs. When loading himem.sys the memory is configured as XMS memory (eXtended MemorySystem). This is the prefered method ! But in the 80's there was a second standard for additional memory called EMS (Expanded Memory

    System). emm386 can now simulate EMS within the XMS. Today some programs still want EMS memory (for example Impulse Tracker or

    Wing Commander 1+2). But as this memory technique is far outdated you should look out for better programs. However if you have to useEMS you can modify your config.sys accordingly. Unfortunately if you load emm386 without any switches it configures itself with a smallamount of EMS (I think 2MB) and the rest of the memory is left as XMS. But we (normally) do not want any EMS memory at all, so we start itwith the NOEMS switch.If you want to use EMS simply type the number of Ki lobytes as a value in the line (my config uses 28000 KB). Due to a design bug in emm386you then also have to use the RAM switch to enable the use of the UMB for programs.The D switch defines the maximum number of KB for a DMA transfer. Default value is 32, but some programs want some more DMA buffer. Avalue of 64 should be good.Now the really importand switches x and i. We want to use the memory between A000 and FFFF (UMB). But some of this memory isreserved, so we have to tell emm386 which part it can use. I hope you have tried out the UMBINFO programm and got an overview over yoursystem! (although I think most system should work well with my values, there is no guarantee)We know that memory between A000 and CFFF is reserved for video. And F000 - FFFF is reserved for System BIOS. The memory inbetween is normally not used by any cards you might have installed (except perhaps some very old network cards). So fail save values wouldbe:x=a000-cfff i=d000-efff x=f000-ffff

    emm386 now knows that memory from a000-cfff and f000-ffff should not be used, while d000-efff is ready for programs to be occupied.But I know that on my system (and I think this applies for yours too) my video card only uses memory up to C7FF and my system BIOS startsat F800. So I can modify the line to:x=a000-c7ff i=c800-f7ff x=f800-ffff

    This will get another 64K of RAM !

    Notice that emm386 is normally installed by setup.exe with the highscan switch. Documents claim, that highscan does the same thing we didright know, but I never saw it working. highscan normally uses very little free memory and I suggest you delete it from your emm386 line, nowthat you know how to do it by hand. And there are some more 32K ready. Coders know that text mode starts at B800. But the graphicsmemory ends at AFFF. So what lies in B000-B7FF ??? It is the textmode memory for monchrome graphics cards. If do not have one installedyou can use this memory too, so change to above to:x=a000-afff i=b000-b7ff x=b800-c7ff i=c800-f7ff x=f800-ffff

    (you might have guessed already that I own a hercules card, so I could not use this last line). Some graphic cards I have seen also use b000-b7ff, so this very last optimization might not work for you. You have to try it out.Now, sometimes we want to boot our machine with EMS memory. So we install a second line in our config.sys file with a prepared emm386line, so we can easily rem out the correct driver. The EMS technique needs some memory for a so called page frame. This frame has to belocated somewhere. Its size is 32K. So a fail save EMS line:[EMS in K] ram x=a000-cfff frame=d000 i=d800-efff x=f000-ffff

    however the following should work also:[EMS in K] ram x=a000-c7ff frame=c800 i=d000-f7ff x=f800-ffff

    Or fit it to your needs. Remember that you put your frame address manually to the lowest possible location, so there is the highes amount ofcontinueous memory left.

    After you loaded the emm386 you can use the devicehigh and lh commands. In the config.sys we only need devicehigh. You should now loadall necessary drivers sorted by memory usage. So the biggest driver should be loaded first. You can see that my cd-rom driver needs about8K, while eansi just wants 2K. So cdrom is first followed by eansi.

    The shell option load an alternative command processor (4dos in this case). If you do not want 4dos, ignore this line now.

    4) AUTOEXEC.BAT

    Now it is time to look at the third part in the boot process the autoexec.bat. I have made a copy of mine again:

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDF
  • 8/6/2019 Configuring DOS Properly

    4/6

    @ECHO OFFVERIFY OFFSET COMSPEC=c:\4dos\4dos.comSET TEMP=d:\tempSET TMP=d:\tempSET BLASTER=A220 I5 D1 H5 P300 T6SET SOUND=C:\PROG\SB16SET ULTRASND=240,6,6,11,11SET ULTRADIR=C:\PROG\GUSPATH C:\UTILS;C:\UTILS\P;C:\WINDOWS;C:\WINDOWS\COMMANDPROMPT $p$gC:\PROG\SB16\SB16SET /M:255 /VOC:255 /CD:240 /MIDI:240 /LINE:240C:\PROG\SB16\SBCONFIG.EXE /Slh c:\windows\command\KEYB GR,,C:\WINdows\COMMAND\KEYBOARD.SYS

    IF %WINDIR% == C:\WINDOWS GOTO WEITERC:\PROG\GUS\ULTRINIT.EXE -EJC:\PROG\GUS\ULTRAMIXLH C:\windows\COMMAND\MSCDEX.EXE /D:TEAC /M:0 /L:Ilh c:\utils\logi\mouse.exe dual 1vmode 640-90vmode 800-90vmode 1024-75vmode 1280-75lh c:\utils\univbe:WEITER

    If you never have touched your autoexec.bat I assume it is in a very bad order. So we want to order it at first. Please take some time orderyour file. It will help you in the future when modifying this file again. Often programs insert lines into you autoexec.bat when they installthemselves, although they do not need the information added at all! I normally check my config.sys and autoexec.bat every time I installed newsoftware for modifications. Often these are not needed or the things are already installed, but those stupid setup programs did not scan yourfiles correctly. So some basic understanding of the options described in this file is neccessary. But lets simply start with my autoexec.

    At first you have to know that this file is a normal batch file. So every line behaves just as is you would have typed in on your keyboard.

    @echo offthis line disables the command processor to disable the "key" output. Programm output however is of course not disabled. This optionis personal taste, but most people want this enabled.

    verify offms-dos has an option to check for errors while saving files. But those methods are so badly programes that they are totally useless andonly eat time. So disabling this option can speed up your disk system a bit.

    set compecnormally this evironment variable is set by the system, but noone forbids us to set it manually (and we have to set it when using 4dos). Ifyou do not want to use 4DOS, leave this line out.

    set temp, set tmpset the tmp directory for your system. This option is valid for windows too. By default this is set to c:\windows\temp, but my D: drive issome MBs/second faster than my C: drive, so I set this value to D. I suggest you measure the speed of your hard disks (if you havemore than one) and set the temp directory to the fastest drive. Be sure to create a subdirectory for temp, as the root directory of a drivecan only hold 512 entries !

    set blaster...all other sets are system specific and you should leave them to the values you find in your autoexec.

    pathsets the search path for executables. modify it to your needs

    promptthe basic prompt (my prompt is a little bit more complex and uses the advantages of 4dos, but i deleted it, because it is of no use here)

    All the above mentioned topics have only modified the internal state of the command processor. By now no program has been loaded or cardinitialized etc. I suggest that you order your file in the way that set, prompt, path etc. statements are executed at first. Then the drivers andsetup programs are loaded.

    If you are using Windows95 you will have noticed that you can start a DOS shell from the desktop. Starting this dos shell is a little bit differentfrom booting your system. At first the command processor is loaded and afterwards the autoexec.bat is executed. config.sys is not loaded atall!No here comes a problem. Because there are some drivers, setup programs etc. that do not like to be loaded inside windows (or windowsdoes not like them to be loaded). For example I have installed two sound cards. A sound blaster 16 and a gravis ultrasound. Now the SBsetup programs can be run under windows, while the gravis software does not like to be started with windows in background. So we have tofind a way to determine is windows is started. We make this by asking for the evironment variable WINDIR. If windows is loaded it is set to theappropiate di rectoy, while it simply does not exist, if windows is not loaded at all.So i f you look at my autoexec.bat you see that my keyboard driver is loaded when booting my pc, as well as starting a dos shell in windows.

    The same applies for the initializition of my sound blaster card. But my gravis is only initialized at boot up, together with my mouse and mycdrom. When windows is running the block between the if statement and :weiter is simpy ignored.

    If you load a driver or a tsr program you should always try to load them into the UMB with the lh statement. In my configuration all drivers are

    loading "high". In fact you can load every dos programm high, as long as it fits into the memory left there. If dos recognizes that the programwould not fit into the umb area it is loaded to conventional memory automatically, so you can not make any mistake when using this command.

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDF
  • 8/6/2019 Configuring DOS Properly

    5/6

    5) Comments

    MS-DOS also provides the ability of multi-boot menues or multi configurations. This option will show a nice menu at startup and you canchoose between various configurations. I do NOT recommend the use of it.Simply because I think that 99% of all users do not need multiple configurations if they set up their system properly. And those multiconfiguration are very hard to handle and keep up to date. It is often easier to make a small modification to your config.sys of autoexec.bat forone boot if you need a special setup of something than installing a second boot tree and using it perhaps three times a year.

    Command.com is nice and working. But it is far from being cool. I would suggest everybody to install 4DOS. It completely replacescommand.com and adds dozens of new features to it. If you have installed it once and used it for about 3 hours I bet you never want to use old

    command.com anymore. Watch out for another tutorial on how to use 4DOS, which I will write in the near future.

    6) Smartdrive

    Everyone owns the smartdrive program. This program is nice, but its use can be risky. If you use windows mainly you will not need thisprogramm, since windows has i ts own built in file cache. If you have loaded smartdrive and then start windows windows can not use thememory allocated by smartdrive, so the performance of windows will be infirior than without smartdrive.If you want to use DOS, smartdrive can be of use for you. But today hard disks are so fast, that the speed advantadge of smartdrive is hardlynoticable for normal work. Only when compiling large programs or when copying, deleting, compressing, moving many (small) files smartdrivehas it's use.But be warned that smartdrive by default enables a write back technique. That means that files written to the hard disk will not be writtenimmidiately, but rather when either the cache is full or when smartdrive thinks it would be a good time to do so. But if your system crashes,before smartdrive has flushed its buffer you will have data losses. As write accesses to the FAT of your hard disk are also cached in memory

    you can ruin you entire hard disk! (trust me, I had this once) Of course you can disable the write back strategie, but then smartdrive is close touselessnes. My suggestion is that you do not load smartdrive by default, but rather from command line if you want to make many fileoperations (copy, delete etc). If you have completed your work reboot your machine after a pause of 15sec (to give smartdrive time to flush itsbuffer). After reboot smartdrive is not longer active and you're on the save side again.

    7) Ramdrive

    this relict from times when people had very slow hard disks (or no hard disks at all) is totally outdated today and should not be used!

    8) Windows 95

    Windows has many ways of manipulating the system core. I only suggest one here, because too much damage can be done by twiddling in

    win.ini, system.ini and the registry. If you want to make a new installation of windows95 go to your local newspaper dealer and buy one ofthose "windows magazine" which titles every three month "100 new tricks for improving windows speed". Then apply all those patches andprepare your windows installation cdrom :-)The problem is, that windows is painfully slow and that you can speed up i t to a certain degree. But windows is so complex, that I do notrecommend those tunings. Either buy a faster pc or install a better graphical operating system (unix). But one thing: windows has always abuilt in file cache. Normally windows wants to handle its size, but we all know, that windows is not very clever in doing so. So we set twoboundaries for windows. Open system.ini in you editor and add/modi fy the following three line:

    [vcache]MaxFileCache=4096MinFileCache=1024

    So windows knows that it should assign 4MB file cache maximum and hold 1MB cache whatever happens. Experience showed, that thosetwo values provide the best performance. If you don't trust me you can modify them, but you won't see any better difference.

    9) Full Hard Disks

    Everybody knows the date when their hard disk just has some few MBs left (~5MB). Now we have two possibilites. Delete some programs orbuy a new hard disk. But is i t really neccessary to delete entire programs? No, but mostly you can delete lots of trash those programs haveinstalled. Have you ever had a look how many *.txt *.bmp *.wav *.wri files windows installed in its directories? And we don't need any of them.So delete them.The second step would be to browse through your entire hard disk and search for all readmes, fi le_id.diz, tmp, bak files and I am sure you willfind dozens of MB of crap that exists on your hard disk. Normally you should have some close looks on every now program you install. Mostlyyou get many readme files you never want to read. So delete them Keep your Hard Disk tidy !

    10) Defrag, Scandisk

    Two very usefull programs. If your windows crashes daily (mine certainly does) you normally do not have to load scandisk manually, causewindows does the job for you every time you boot up again after a crash. If you windows runs fine you should start scandisk from time to timeto check for errors. Although those disk errors have reduced dramatically (I remember times from MS-DOS 5.0) they still appear from time totime.Defrag is a nice program too. This can relocate your files physically on your hard disk. The logical directory structure is not affected by thisprogram. This program can be run from time to time too. But you should not expect any speed increase wonders. If you have deleted manyfiles or i f you want to install a new big programm it can be usefull the run this program (after deletion; before installation), as it brings some

    converted by Web2PDFConvert.com

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDF
  • 8/6/2019 Configuring DOS Properly

    6/6

    order to your hard disk. Daily use of defrag is surely overkill.

    2004-06-17 by doj

    http://www.web2pdfconvert.com/?ref=PDFhttp://www.web2pdfconvert.com/?ref=PDFhttp://validator.w3.org/check?uri=referermailto:[email protected]