I installed DOSBOX on my computer along with QBASIC.EXE which is Microsoft's QBasic 1.1 IDE from the old DOS days. So, I put a little icon on my Linux desktop, and when I double click it, it automatically launches QBASIC.EXE on Linux. For this, I had to install perl and dosbox, of course. I wrote a perl script that modifies the dosbox config file, changing it slightly to enter autoexec commands once it loads. This way, it automatically mounts drive c and goes to the appropriate directory and launches a program.

First, I am going to include the Linux desktop file, which I call qb11.desktop :

[Desktop Entry] Name=QBasic 1.1 Exec=/usr/bin/perl /home/owner/Desktop/rundos.pl "C:\HOME\OWNER\DESKTO +P" "C:\HOME\OWNER\BIN\DOS\QBASIC.EXE" Icon=/home/owner/.icons/qb.png Comment=Run Microsoft QBasic 1.1 GenericName=QBASIC IDE Type=Application

On a Linux computer, the existence of this file creates a clickable desktop icon. When the user double-clicks the icon, whatever follows the Exec= line will get executed.

I also created a directory called /home/owner/.icons which are full of various custom icons I use. And I put qb.png file there, which is a nice QBasic logo. And I created a directory called /home/owner/BIN, which holds every executable that is not native to Linux.

Now, here is the perl script that modifies the dosbox config file. It's really simple:

#!/usr/bin/perl -w # rundos.pl # # This program modifies the dosbox configuration file so that when you + type 'dosbox' in the # terminal, it automatically launches a program. Usage: perl rundos.pl + <workdir> <dosprogram> # The workdir must be a full path using backslash as the separator and + must be enclosed with # double quotes. The dos program must include the full location of the + program and the # program name the same way.. Make sure that the path includes only 8+ +3 filenames and the # program itself also has a name that is 8+3 length. (Here "8+3" means + the file name is # max 8 letters long, and the extension is 3 max letters long.) # # It does not matter whether the first and second arguments are in upp +ercase or lowercase, # because these will be used inside dosbox. In a dos environment, the +directory and program # names can be in upper or lower case, and it's all the same. But it i +s important to always # enclose the first and second arguments with double quotes. # # When you run this program without any arguments, "perl rundos.pl" it + will remove the program # launcher from the dosbox config file, so when you type "dosbox" in t +he terminal, # it will let you decide what you want to do... # # When you run this program with just one argument, "perl rundos.pl \h +ome\owner\dos" it # will launch dosbox in that directory. # # Example for running with two arguments: # perl rundos.pl "\home\owner\dos" "\home\owner\dos\qbasic.exe" use strict; use warnings; -e '/usr/bin/dosbox' or die "\nError: /usr/bin/dosbox is not found. Pl +ease install it.\n"; my $WORKDIR = (@ARGV > 0) ? $ARGV[0] : ''; my $DOSPROG = (@ARGV > 1) ? $ARGV[1] : ''; my $HOMEDIR = $ENV{HOME}; # Read this file: my $F = $HOMEDIR . '/.dosbox/dosbox-0.74-3.conf'; -f $F or die "\nError: Dosbox configuration file not found - $F !!!\n\ +n"; # Read the config file's contents: @ARGV = ($F); my @LINES = <>; # Find the line that begins with [autoexec] my $FOUND = 0; for (my $i = 0; $i < @LINES; $i++) { $LINES[$i] =~ tr|\r\n||d; if ($FOUND) { $LINES[$i] = ''; } if (index($LINES[$i], '[autoexec]') >= 0) { $FOUND = $i; } } if ($FOUND) { splice(@LINES, $FOUND); } # Delete it and everything t +hat follows... else { die "\nError: Dosbox config file doesn't contain [autoexec] sec +tion.\n"; } if (length($WORKDIR) && length($DOSPROG)) { push(@LINES, '[autoexec]'); push(@LINES, 'mount c /'); push(@LINES, 'c:'); push(@LINES, "cd $WORKDIR"); push(@LINES, 'cls'); push(@LINES, $DOSPROG); push(@LINES, 'exit'); } elsif (length($WORKDIR)) { push(@LINES, '[autoexec]'); push(@LINES, 'mount c /'); push(@LINES, 'c:'); push(@LINES, 'cd ' . $WORKDIR); push(@LINES, 'dir /w'); } else { push(@LINES, '[autoexec]'); push(@LINES, 'ver'); } # Save modified config file. open my $fh, '>', $F or die "\nError: Cannot update to $F !!!\n\n"; print $fh join("\n", @LINES), "\n"; close $fh; # Launch dosbox. exec('dosbox');