The magazine of the Melbourne PC User Group

In the Beginning....
Tom Coleman

I recently had a query asking me where the CONFIG.SYS and AUTOEXEC.BAT files fit into the system booting. I got carried away with myself when replying. After I had finished, I thought it might provide some information for those just coming into computing.

With regard to AUTOEXEC.BAT and CONFIG.SYS, it is more meaningful to describe these two files in terms of where they fit in to the start up sequence.

When you turn the power on, the computer's power supply converts 240 volt AC into 5 and 12 volt DC. When the motherboard powers up, a chip called the BIOS comes into play. Some times this chip is called the ROM BIOS. (Read Only Memory Basic Input Output System). This chip has a built in program that does the first part of the start up. It. sets up parts of memory for some functions and various simple but essential house keeping chores. It also checks the keyboard and video and so on, looking to see that it is all responding correctly. You can see it on screen doing the memory check.

Just about the last thing that this chip does is try to read a disk in drive A:. If there is a disk in drive A:, it will try to run the start up files. If there are no start up files, in other words it is not a boot disk, then you get the message "Non System Disk".

Usually there is no disk in drive A:, so it has a try with drive C:. If that does not work it displays an error message and stops.

Regardless of which drive is used to run the start up files, pretty much the same thing happens.

Lets sidetrack for a minute.

The information on the disk is recorded in the same way as music on a tape-magnetic pulses. The tracks are laid down as concentric rings. One circle inside another, not one continuous stripe spiralling inwards as on a record. Each of these circles, called tracks, is broken into separate segments called sectors. Different disks have different numbers of tracks and segments per track. A 360 kB floppy has 40 tracks and 9 sectors per track. A 20 MB hard disk might have 614 tracks and 17 sectors per track. It varies.

Regardless of the size of the disk the first sector on the first side is set aside to hold information about the disk, such as the number of sectors and tracks and other technical information. Each time the computer accesses the disk it reads this sector. It is called the Boot Sector and all disks must have one or the computer has no source of information about the kind of disk it is dealing with.

The next few sectors are allocated to the File Allocation Table (the FAT) and then some to the Directory Area. The FAT is like the page numbers on the Contents page of a book, it says where files are located. The Directory Area corresponds to the names of the chapters in a book, in other words the files on the disk. There is a lot of other information in the Directory area - you can view it by typing in DIR in the root directory. The DIR command simply reads the Directory Area. It does not go hunting all over the disk looking for files.

On a boot disk - a start up disk - floppy or hard, the next few sectors contain two hidden files called something like IO.SYS and MSDOS.SYS. Hidden files do not show with the DIR command. These files must be physically located immediately after the end of the Directory Area. If they get moved anywhere else the computer cannot find them and so you cannot start from that disk.

These two hidden files contain lots of housekeeping routines and instructions about how things will get done.

Once the hidden files are loaded the computer goes looking for a file called CONFIG.SYS. This file contains various routines and files to set up the computer in the particular way that the operator wants. You write the CONFIG.SYS. You tell the computer that this is AUSTRALIA and the date is DD-MM-YY. You set aside portions of memory for file handles and internal file buffers and so on. You can load in extended and expanded memory drivers.

Drivers are like tools in the toolshed. If you don't have a lawnmower in the toolshed you can't mow the lawn. If you don't have a mouse driver in your CONFIG.SYS then you can't use your mouse.

If there is no CONFIG.SYS then a few default values (these are totally inadequate) are given to Files and Buffers and the computer goes looking for COMMAND.COM.

COMMAND.COM contains all the internal DOS commands, COPY, DIR. TYYPE, CD and so on. If there is no COMMAND.COM the startup fails with a "BAD OR MISSING COMMAND INTERPRETER" error message.

The last thing that COMMAND.COM does is it tries to run a file called AUTOEXEC.BAT. If it cannot find it then it prompts for the date and the time and that's an end of the start up.

If it finds AUTOEXEC.BAT then it executes it. The AUTOEXEC.BAT file is just another batch file. There is nothing fancy or special about it except that it is automatically executed at start up. It can be executed from the command line any time you like just like any other batch file. Try it. Type in AUTOEXEC while in the root directory. It will execute the AUTOEXEC.BAT file.

It is almost true to say that a batch file is a file that contains commands that you would otherwise have to type in at the keyboard. That is what a batch file is in its simplest form. However there is a primitive batch file language which enables you to tweak it a bit here and there.

The AUTOEXEC.BAT has all those commands that you would have to type in at start up if it was not there. It executes a bundle of them as a single batch job.

This is where you load in your screen saver and your TSRs. You set your PATH and configure your PROMPT and all those thing. Finally it loads your menu (Horrors! I am a command line advocate).

Once the AUTOEXEC.BAT is finished you will get your DOS prompt unless you have started up another program from your AUTOEXEC.BAT

The best way to get to know what your CONFIG.SYS and AUTOEXEC.BAT are doing is to bring them up in the screen or print then out and study each line. Each line is a different command. Some you will be able to understand. Others seem vaguely familiar and others are a mystery. Look up the familiar ones in an appropriate reference and consult with other users about the mysteries.

Reprinted from the July 1992 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[About Melbourne PC User Group]