OSX DosBox Guide

For Documentation: Userguides and howto's.

OSX DosBox Guide

Postby DosFreak » 2005-8-16 @ 19:21

http://www.oregonfast.net/~steen/osxdos.htm

The following was taken from the above link. I don't have OSX so I couldn't verify myself:


A Few Hints on using DOSBox with OSX

Starting and mounting CDs, your first view:

Once you've got DOSBox on your Mac, most likely in a folder on your desktop at first, just start it for the first time. You will be presented with a simple DOS screen, a Z: (Z:\> to be exact) prompt, and a suggestion to type HELP or INTRO.

Like most DOS users you want a C: prompt, but there isn't one until you have mounted a C: drive. To mount one you have a bunch of choices, but none of them the same as instructions give for other machines. For example to mount the root directory of your Mac boot drive simply use the DOS command
mount r /
but more likely you'll want to get further to your own files. DOSBox doesn't recognize ~ for your home directory, so if you are logged in as Joe you'll have to mount C: with
mount c /users/joe
An alternative is to first mount C: as the root directory and then use the DOS SUBST command to set drive D: as your home directory with
subst d c:\users\joe
You can then place a startup batch file on whatever will be your first mounted directory, and within that put your other mount or subst commands, as well as the set path command to point to your main DOS programs. Then you can run it once the first drive is mounted.

To mount a CD, or any mounted drive, first insert the CD. If you know its name (the DOS 8 character name) you can eliminate much of the following, but let's presume you don't. After inserting the CD it will become a subdirectory in the Mac /Volumes, but it won't be seen on DOS drives previously mounted. So start by mounting a drive as either the root / or /Volumes, then do a dir on /Volumes to get the short name for the CD. Finally you can do a Mount or DOS Subst command to create a drive name for the CD, if you need a separate name. For example:
mount x /volumes
subst y c:/cdname
where cdname is the short name for the CD. You have now created two drives, x: and y:, the latter of which points to the root of the cd.

There is no way in DOSBox to unmount a drive or use the normal subst/d command to delete it. So if you replace a CD and need to find it's DOS name, you may have to use a different letter -- there are a few more letters in the alphabet.

Starting (advanced mode):

If you don't insist on starting with a double click on an application, your best bet is to use the terminal mode to start so you can make use of some of the command line options. Here is an approach written by somebody with more DOS than OSX experience. We start by getting a copy of the executable file onto your path, most likely your home directory. This from the terminal this is both ~ and /Users/Yourname where you substitute your name. Then I suggest you create a DOS subdirectory and a startup autoexec.bat file, though you can use any bat file.

1. Get the executable:

The executable file is contained within the dosbox application, and your best approach is to use terminal commands to get to it. In what follows in this paragraph, upper/lower case doesn't matter. Let's say the folder you've downloaded is on your desktop (~/Desktop/DosBOX) or you've moved it to the Applications directory (/Applications/DosBOX). In the terminal window use the cd command to get to that folder, and you will see DosBox.App, which from the terminal is just another folder. Go further down to DosBox.App/Contents/MacOS and you'll find the executable file DosBox which you can copy to your home directory.

Now for the copy command, case does matter, for in the command that follows, the case used is the one that the copy will end up with. Since I prefer all lower case so that when case does matter I don't have to hit the shift, I would use the copy command cp dosbox ~\ so that the resultant copy has only lower case. Once this has been done, you could start dosbox anytime simply by typing it's name, but let's set up an "autoexec" file first.

2. Start DosBOX from the terminal:

Create a subdirectory under your home directory called dos, either using the Finder or the mkdir dos in the terminal when you are in your home directory. You can use the OSX Text Editor in it's application folder to create a new file. Here are the lines from mine, along with a short description.

mount r / mount the root directory as r: Use this only if you need access to the root directory and are too lazy to type the command.
mount v /Volumes volume to find the mounted CDs. Don't use this if you are going to mount a CD after starting DOSBBox -- if you do you'll need to remount /Volumes with a different letter.
c: start in drive c: (Which will be the ~/dos directory from the terminal)
cd \ start in c:\
set path=z:\;c:\;c:\misc;c:\fdos My choice for a particular path. The z: is where DOSBox files are. The other three are where I keep my path items.

Now this file needs to be saved in your ~/dos directory. Presuming you are in the text editor, use the Save As command from the File menu, to save the file in the ~/dos directory with a file extension of .bat. For this example we'll use the name boxstart.bat. You will be prompted about whether to add .txt to the name, say no or it will not be a batch file. Note: It was later realized it would have been better to create only a one line file from OSX, then edit it with a DOS editor such as TED or EDIT because of the different line terminators.

Now for your first test. To be sure you're not still in the same terminal shell as you were at the start, start a new shell from the File menu (keyboard shortcut is cmd N) and you will be in your home directory. Type the command
dosbox ~/dos/boxstart.bat
and it should start up dosbox with the proper drives & path. But this is two many letters to type every time you want to start, at least it is if you're an old time dos user.

3. Simplify the Starting Command:

You need to create a file with a simple file name, such as dbox, in your home directory containing one line, the same command line you typed. The file must be made executable, and once done typing dbox in any terminal session started after this one will run the command. This is the Unix equivalent of a batch file. An experienced Unix user will simply use vi or emacs to create the file, chmod to make it executable and go. This instruction is for the inexperienced. Use the OSX text editor to make a file called dbox.txt in your home directory, containing the one line
dosbox ~/dos/boxstart.bat
in the terminal we will rename the file with the command
mv dbox.txt dbox
then make it executable with the chmod command. More infomation on both commands is available by typing man mv or man chmod, but for now I'll simply use one of the examples from man chmod to suggest you use the command
chmod 755 dbox
(the 755 can be replaced by u=rwx,go=rx or by u=rwx,go=u-w). All DOS users unfamiliar with the Unix commands should learn them for some of the best DOS utilities are ports from Unix! A little time spent with the man command can be useful.

Exit this terminal session, and now you should be able to start everything up by simply typing dbox in the terminal.

4. Adding more DOS commands

Typing help in this DOS gives a list of commands, and there's no Edit there! Well there wasn't before MSDOS 5 either. DRDOS had it earlier than it's 5 I think. If you have other copies of DOS around, the easiest way to add DOS commands is to just get them copied into your DOS path. I consider a couple of essential ones are a way to unzip files and a way to edit files. In addition, if you don't have any DOS commands around, why not grab those from FreeDos to play with.

For the unzip files one used to start with PKZIP 2.04g or 2.50 (which can handle long file names when used under Windows from 95 B on). But alas, it is no longer shareware, so sites that post those old versions don't keep them up for very long. However you can "unzip" in OSX now with Alladin Expander for free -- just means you can't do it from Dos unless you find yourself and older version of PKUNZIP or UNZIP or a newer shareware or freeware replacment such as Infozip.

For Edit and many others you can get an image of the Free Dos installation floppy. You can find it and documentation at http://freedos.org/. Presuming you don't have a floppy, download the image for the Dos floppy. Then get the free Extract tool from the winimage site. Then you can pull out the commands you want to put in your DOS path. I just extracted them all to a c:\temp folder then copied the ones that ended up in c:\temp\special to my path. When I simply double clicked on the image from the Finder, it recognized tht it was an image file, a folder for the contents, but it didn't have the subdirectories in it for some reason.

5. Using a Mouse in the DOS window:

The tests I did were all on a 12" Powerbook G4, so I can't answer for other hardware, but the old DOS standbuy MOUSE.COM worked for touchpad, bluetooth mouse, and USB mouse. You can get a copy at Allbootdisks.com. You can then run it from the DOS command line or in your startup file.

However, I found that to make it work, you must first start a DOS program that needs the mouse, then click in the DOS window which changes the OSX mouse arrow to the DOS mouse cursor.

When you exit the DOS program, the DOS cursor stays on the screen, motionless. It can be cleared with the DOS CLS command, but then there's no mouse cursor at all. To get back your OSX mouse cursor you can exit DOS or more quickly use the keyboard shortcut cmd Tab along with an arrow key to change the focus to another program such as the Finder.
User avatar
DosFreak
l33t++
 
Posts: 9622
Joined: 2002-6-30 @ 16:35
Location: Your Head

Return to DOSBox Guides

Who is online

Users browsing this forum: No registered users and 1 guest