A Guide to DOS Startup Files
From MS-DOS v1.0 through to 6.22, MS-DOS could start with as little as three files on a bootable disk:
- IO.SYS
- MSDOS.SYS
- COMMAND.COM
The first two hold the main disk operating system, and the third is the command interpreter. IBM's version was the same except the first two files were called IBMBIO.SYS and IBMDOS.SYS. The .SYS files usually have their 'hidden' file attribute switched on, so a typical 'dir' statement won't necessarily display these (you can use "dir /ah" to display files including hidden ones).
The Boot Process
The boot process on most PCs after the power-on self test ("POST") comprises checking all drives for a Master Boot Record (MBR) in which boot code exists. Once found, that boot code is executed. This code searches for an extended DOS partition, and then determines if there is a bootable partition specified in the partition table. If no boot partitions are marked as 'active' the boot process will terminate with an error. If one is found, the master or volume boot sector is loaded into memory and tested, and the boot code that it contains is given control of the remainer of the boot process. The DOS boot code searches the root directory of the device being booted for the operating system files (the three mentioned above). IO.SYS is executed first, and this then runs MSDOS.SYS.
DOS has the concept of internal commands and external commands. Put simply, internal commands are those that are built into, and therefore recognised by, the COMMAND.COM command interpreter. You can run these internal commands without any other 'external' files being present. An example of this is the 'DIR' command, to list the directory. External commands are simply those that have their own file, such as 'XCOPY'.
After DOS is loaded, two files are searched for in the root directory: CONFIG.SYS followed by AUTOEXEC.BAT. These are executed in that order. From DOS 6.0 onwards, pressing F5 before the boot process reaches this point skips execution. Alternatively, pressing F8 allows the user to choose line by line which commands to execute and which to skip.
CONFIG.SYS
CONFIG.SYS is a text file containing DOS commands to inform the operating system how the system is set up. More specifically, CONFIG.SYS commands specify memory device drivers and programs that control hardware devices; enable or disable system features; and set limits on system resources. CONFIG.SYS loads at startup before the autoexec.bat (automatic execute.batch program) file. Because CONFIG.SYS is a text file, it is editable in any text-editing program.
DOS Memory
An unfortunate legacy of the original IBM PC's architecture is that the accessible portion of memory for running programs is limited to just 640 KB. This is known as 'base memory', 'lower memory' or 'conventional memory'. Without running any device drivers, DOS cannot see any memory above the first 640 KB, regardless of how much memory is physically installed in your computer.
The 384 KB block of memory above this is called the Upper Memory Area (UMA). The PC architecture has this area reserved for system use, storing a copy of the ROM BIOS and BIOS extensions for fixed disk drives and video adapters. The IBM CGA video card used this area for its video memory. Because these BIOS extensions typically used to have fixed memory locations within the UMA, and not all memory locations were used up by manufacturers, this left gaps of memory in the UMA that remained unused. MS-DOS 5.0 introduced what are called Upper Memory Blocks (UMBs) to allow these unused areas of memory to be used for loading device drivers which helped keep conventional memory free for running programs. Note: 80286 and earlier PCs don't have the means to enable UMBs. One exception to this is the Chips & Technologies 286 NEAT chipset.
Above the 1 MB mark, all memory is in the High Memory Area (HMA). This is usually configured (via CONFIG.SYS and AUTOEXEC.BAT) as either Extended Memory (XMS) or Expanded Memory (EMS). Some programs require XMS while others require EMS.
Confused? Don't worry - this guide will help you through.
Because of the 640 KB conventional memory limit in DOS, it is often a challenge to get the maximum amount of free memory available for running your programs after all the device drivers have been loaded. As such, CONFIG.SYS files often begin with these lines:
Line in CONFIG.SYS | Purpose |
---|---|
DEVICE=HIMEM.SYS | Loads the high memory manager, which provides access to memory above the first 1 MB.* |
DOS=HIGH,UMB | Loads the DOS kernel code into high memory, and instructs the operating system to manage upper memory blocks. |
DEVICE=EMM386.EXE NOEMS | Loads the expanded memory manager which also provides access to the upper memory area.** The 'NOEMS' argument means set it up as XMS. Changing this to 'RAM' means set it up as EMS. |
*In DR-DOS, HIMEM.SYS is called HIDOS.SYS. HIMEM.SYS is only available from MS-DOS 5.0+
**EMM386.SYS in MS-DOS 4.01. From MS-DOS 5.0 onwards it was called EMM386.EXE
DEVICE=HIMEM.SYS
Loads the high memory manager which provides access to memory above the first 1 MB.Once this is loaded, subsequent lines in CONFIG.SYS can use DEVICEHIGH= to instruct the operating system to load the device driver into high memory instead of conventional memory. You can also use the LOADHIGH or LH command in AUTOEXEC.BAT to load executable files into high memory as well.
On 80286 systems, HIMEM.SYS enables XMS (except UMBs) up to a maximum of 15 MB. For 80386 and higher systems, up to 1023 MB of XMS can be enabled.
DOS=[HIGH|LOW],[UMB|NOUMB]
Used in the CONFIG.SYS file to specify the memory location for the DOS kernel. This command requires HIMEM.SYS (or equivalent high memory manager) to be loaded first.HIGH= load DOS into high memory (above 1 MB)
LOW=load DOS into conventional memory (0-640 KB). This is the default.
UMB=Tells DOS that it should manage upper memory blocks (UMB) created by an UMB provider such as EMM386.EXE. The default is NOUMB.
DEVICE=EMM386.EXE [on|off|auto] [memory] [min=size] [w=on|off] [noems|RAM] [I=B000-B7FF]...
Used in the CONFIG.SYS file to specify the memory location for the DOS kernel.
[ON|OFF|AUTO] activates|suspends the driver, or puts it into auto mode (activates only when a program calls for it)
[MEMORY]
specifies the maximum amount of extended memory (in KB) that you want EMM386 to provide as expanded memory. This amount is in addition to the memory used for UMBs and EMM386 itself. Values are in the range 64 through the lesser of either 32768 or the amount of extended memory available. The default is the amount of free extended memory.
NOEMS provides access to the upper memory area (UMA) but disables the expanded memory buffer. Using NOEMS frees up a full 64 KB of upper memory blocks for your use, so if you don't need EMS definitely use this.
RAM tells the driver
to configure for expanded memory (EMS).
I=B000-B7FF tells EMM386 to also make use of the memory area from B000 to B7FF, which used to be the monochrome video memory area. Since colour graphics cards now display even black & white text in their own buffer, this area can also be used for other programs. By default (without this argument), EMM386 will not make use of this area. This gives you back 32 KB of conventional memory.
DEVICE=DISPLAY.SYS CON=(type,HWCP,n)
DISPLAY.SYS allows DOS to display international character sets on EGA, VGA or LCD monitors. See our section on DOS for International Use.
TYPE tells the driver what type of display you have. Valid values are EGA or LCD (the EGA setting includes VGA). If you omit this, the driver will attempt to detect which display adapter is in use. It also accepts CGA and MONO as values here, but these have no effect as character switching is not enabled for these devices.
HWCP specifies the codepage (the unique number of the character set) that your hardware supports. MS-DOS supports the following codepages:
437 - USA
850 - Multilingual (Latin I)
852 - Slavic (Latin II)
860 - Portuguese
863 - Canadian-French
865 - Nordic
Additional character sets are supported by the EGA2.CPI and EGA3.CPI files. For more details, see the COUNTRY.TXT file in your MS-DOS directory.
N specifies the number of character sets your hardware can support in addition to the primary character set you've chosen in the HWCP setting. Valid values are in the range 0 through 6 for EGA adapters; for LCD the maximum value is 1.