PC Hardware

Optimizing MS-DOS

Understanding how to configure and optimize an MS-DOS computer might seem like a waste of time in view of the newer operating systems available like Windows 95, Windows 98, Windows NT, and Windows 2000; however, one must remember that MS-DOS is the basic building block of the operating environment for the vast majority of IBM-compatible computers. All IBM-compatible computers today have evolved from this standard. The limitations imposed by MS-DOS and the need to provide backward compatibility have a lot to do with how today's computers operate.

Configuring MS-DOS

As mentioned in Lesson 1, the job of configuring how MS-DOS runs on a specific computer is done by modifying the CONFIG.SYS and AUTOEXEC.BAT files. During the boot process, MS-DOS looks for these files and executes any commands or loads any drivers properly called for within them. The CONFIG.SYS file is run first and sets up and configures the computer's hardware components. The AUTOEXEC.BAT file executes commands and loads TSR programs.

NOTE
TSRs are used for a wide variety of tasks in MS-DOS and almost always realign the memory stack. This can quickly lead to problems with the operating environment if they do not behave well, escalating exponentially with each additional TSR. If you run into strange problems, the first place to look is in the TSR used on the system.

If problems are encountered during startup, the CONFIG.SYS and AUTOEXEC.BAT files can be bypassed by pressing F5 as soon as the message "Starting MS-DOS" appears on the screen. Alternatively, pressing F8 will allow processing the files one command at a time (with the option to bypass specific commands), making troubleshooting possible. If you bypass a command and the computer boots, you have isolated the problem.

CONFIG.SYS Commands

The following table lists several CONFIG.SYS settings and their functions.

Setting Function
BUFFERS Allocates reserved memory for transferring information to and from the hard disk.
COUNTRY Enables MS-DOS to use country conventions for times, dates, and currency. Example: COUNTRY=044,437,C:\DOS\COUNTRY.SYS (You do not need to use this in the United States unless you wish to use an alternate convention.)
DEVICE Loads a device driver into memory. DEVICE=C:\DOS\EMM386.EXE
DEVICEHIGH Loads a device driver into upper memory.
MS-DOS Loads part of MS-DOS into upper memory area. DOS=HIGH, UMB
FCBS Specifies the number of file control blocks (FCBS) that MS-DOS can have open at the same time.
FILES Specifies the number of files that MS-DOS can hold open concurrently. FILES=60
INSTALL Loads a memory-resident program. INSTALL=C:\DOS\SHARE.EXE/F:500 /L:500
LASTDRIVE Specifies the maximum number of drives the computer can access. LASTDRIVE=Z
MOUSE.SYS Loads a mouse driver.
NUMLOCK Specifies whether the NUM LOCK key is on or off when MS-DOS starts.
SHELL Specifies the name and location of the command interpreter. The interpreter converts the typed command to an action. The default for MS-DOS is COMMAND.COM.
SWITCHES Specifies special options in MS-DOS. The /N switch will disable the use of the F5 and F8 keys to bypass startup commands (used for security).

Here is a sample CONFIG.SYS listing:

  DEVICE=C:\WINDOWS\HIMEM.SYS
  DEVICE=C:\DOS\EMM386.EXE NOEMS
  DOS=HIGH, UMB
  BUFFERS=20
  FILES=80
  FCBS=4,0
  LASTDRIVE=Z
  DEVICE=C:\CDROM\NEC2.SYS /D:MSCD001 /V

AUTOEXEC.BAT Commands

The following table lists several commands that you'll find in the AUTOEXEC.BAT file.

ECHO Displays commands as they are executed. @ECHO OFF: Suppresses the display of commands as they are executed.
PAUSE Stops the execution of AUTOEXEC.BAT and displays the message "Strike any key to continue."
PATH Defines the search path for program commands.
SET Displays, sets, or removes MS-DOS environment variables.
SMARTDRV Provides disk caching.
KEYB Configures a keyboard for a specific language.
SHARE Starts the Share program, which will install the file sharing and locking capabilities.
DOSKEY Loads the DOSKEY program. You can use the DOSKEY program to view, edit, and carry out MS-DOS commands that you have used previously.
MOUSE.EXE Loads a mouse driver.
PROMPT Sets the display of the command prompt.

Here is a sample AUTOEXEC.BAT listing:

 @ECHO OFF
  PATH C:\DOS;C:\WINDOWS;C:\
  DOSKEY
  SMARTDRV
  UNDELETE /LOAD
  VSAFE
  MSAV
TIP
Here are a couple of useful tricks to try when working with CONFIG.SYS and AUTOEXEC.BAT. If you want the computer to ignore a command line, enter REM before that statement. For example: rem mouse.exe would tell the computer to ignore that line and the MOUSE.EXE file would not be loaded. Before editing existing CONFIG.SYS or AUTOEXEC.BAT files, copy them to a different directory or make a copy of each, but with a .OLD extension to the filename (AUTOEXEC.OLD and CONFIG.OLD). This way, you will have the current configuration data at hand if something goes amiss.

Optimizing Memory

As discussed in Tutorial 7, the original processors developed by Intel were unable to use more than 1 MB of RAM. Therefore, MS-DOS applications were written to conform to this limitation. As application requirements grew, a means of optimizing the use of memory was required in order to get the most out of the space available. This 1 MB of memory was divided into two sections; 384 KB of RAM (designated upper memory) was designated for running the computer (BIOS and video RAM and ROM), and 640 KB was reserved for applications, designated conventional memory. (See Figure 15.1.)

Figure 15.1 Memory map

The MS-DOS limitation means it is essential that the 640 KB area be kept as free as possible. MS-DOS memory optimization ensures that MS-DOS applications have as much of this memory as possible. Lesson 2 of Tutorial 7 provides a detailed look at the types of memory used by MS-DOS and Windows. Please refer to that section for a fuller discussion.

The MS-DOS command MEM (MEM.EXE) provides information about the amount and type of memory available. (See Figure 15.2.)

Click to view at full size.

Figure 15.2 MEM Command

The bottom line in optimization of memory for MS-DOS programs is that they require conventional memory in order to run, and conventional memory is in short supply. You can make more conventional memory available to your programs by minimizing how much memory MS-DOS, installable device drivers, and other memory-resident programs use. There are several ways to free conventional memory for use by programs:

  • Run MS-DOS in extended memory instead of conventional memory.

  • Streamline the CONFIG.SYS and AUTOEXEC.BAT files so they don't start unnecessary memory-resident programs.

  • Run device drivers and other memory-resident programs in the upper memory area instead of in conventional memory.