Or, Setting up DJGPP on DOSBox.
For one reason or another, it is required to use a piece of software that has fallen out of compatibility with new software. For example, in my class I am required to use the DJGPP development kit, a piece of software built for MS-DOS. Naturally, as Microsoft Windows moved away from using MS-DOS as a backend, this has stopped working properly natively.
Fortunately, technology has been created to re-create an environment much like these past operating systems. For example, FreeDOS is an open-source DOS environment. In addition, DOSBox is another open-source project, this time to provide an environment to run games built for MS-DOS. I will exploit this environment to create a software development environment that mimics a system of about 15 years ago.
To start, grab a DOSBox installer. I will write these instructions assuming a Windows system, but DOSBox has been ported to many operating systems. Install DOSBox using the recommended settings. The installation should take a short amount of time.
At this time, you can grab files from the DJGPP website. Using their “ZIP Picker” tool, you are given only the files you need. You may want to pick “Windows 2000/XP” or “DOSEMU” as the OS, because then you are shown the program unzip32.exe, which we will make use of.
Place all the ZIP files, as well as unzip32.exe, in a folder on the root of a drive. I had them in c:\dosbox\djgpp. The reason we need a new folder is that DOS’s main limitation was the length of file and folder names. You could only have a folder name of 8 letters, and a filename with 8 characters with a three letter extension. That’s why I keep a separate folder for DOSBox to interact with.
Open DOSBox. The first thing that’s different from a DOS prompt is that you start in the Z drive. The Z drive is a custom folder DOSBox uses to keep all its utilities. We don’t need to worry about the Z drive. Instead, type “mount c c:\dosbox” and press Enter. (If you used a different folder than c:\dosbox to hold your files, put that path instead.) “Mount” is a utility that DOSBox uses to make parts of the Windows system available to the DOS system. Go ahead and move into the newly-formed C drive by typing “C:” into the prompt. Move into the folder that you placed the ZIP files in by typing “cd” followed by a space and the folder name. In my case, I would type “cd djgpp”.
Now, we will unpack the ZIP files. Type “unzip32.exe ” and then the name of one of the ZIP files. You can start typing one’s name, then press Tab and the filename will be automatically completed for you. Do this for all the ZIP files.
(You could use a ZIP opener outside DOSBox to do this, but DJGPP makes what amounts to a huge fuss about the necessity of the short file names. The thing is, the file and folder structure within each file is such that the short filenames are already present. I didn’t use a Windows program, but I don’t imagine that it would matter.)
With that finished, all it takes is to set up DOSBox to automatically use the DJGPP files.
On the most recent version of DOSBox, the main configuration file in Windows has been moved to the %USERPROFILE%\AppData folder. However, a link to edit the configuration file has been placed in the start menu upon installation, under Programs > DOSBox-0.73 > Configuration > Edit Configuration. Open the configuration file.
At the bottom, there is a heading named [autoexec]. Under this section is the list of commands that are executed when DOSBox starts. On a fresh installation, this section is empty. At the bottom of the file, write these lines:
mount c c:\dosbox
set path=c:\djgpp\bin\;%PATH%
set djgpp=c:\djgpp\djgpp.env
(If you unzipped the files into a directory other than c:\dosbox\djgpp, these lines will need to change to fit. In short, PATH must point to the bin folder in the djgpp installation, and djgpp must point to the djgpp.env file in the installation.)
The PATH environment variable is something Windows (and, I’m sure, other OS’s) use to make sure that at any folder in the system, you can run a program located at a certain (but other) location. In this case, you can run a compiler or editor on a file anywhere in the system.
In any case, if you’ve gotten this far, you’ve finished. You can now use DJGPP to compile DOS programs. Enjoy your ability to write software for a depreciated platform.
(Extra instructions for those in my class: the nasm.zip file that contains the nasm assembler can be placed in a folder on the path. In my case, I put it on my Windows drive at c:\dosutil, which I mount on K: in DOSBox. My [autoexec] has an extra line: “mount k c:\dosutil”, and my PATH is set to “c:\djgpp\bin\;k:\;%PATH%”. You now have the full development environment needed for the class.)