Running DBase III+ in Ubuntu

Not many use it anymore (because its 2015!). But DOS used to be a wide spread operating system for computers around the world until the late 1990’s. The robust operating system served as a sturdy backbone to earlier versions of Microsoft Windows, until Windows XP became popular. So popular that many users who could not afford to let go of DOS applications earlier are still using it to mediate between the old ways and the new ones. A project with one such user got me back to working with DOS. Well, not exactly. But more like getting DOS to work in the new environments! Of course, there was more than one challenge. My client had DBase III+ DOS program which they needed to use until their new ingenious system was launched. The network had a mixture of Linux and Windows machines and the application was to be run from both. I ended up using DosBox over a VMWare virtual machine mainly since the DOS application did not work very nicely in the virtual machine. My next option was dosemu, a light weight dos emulator for ubuntu. It satisfied all my requirements; it had parallel port and printing support and also supported spooling dos print to USB and network printers. However, after I installed dosemu, i found out that it worked only if the DOS program did not manipulate parallel ports directly. Dbase III+ does. This results in a “printer not ready” error when we try to print from Dbase running in dosemu. Dosemu has an option to let dos control ports directly, however, this limits dbase to printing to parallel port printers only. Hence, I moved to my next option, DosBox. In this blog article, I summarize the steps in getting DBase III+ to work with printing support on Ubuntu 14.04.

Step I – Download Dosbox.

To download and install dosbox from the latest repository –

$ sudo apt-get install dosbox

However, to have printing and parallel port support, we will need the Dosbox megabuild. This can be obtained here. I am using the Megabuild 6 Source code for building in linux.

Step II – Install dependencies and dosbox

Let’s start by downloading the dependencies.

$ sudo apt-get install build-essential automake libsdl-net1.2-dev libsdl-sound1.2-dev libfreetype6 libfreetype6-dev

Next, we download the source code.

$ cd
$ mkdir dosbox_src
$ cd dosbox_src
$ wget "http://source.dosbox.com/mb6/dosbox-mb6.tar.gz"
$ tar -zxvf dosbox-mb6.tar.gz

Great. Now that we have the source code, we need to build it. However, the code won’t compile as is. Its been a while since the code was built and Ubuntu has undergone changes. We need to modify a few files. For each of the following three files –

  1. dosbox-mb6/src/cpu/cpu.cpp
  2. dosbox-mb6/src/dos/dos.cpp
  3. dosbox-mb6/src/ints/ems.cpp

Add the following line, as the first include in the cpp file –

#include <stddef.h>

Next, modify dosbox-mb6/include/dos_inc.h to look as follows –

...
#include "Mem.h"
#endif

#include <stddef.h>

#ifdef _MSC_VER
#pragma pack (1)
#endif
...

If you are compiling on a 64-bit Ubuntu,open the file the file dosbox-mb6/src/cpu/core_dynrec/decoder_basic.h and comment out the code as shown. This part is not required for 32 bit systems.

if (handler-> flags & PFLAG_NOCODE) 
   {/* if (PAGING_ForcePageInit (lin_addr)) 
         {trades = get_tlb_readhandler (lin_addr); 
         if (handler-> flags & PFLAG_HASCODE) 
           {cph = (CodePageHandlerDynRec *) trades; 
           return false;}} 
    */  
       if (handler-> flags & PFLAG_NOCODE) 
         {LOG_MSG ("DYNREC: Can not run code in this page"); 
       cph = 0; 
       return false;}}

All set. Now we simply build the source code

$ cd
$ cd dosbox_src/dosbox-mb6
$ chmod +x autogen.sh
$ sudo ./autogen.sh
$ ./configure
$ make
$ sudo make install

Great. Now we can test drop box by running –

$ dosbox

Step III – Configure DosBox

Now that dosbox is working, we will need to configure dosbox to mount the home folder on start (I assume DBase III+ resides on the Linux Home folder). Open Dosbox and type the following at the prompt –

Z:\> config -writeconf /home/<your username>/dosbox.conf

Close dosbox and open /home/<your username>/dosbox.conf in your text editor. Scroll to the end of the file to the [autoexec] section and change it so it looks like  –

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount c /home/<your username>
c:

We could also add the following to run dbase directly (assuming that dbase lies on your home folder.

cd dbase
dbase

You could add dosbox to your desktop as an icon and name it Dbase.

Step IV – Printer Support

Open the dosbox.conf file we created in step III. Scroll to the [parallel] section. And change it to look like the following –

[parallel]
...
...
parallel1=printer
parallel2=disabled
parallel3=disabled

Next scroll to the [printer] section and change it to look like the following –

[printer]
...
...
printer=true
dpi=360
width=85
height=110
printoutput=printer
multipage=false
docpath=.
timeout=0

Close the file and save it. That’s it!!! Now when we print from Dbase, the print dialog appears and we can print to any printer in the system.

4 thoughts on “Running DBase III+ in Ubuntu

  1. 1.What do u mean when u say “I assume DBase III+ resides on the Linux Home folder”; do I have to load DBase III for windows in this folder ?
    2.Is the username , the username for the Ubuntu one for the line , Z:\> config -writeconf /home//dosbox.conf

    Thanks

    • refers to your ubuntu login name.

      You can copy the DBASE III files to a folder in /home/username. For the set up I am providing, I have my DBASE in /home/username/dbase. Hence, when I mount my home folder with DosBox, I can access it using cd dbase.

      If your DBASE resides on any other folder, you can mount that folder in the DOSBOX config

Leave a comment