Setting up an old DOS computer for 'C' Programming
User Rating: / 3
Written by Bryce Ringwood   

An elderly PC can be used to to demonstrate many of the things that are popularly done with an Arduino or Microchip PIC processor.  It can be used to interface to many electronics projects and also to learn how to write the sort of 'C' programs that were around before they suddenly got called "Apps". If you are going to use the PC/104 instead - be sure to get one with a VGA adaptor and all the ports.

Here, I have chosen to use an MS-DOS based operating system rather than LINUX/UNIX. This could cause problems, since MS-DOS is a commercial operating system and has to be paid for. If you are using a computer from your attic, it probably has a version of DOS. If not, try using "FreeDOS".  MS-DOS 7.1 is available for download - but you probably should have a legal Windows 98 installation CD to use it legally. (Although I encourage the use of free or open-source software, I don't encourage software piracy.)

The chosen computer will most likely be one that was hoarded away - in my case an old 486 laptop. It needs to have an "RS 232" serial port (9 pin or 25 pin) and (preferably bi-directional parallel printer port. Alas, you can't use a modern computer and plug serial to usb and parallel to usb adapters into it, because as far as I know there are no MS-DOS drivers for them. You just might get away with it if you are running Windows 95/98 or DOS 7.x, but I have never tried to use them.
Since you need to communicate with your other modern computer, both will need a "stiffy" (South African for 1.44MB diskete) or CDROM drive. Hurry down to your stationers before the last stiffy gets sold.
Before you begin, It might be a good idea to make sure everything still works, clean up the hard disk and do a fresh installation, or at least clear away any unwanted programs and data. See below for instructions on installing MS-DOS.
The next step is to install Turbo C. Turbo C is now free from The integrated development environment TC can also be used as a straight DOS editor. MS-DOS's Edlin is not a good option.( Actually, its not an option.)
Turbo C allows you to access the PC hardware via ports (Not TCP/IP ports).  If you are just interested in starting with 'C', then simply download and install C++ Visual Studio Express edition from Microsoft for your modern computer. It is also free.  
Terminal emulator software
If you are experimenting with the PIC, you might also want to download my terminal emulator for the PC. You will have to set the com port with the MS-DOS command :
C:\> mode com1:9600,n,8,1
This will set the com port to the correct baud rate, parity and other settings. (9600 baud, no parity, 8 bits, 1 stop bit). Of course, you can also use hyperterminal on Windows XP, provided your PC has a serial port.
Printed Circuit Design Software
The other program you might want to install is Tango PCB for printed circuit layouts- now believed to be 'abandonware'. Unfortunately the MS-DOS program "Smartwork" is not free or abandoned - it is probably one of the nicest programs for the amateur to use for PC design.

About MS-DOS

It occurs to me that  some people reading this might not be familiar with MS-DOS, what it is, how to use it and so on.  I guess anyone under about 45 years old won't have had much to do with it. MS-DOS is an operating system (MicroSoft Disk Operating System) originally developed for the IBM personal computer in 1981 and launched with the IBM PC in 1982. In common with most computers at that time, the PC used a "Command Line Interface" (CLI), as opposed to a "Graphical User Interface" (GUI) like the various Microsoft Windows or UNIX desktop environments. Note that at the same time MS-DOS was introduced, there were already Windowing type operating systems for the XEROX  Star and Apple Lisa computers.

Computers like the Arduino and PIC don't really need an operating system as such, since they are normally programmed to do just one thing every time they are switched on. The business of loading and compiling programs is all undertaken by the host computer used for development.


It s the job of the operating system to manage the computer, in terms of what the various devices attached to it can do at any given time. Think of it as you talking to the CLI through a keyboard, and the CLI relaying your command to the operating system, which decides whether the computer can do what you tell it, and then sending the result to the screen. It must also manage the information stored on disk files. DOS maintains a files system having directories which contain the various files. Disks have drive letters, such as A:, B: C: etc. The hard disk usually being C: These are the root directories, which can contain other files and directories. File and directory names can have a maximum of 8 characters followed by a dot "." and then an up to three letter extension. Files with a .com or .exe extension are executable files - nowadays we call them "APPS" - but they are computer programs.


The operating system commands were often stored as routines in the computer memory, and were loaded at "boot time" , or were small programs loaded from disk when they were typed in. Most commands had optional parameters to modify their behaviour. For example, typing DIR at the command prompt would result in listing all the files in a directory (Nowadays called a "folder"), whereas typing DIR /S  would give a sorted listing of the files, and so on. Although the commands had to be committed to memory (Yours! - not the computers), most were fairly obvious:

Command Description
DIR Provides a list of files within a directory
COPY fn1 fn2 copies the contents of one file to a new file
DEL fn deletes a file
REN fn renames a file
CHDIR (or CD) dn changes to a new directory
Drive Letter followed by: e.g. A: changes to a new drive
Name executes an app called name.
where fn stands for filename and dn stands for directory name.
Later versions of MS-DOS had a help command, which would list all the commands available. Typing command name followed by "?" would provide details fo the command.
MS-DOS provides several utility programs. The first of these being an editor. Early versions of DOS provided "EDLIN" - a line editor requiring some perseverance. This was followed by "EDIT" in later versions. This was a simple  to use full screen editor.
GW-BASIC (or BASICA) for the IBM PC) were provided to allow users to write their own programs - yes you could write your own apps. Unthinkable. BASICA was the IBM PC version of BASIC contained in the PCs BIOS chip. (The chip that manages the CPU, basically). GW-BASIC had a profound influence on a generation of programmers and hobbyists. For radio enthusiasts - please download HAMCALC and marvel at what GW-BASIC can do. GW-BASIC was replaced by QBasic in MS-DOS 5, and was pretty intertwined with the EDIT editor.
Finally DEBUG was provided to allow those of a very technical bent to do the most amazing things without having to purchase an assembler. DEBUG is still around and works under Windows 7 in a command prompt window.
Some versions of DOS were shipped with Microsoft's Macro-Assembler - it wasn't very expensive to buy in any case.
Batch Files
Files with a .bat extension were text files containing lists of commands. When the name of the file was typed on the command line, the commands in the file would be executed one after the other. Batch files also could contain "goto" statements for branching to a new execution path and could also contain symbols that would be replaced by parameters to the batch file.
For example, early DOSes did not have a MOVE command to move one file to another location.
This could be implemented as MOVE.BAT, as follows
COPY %1 %2
DEL %1
The command
MOVE yourfile myfile
would take the contents of yourfile and copy them to myfile, finally deleting myfile.
MS-DOS Manuals
These turn up all the time at old bookshops, jumble sales etc. I tried to find a manual on-line, but so far no luck.  This site has all the commands. There is also a site for the Tandy 1000 that has the MSDOS user guide in .pdf format for MSDOS 3.22 here.
The command prompt for Windows versions from NT onwards to Windows 8 is a DOS emulator for Microsofts 32-bit (or more) operating systems. Whilst some of the older 16-bit programs will run, many won't because Windows NT doesn't want you to do things like accessing the ports directly. In particular, theprogram examples given here will not work.
Installing MS-DOS for the first time.
You will need a computer with a hard disk and a floppy disk drive to suit your installation disk set. The maximum size of hard drive you can use is 4Gb (Theoretically - but because of bugs in some setup programs, the maximum practical size you should use is 2Gb.) In the example, I will be using a 16Mb hard drive. (YES that's Mb). You should aim for a machine with at least 640k of RAM.  I will be using a machine with an 80486 processor in the example.
The setup process involves a number of steps, as follows:-
  1. Low level format of the hard disk. This might be needed to REALLY remove traces of a previous operating system. Try to avoid this step, if possible. This lays out the geometry of the tracks and sectors on the drive. Do not use it on modern disk drives.
  2. Partitioning - This slices up the drive into separate areas for the the same or different file systems on the disk. You might have MSDOS in one partition and LINUX in another - and so on. I am going to assume we have just one partition, which we will call the C: partition.
  3. Formatting - This lays out the file system on the disk drive. It erases all the information on the drive.  In our case, it will provide space for the file allocation tables needed to define where files are stored.
  4. Copying the operating system files.
  5. Configuring the operating system to work the way we want it.

In MS-DOSes up ti DOS 5, all this has to be done manually. After DOS 4, Microsoft introduced a SETUP program on their distribution disks, which automatically takes you through the process.

Step 1

Don't do this unless you really have to - for example you can't complete steps 2 or 3. You will need a third part low-level format tool, and run it from the floppy drive. Pray that you haven't destroyed the disk....

Step 2 

Insert the first MS-DOS disk and run the FDISK utility. Type "A:" then "FDISK" at the command prompt .

Select option 1.

1. Create DOS partition or Logical DOS Drive
fdisk program (other options) 

The utility will ask:

Do you wish to use the maximum available size for primary DOS partition?

IF you are using DOS 5 and later SETUP program, you may get the same option menu. Reply 'Y',then press the ESC key twice to quit the program when it has finished.

Step 3- Formatting

From the command prompt, you need to enter the FORMAT command, as follows:


The letter /V signifies the verify option (checks the format is good) and the /S option transfers the basic operating system to the hard drive.formatting a hard drive

The command will end by asking you if you want to type in a label for the disk after it has given you a bit of info on the health of the disk. If the disk is bad - format will refuse to work.

At this point, you will be able to boot from the hard disk and the commands contained inside "COMMAND.COM" will be available.

Step 4 - Copying the operating system files.

If you're running setup, the program will do this for you. Otherwise, you need to make a DOS directory, and manually copy all the files.

At the command prompt type:

C:>mkdir dos

If this does not work for some reason - don't worry. This will create a dos sub-directory.

Now copy all the files on your installation disks into it.Type:

C:cd dos


A:>copy *.* c: (repeat for as many install disks as you have got.

(If you failed to create the dos directory - all the files will be in the root C: )

Step 5 - Configuring

(If using the setup program, setup will do this for you.)Setup

You need an editor. I will put the highly politically incorrect on my download page. PLEASE ignore the propaganda that comes with it. Just copy it to your root directory and use it to edit the config.sys and autoexec.bat files.

config.sys needs the following lines added:

FILES = 50






autoexec.bat needs:

path=c:;c:\dos (or omit "c:\dos" if you don't have a \dos directory)


That's it - you're done!! You're welcome to email me if you have a problem. I can't guarantee to solve it though.

I hope you're not using a computer like this one:

A very messy DOS computer
PC104 Computer Running Dos


Installing Turbo C

After downloading, you should have three folders labelled "Disk1", "Disk2", "Disk3". Copy the contents of these on to three separate diskettes. In my case the installation program was on the second disk. Make a note of which disk has the install program "install.exe".

Insert this disk into the diskette drive and type:



The install program will begin - just accept the default values at all the prompts.




Joomla template by a4joomla