DOSBox, part II: standalone DOS apps on desktop
[ Wednesday, 18 June 2008, Raptou ]
In this article I describe how to make your own packages containing autonomous DOS programs for Windows or Mac OS X using DOSBox.
In the first part of this series: DOSBox: Installation and configuration I’ve described the excellent PC emulator with the DOS system. Not many people are aware that DOSBox might be used as a virtual environment for preparing completely autonomous, full featured programs to run on different (non-DOS) operating systems. DOSBox might be a module of a game or a part of a program. Due to this feature DOSBox might be used to create universal and portable applications. Such applications might be copied for a Pendrive or memory card and run in a Mac OS X or Windows environment.
Such a package consists of three parts (all of them in one directory):
- Directory containing DOSBox for Windows.
- Directory containing DOSBox for Mac.
- A target DOS program.
As for Linux there are some difficulties with preparing a portable DOSBox version as the dependencies issues are treated in a different way than in Mac OS X or Windows. (There are some specific libraries needed in Linux to obey dependencies. It is not a huge problem since there are a lot of comfortable package managers (like Apt-get) available, but the dependencies issues are in conflict with the idea of portable and autonomous applications. Theoretically we may imagine a script, which downloads and installs given libraries when we run our DOS program. When those libraries are present, the script simply does not run. The real problem here is the number of different solutions and programs for downloading and installing applications directly from the Internet. There is no common standard present for all Linux distributions (e.g. you can use the apt-get command in Debian, but not necessarily in other distros).
There’s also another problem present for the idea of a “multi-OS” package — namely, different path descriptions (connected with the beginnings of the DOS system). When we consider unix-like systems, to separate directories in paths the “/” sign is used, and “-” is used for program options. In the DOS system back-slash (“\”) is used as a separator, and “/” is used for defining programs’ options. This issue is a great problem for users of many different operating systems.
Another problem is graphics acceleration. We find Direct Draw standard in Windows and OpenGL in other systems. It is true that we can choose non-acceleration standard in DOSBox configuration (Overlay and Surface modes), but one must be aware that in the result some DOS applications will run very slowly, and some might even not work at all. It is possible to use OpenGL in Windows, but, practically, large parts of programs will not run this way. This is a reason for creating two separate configuration files for DOSBox, one for Windows and one for Mac (Linux). Overlay and Surface modes are used on older machines equipped with graphic cards without 3D acceleration.
To avoid wasting our time during packages creation it is worth it to pay attention to the package creation process methodology. There are small differences in both dosbox.conf configuration files, so we may create packages for the most used (by us) system first. Then we “tune” DOSBox, and copy the configuration file to the dosbox directory for other the OS (e.g. Windows). We change the line to “output=opengl” for Mac/Linux and “output=ddraw” for Windows. Next — in the last lines of the “[autoexec]” section we change slashes (/ to \) in the path to the directory “acting as” the C drive and for programs. The rest of the config file will “fit” for our new OS. Of course — as I’ve already mentioned — there’s a possibility to choose one of the “universal” modes — i.e. without graphics acceleration. These are: Surface (older machines) and Overscan (new machines without hardware graphics acceleration). Such configurations (without concerning described differences) will result in similar applications performance in both systems.
DOS game/program configuration as autonomous application for Windows
Most DOS programs may be executed as autonomous packages in Mac OS X or Windows.
To build your own package you’ll need the DOSBox emulator in the Portable DOSBox version for Windows
- Download Portable DOSBox for Windows.
- Create a new directory (e.g. named “Quake”).
- Open the directory.
- Create a new directory (e.g. “C”).
- Create a”Windows” directory.
- Create a “Mac” directory — this will “act as” the C drive
- Copy the contents of an original directory with the DOS program or game to the “C” directory.
- Copy the contents of the Portable DOSBox directory (DOSBox.exe and DLL libraries) to the “Windows” directory. Open
dosbox.confin any text editor. - Change the following variables as presented below:
- fulscreen=true
- output=ddraw
- core=auto
- cycles=max
- cycleup=100
- cycledown=100
- memsize=32
- frameskip=1
- Go to the
[autoexec]section (at the end of the file) and add the following lines (skip explanations in parentheses):
[autoexec]
mount c ../c (mount "C" dir as C drive)
c:
SET BLASTER=A220 I5 D1 H5 P330 T6
; (system variable responsible for proper sound-card (Sound Blaster) detection)
cd path_to_game_dir
setup
;(or other file name for game config)
- Save the changes.
- Run
dosbox.app - Configure the game settings (sound, graphics, e.g. Sound Blaster 16, adres 220h, IRQ 7, DMA 1).
- Without leaving the DOS run the game and check if it works properly.
- Leave the game and press [Ctrl]+[F9] to leave DOS mode and get back to Windows.
- When the game is properly configured we come back to the dosbox.conf edition.
- Go to the
[autoexec]section. - Remove the line with setup and add the executable file name of the game (e.g. “quake.exe”).
- Add
exitat the very end to automatically close the DOS session after quitting the game and return to Mac OS X/Windows.
Our game is now configured for Windows. Another part is to configure it for Mac OS X. You may skip this part if you don’t want to use OS X. In this case the “Mac” directory is not needed for our game.
DOS game/program configuration as autonomous application for Mac OS X
Most DOS programs may be executed as autonomous packages in Mac OS X or Windows.
To build your own package you’ll need the DOSBox emulator in Portable DOSBox version for Mac
- Download Portable DOSBox for Mac OS X.
- Create a new directory (e.g. named “Win311″).
- Open the directory.
- Create a new directory (e.g. “C”).
- Create “Windows” directory.
- Create “Mac” directory — this will “act as” the C drive
- Copy the contents of an original directory with the DOS program or game to the “C” directory.
- Copy the contents of the Portable DOSBox dir (DOSBox.exe and DLL libraries) to the “Windows” directory.
- Mount DMG DOSBox image for Mac OS X.
- Copy DOSBox.app and dosbox.conf from DMG to the “Mac” directory.
- Open
dosbox.confin any text editor. - Change the following variables as presented below:
- Go to the [autoexec] section (at the end of a file) and add the following lines (skip explanations in parentheses):
[autoexec]
mount c ../c (mount "C" dir as C drive)
c:
SET BLASTER=A220 I5 D1 H5 P330 T6
; (system variable responsible for proper sound-card (Sound Blaster) detection)
cd path_to_game_dir
setup
;(or other file name for game config)
- Save the changes.
- Run
dosbox.app - Configure game settings (sound, graphics, e.g. Sound Blaster 16, adres 220h, IRQ 7, DMA 1).
- Without leaving the DOS run the game and check if it works properly.
- Leave the game and press [Ctrl]+[F9] to leave DOS mode and get back to OS X.
- When the game is properly configured we come back to the dosbox.conf edition.
- Go to the
[autoexec]section. - Remove the line with setup and add the executable file name of the game (e.g. “quake.exe”).
- Add
exitat the very end to automatically close the DOS session after quitting the game and return to Mac OS X/Windows.
- fulscreen=true
- output=opengl
- core=auto
- cycles=max
- cycleup=0
- cycledown=0
- memsize=64
- frameskip=1
Our game is now configured for OS X.
Configuration of a DOS game/program package prepared for Mac OS X to work on Windows or on both systems
This is what you should do. First copy dosbox.conf from the “Mac” directory to the “Windows” directory. Next:
- Open the file in a text editor.
- Change the entry
output=opengltooutput=ddraw. Microsoft uses the “/” sign as an operator for internal and external commands, so we must change it also. To do so, we: - Find the
[autoexec]section - Change the “mount” line to:
mount c\.. - Save the changes
Now our game/program is ready to run on Mac OS X and Windows.
Package as DMG disc image
Remeber! Windows does not recognise the DMG extension by default. If our package is to be used on both systems, I suggest using Zip, Rar, 7Zip or another archive format rather than DMG!
- Open “Disk Tools”.
- Choose “New image”.
- Name it.
- Choose “Custom” and type the size of the image file (a little bit bigger than the directory with our game). The image will mount automatically after creating it.
- “Drag” the game dir (the one from DOSBox).
- Unmount the image.
It is ready. Now we may put our DMG package on an FTP server, for example, or send it to a friend.
Check if a licence of a given program allows you to do so. Some authors just put their rights in abandonware without making their work free!
How to prepare DOSBox for Mac with PowerPC processor?
PowerPC processors are a totally different architecture than Intel ones. It is much more difficult to emulate a DOS system on this platform.
Due to this, some DOS programs will not work, and some will work with low efficiency with this processor.
The secret of efficiency is hidden in the dosbox.conf file. More specifically, in these lines:
output=
core=
cycles=
Instead of “opengl” value try to use “overlay”. Instead of “core=auto” type e.g. “core=normal”. Value “cycles=max” change to “cycles=5000″.
cycleup and cycledown — change the value 0 to 100, for example. This value stands for possible steps of manual manipulation of the machine’s speed (using keys F11, F12 — 0 stands for disable manual manipulation).
Run the game. It should be possible to set the “cycles” value properly for your computer (use key-binds [Ctrl]+[F11] and [Ctrl]+[F12]). Remember the best value and put it in “cycles=”. Key-binds [Ctrl]+[F8] and [Ctrl]+[F9] are responsible for the number of lost frames.
Unfortunately I don’t have a G4 and thus I cannot pick the best values. You may find what should be typed in the commented lines of the configuration file. Sometimes the lowest number is great for performance of the given game emulation on a given computer. When you get such a configuration of dosbox.conf you may just use it for every other game (further corrections won’t be necessary in most cases — excluding the [autoexec] path of course). As for the moment, I’ve met only two DOS programs that didn’t run on weaker machines (e.g. for Illusion Pinball it is extremely hard to set proper values).
Useful key-binds:
[Ctrl]+[F10] — to capture/release the mouse
[Ctrl]+[F9] — to kill dosbox
[Ctrl]+[F7] — to decrease the drop-frame rate
[Ctrl]+[F8] — to increase the drop-frame rate
[Ctrl]+[F11] — to make application run slower
[Ctrl]+[F12] — to make application run faster
Below you may find an example of a “dosbox.conf” file configuration for Mac computers with Intel Core processors (and higher). Presented example is prepared for Quake.
Notice! To the game dir (here: “C”) you should copy VESA drivers for DOS to enable higher resolution in the game. In the example Univbe 5.1 drivers were used.
[sdl]
fullscreen=true
fulldouble=true
fullresolution=800x600
windowresolution=original
output=opengl
autolock=true
sensitivity=500
waitonerror=true
priority=higher,normal
mapperfile=mapper.txt
usescancodes=true
[dosbox]
language=
machine=vga
captures=capture
memsize=64
[render]
none,normal2x,normal3x,advmame2x,advmame3x,
advinterp2x,advinterp3x,tv2x,tv3x,rgb2x,
rgb3x,scan2x,scan3x.
frameskip=1
aspect=true
scaler=normal2x,advmame2x
[cpu]
core=auto
cycles=max
cycleup=0
cycledown=0
[mixer]
nosound=false
rate=44000
blocksize=8192
prebuffer=50
mpu401=intelligent
device=default
config=
[sblaster]
sbtype=sb16
sbbase=220
irq=7
dma=1
hdma=5
mixer=true
oplmode=opl3
oplrate=22050
[gus]
gus=false
gusrate=44000
gusbase=240
irq1=5
irq2=5
dma1=3
dma2=3
ultradir=C:\ULTRASND
[speaker]
pcspeaker=true
pcrate=22050
tandy=auto
tandyrate=22050
disney=true
[bios]
joysticktype=none
[serial]
serial1=dummy
serial2=dummy
serial3=disabled
serial4=disabled
lpt1=true
lpt1=enabled
[dos]
xms=true
ems=true
umb=true
[ipx]
ipx=true
[tcp]
tcp=true
[autoexec]
mount c ../c
c:
SET BLASTER=A220 I5 D1 H5 P330 T6
cd univbe51
univbe
cd \
quake -nocdaudio
exit
Subscribe to RSS feed for this article!
9 Comments
- A hyperlink: <a href="polishlinux.org">GNU/Linux for everyone!</a>,
- Strong text: <strong>Strong text</strong>,
- Italic text: <em>italic text</em>,
- Strike: <strike>
strike</strike>, - Code: <code>
printf("hello world");</code>, - Block quote: <blockquote>Block quote</blockquote>


Why don’t you build a static dosbox binary for Linux?
Thus you can reduce the dependencies problem when you install a program in different distros.
Several things in the first part (dosbox.conf) of this post worry me, though the packaging looks fairly sound.
Here are my concerns:
1) In Windows, you can use either forward or back slashes for directories, while still using forward slashes in arguments, in much the same way you can use forward slashes in arguments for programs in Linux. So, this argument is void – use forward slashes everywhere.
2) You say that OpenGL will hide some parts on Windows… not true, at least from my experience. All it is doing is drawing a framebuffer on a quad, why would some parts of your DOS program not work correctly?
3) Frameskip=1? I suppose, most dos games didn’t get that many frames per second anyway, but some explanation would have been nice…
4) Why is the emulated memory twice as large for Mac? It has nothing to do with the OS… I’ll call it a typo.
P.S. I spot another typo – there are 3 rogue lines in the top of the [render] section for Quake.
I did like the packaging section, however
@TD-Linux: In most of your comments you are probably correct as far as your machine is concerned. However, notice that in my examples I presented the way to produce universal packages. Thus, some restrictions had to be made.
Answering your questions:
1) Unfortuntaley they have to be reverse in DOS/Windows and other systems. In DOS “/” is for additional optionsand “\” for directories. The rest of the symbols are identical (” * “,” . “,” ? “). In dosbox.conf just like in MS DOS 5 you cannot use “\” to access paths in Linux/Mac OS and vice versa. And this is autoexec.bat that is being emulated in [autoexec] section.
2) Unfortunately in Windows “output=opengl” often doesn’t work properly. This is not always true but it happens often enough to not use it in universal packages.
If you want to prepare special packages for different computers, here are some hints:
- For very old video cards “2D”, with no 3d accelerator – use output=surface. This is the slowest mode but works on ancient software
- Old video cards but of more recent generation (likek np. Ati Rage) – output=overlay
- 3D stare video cards that understand DirectDraw, Windows – output=ddraw
- 3D stare video cards, other operating systems – output=opengl
3) Frameskip.
Skipping frames in Dosbox is directly associated with CYCLE parameter. It serves the idea of “connecting” the speed of video graphics displayed in thevirtual Dosbox computerwith its emulated processor. Some very old games use real tacting and their speed depends on the processor clock. For these games the emulated PC processor needs to be drastically slowed down. This is why the manual regulation of those parameters was introduced. In order to adjust the params to some game we need to read the data displayed in the title windows of the game and then write them down in the config script.
4) You are correct here, this value can be the same in both configurations. For most applications even 4MB would be more than enough. The value 64MB for Mac is the remains of my trying to run GEOS Ensemble under Dosbox (it was hard, but I succeeded, the article about it will appear on PolishLinux.org soon, so stay tuned).
Hi,
Not only “old” games can run in DOSBox but also CAD-systems. I was (am) the developer of a powerful 2D CAD system programmed for DOS and VESA graphics cards, DOS is mostly forgotten and most modern Video cards doesn’t support the whole VESA standard anymore. Oddly enough however, they respond on the VESA standard identification call “affirmative”. I didn’t find any time (or was it courage?) to port the system to Windows (mostly because the support of a mouse is limited in Windows) but in DOSBox the system runs very well on Windows XP and VISTA and I suppose it will also in Linux and all supported OS’s.
There are compiled versions of DOSBox available that support graphics 1280*1240 (Hal9000) and even 3D acellaration.
Some correction of typo’s:
The supported grphics mode of one of the special versions is 1280*1024 and it is of course 3D acceleration.
its possible to do this with ScummVM adventures?
DOSbox version of this cant open speech files
YEAH UM WHY THE.. DIDN’T THEY USE P330 IN THE *.CONF FILE IT IS USED FOR CORRECT 16 BIT SOUND EMULATION WHY DIDN’T THE DOSBOX TEAM KNOW THIS
\\*.TO.ERT.*\\ UM.. ERT DO YOU HAVE THE TALK VERSIONS OF THIS GAME GET THE SCUMMVM EMULATOR AND DOWNLOAD THE LARGER GAMEFILE PACK OF THE GAME YOU’VE GOT THAT HAS THE SPEECH FILES IN IT IT WILL BE ABOUT 200 to 600 MEGS LARGER BECAUSE OF THE SPEECH FILES INCLUDED!!
wow first comment in like, 2 years ?
Making my “standalone” games using dosbox in windows is something i really like doing. I can tweak the .conf file for each and its very convenient.
I was searching for a way to do it with ubuntu and stumbled on this page. Seems its not as easy as i hoped, hmmm, this is disappointing. Im really trying to learn linux/Ubuntu but its kinda frustrating after years of Windowsing to have to be a noob all over again, hahaha.
rave pending benevolence en route to embodiment previous projector fantastic series – abstract herewith the ivie & lauren!! this is great! forestalling mass a certain number.