DOSbox on both PSP and PC with HDM menu system

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
bulldog
Posts: 12
Joined: Sun Jun 24, 2007 6:42 am

DOSbox on both PSP and PC with HDM menu system

Post by bulldog »

Bulldog's HOWTO run DOSBox on both the PSP and the PC

Version 1.002
This is my HOWTO FAQ about running the DOSBox emulator on both your computer and your PSP! This will allow you to perform any software installs and configurations by using your PC and then you can play the games on your PSP using the HDM Menu to launch the game of your choice. This is a long process so please be patient. If you have suggestions for revision, please post a reply to this thread.

This HOWTO was a major work to put together, so please respect that and do NOT copy it and repost it elsewhere. If you want to share this info, PLEASE, just share a link to this thread.

Step 1 - Install and configure DOSBox for the PC
Start by downloading the PortableApps platform, and the DOSBox application.
PortableApps
I downloaded the Platform Only version. This version ONLY has the menu system..
DOSBox Portable
This is the PortableApps version that will run on your PC. Connect your PSP (via USB) to your PC and install both the PortableApps and DOSBOX onto your PSP memory card. Now explore to your PSP memory card and create a folder at the root level and name it "mount". Create two subfolders inside the mount folder, name them "cdrive" and "cdroms". Go into the cdrive folder and create two more new folders and name them "INSTALL" and "BATCH". You should now have the following directory structure on your PSP:

Code: Select all

mount
mount\cdrive
mount\cdrive\BATCH
mount\cdrive\INSTALL
mount\cdroms
Now explore to this folder: I:\PortableApps\DOSBoxPortable\Data\settings (I: is the drive letter for my PSP memory card).You will find a file named dosbox.conf, this is the equivalent of the config.sys file for a DOS computer. We will be putting necessary commands in this file to customize the bootup of our DOSBox virtual PC. Edit the dosbox.conf file (I use Notepad. Be sure to disable the word wrap feature. Scroll to the bottom of the file and add the following text to it:

Code: Select all

[autoexec]
# Lines in this section will be run at startup.
mount c ..\..\..\..\mount\cdrive
c:
AUTOEXEC.BAT
What these lines of code do for us is to map the cdrive folder as the root of the C: drive on our virtual PC when it boots up. Then it changes the active drive to C: and runs the AUTOEXEC.BAT file that will have the rest of our startup commands. Now explore to this folder: I:\mount\cdrive. Create a new text file and name it AUTOEXEC.BAT, then edit it by right-clicking on it and selecting edit. Copy and paste the following text into it:

Code: Select all

Echo Off
Path Z:\;C:\HDM;C:\BATCH
Save the file and exit. Since we are just beginning, we only want to make sure we have the path set so that DOS will be able to automatically find the commands we want to use. The Z: drive is special to DOSBox, it is a virtual drive that has the built-in DOS commands for use in DOSBox. The HDM folder will be created in the next step, and the BATCH folder we already created but will not use it until we start setting up our games (it is where we keep our custom batch files for all the games). You have finished Step 1!

Step 2 - Install and Configure DOSBox for the PSP
Download the PSP DOSBox application.
PSP DOSBox
Download it and copy the dosbox folder (after unzipping) to your PSP\GAME folder on your PSP.

Now browse to the folder I:\PSP\GAME\pspDOSbox and edit the dosbox.conf file. Copy and past the following text to the bottom of the file:

Code: Select all

[autoexec]
# Lines in this section will be run at startup.
mount c ms0:/mount/cdrive
SYSOPT clock 333
c:
AUTOPSP.BAT
Now explore to this folder: I:\mount\cdrive. Create a new text file and name it AUTOPSP.BAT, then edit it by right-clicking on it and selecting edit. Copy and paste the following text into it:

Code: Select all

Echo Off
Path  Z:\;C:\HDM;C:\BATCH
Save the file and exit. You have now finished Step 2!

Step 3 - Install and configure the DOS HDM Menu
Download a DOS menu program (for a frontend).
hdm504.zip (from simtel.net)
This is a link to dos menu programs on simtel.net. I use hdm504.zip. Install the menu program in your DOSBox session.

Save the file in the I:\mount\cdrive\INSTALL folder and unzip it into a folder using the filename. Now you are ready to install the menu, so use your PortableApps Menu to launch DOSBox. Now in the Dos window issue the following commands:

Code: Select all

c:
cd c:\INSTALL\hdm504
install
Accept the default answers and it will install the menu system to C:\HDM. Once it finishes, you can exit DOSBox. Now you will need to explore your memory card again. Go to the I:\mount\cdrive folder and edit the AUTOEXEC.BAT file and copy and paste the following text to replace all the text in the file:

Code: Select all

Echo Off
Path Z:\;C:\HDM;C:\BATCH
CD C:\HDM
copy /Y HDM.PC HDM.BAT
HDM
Now edit the AUTOPSP.BAT file and replace the text with the following text:

Code: Select all

Echo Off
Path  Z:\;C:\HDM;C:\BATCH
CD C:\HDM
copy /Y HDM.PSP HDM.BAT
HDM
Notice the copy command, this is to supply changes to the HDM menu batch file so that it has different commands for the PSP than for the PC. OK, now browse to the I:\mount\cdrive\HDM folder and create two new text files and name them HDM.PSP and HDM.PC. Edit the HDM.PC file and paste the following text into it:

Code: Select all

Echo Off
rem  ***  DO NOT CHANGE THIS BATCH FILE  ***
HDM4DOS %1 %2 %3 %4 %5 %6 %7 %8 %9
if ErrorLevel 9 %X% -R
if ErrorLevel 7 X -R
echo Error running HDM for DOS!
Now edit the HDM.PSP file and paste the following text into it:

Code: Select all

Echo Off
INPUTMAP up up
INPUTMAP down down
INPUTMAP left left
INPUTMAP right right
INPUTMAP cross enter
INPUTMAP circle pgdown
INPUTMAP triangle pgup
INPUTMAP square enter
INPUTMAP ltrigger esc
INPUTMAP rtrigger a
INPUTMAP start f1
INPUTMAP select t
INPUTMAP EXEC HDM4DOS %1 %2 %3 %4 %5 %6 %7 %8 %9
if ErrorLevel 9 %X% -R
if ErrorLevel 7 X -R
echo Error running HDM for DOS!
Browse to the I:\mount\cdrive folder and create a new folder named BATCH. Go to the I:\mount\cdrive\BATCH folder and create a new text file named _BlankNEW.BAT and edit it. Copy and paste the following lines of text into the _BlankNEW.BAT file:

Code: Select all

Echo Off
C:
CD C:\GAMES\Path_to_Game
INPUTMAP up up
IF NOT ERRORLEVEL 1 GOTO PSP
:PC
GameNAME
GOTO END
:PSP
INPUTMAP up up
INPUTMAP down down
INPUTMAP left left
INPUTMAP right right
INPUTMAP cross lctrl
INPUTMAP circle lalt
INPUTMAP triangle space
INPUTMAP square enter
INPUTMAP ltrigger f5
INPUTMAP rtrigger y
INPUTMAP start esc
INPUTMAP select t
PAUSE
INPUTMAP EXEC GameNAME
:END
REM THE FOLLOWING COMMANDS ARE TO RETURN TO THE HDM MENU PROGRAM
CD C:\HDM
X
Save and close the _BlankNEW.BAT file. You have finished Step 3! You now have DOSBox working for the PSP and the PC! It will automatically load the HDM menu program on bootup. In the HDM program, you can press the F1 function key to get help. Scroll up and down the help pages with the arrow keys. If you browse to the HDM folder that the menu was installed to there is also an HDM.DOC file which is a complete manual for the program.

Step 4 - Installing and Configuring a DOS Game
For an example we will download Commander Keen. There are many abandonware sites, just search for "abandonware" or "DOS Games". Use the link below to get the download for Commander Keen and save it to the INSTALL folder we used earlier.
]Commander Keen 1 (from thehouseofgames.net)
Now extract the files into a folder (rename the folder to KEEN1). When you name folders in DOS it is best to keep the names 8 characters or less and only use alphanumeric names (so don't use a space in the name). Some games will have a setup or install program that will need to be run to install the files correctly, this one is just a bunch of files in a zip file, that you can extract to a folder of your choice.

Browse your memory card to the I:\mount\cdrive folder and create a GAMES folder. Now create a ComKeen folder (so that later you can put all of the other Commander Keen games in this folder) under the GAMES folder. Move the KEEN1 folder into the ComKeen folder so that the path to it will be I:\mount\cdrive\GAMES\ComKeen\Keen1. Inside that folder you should have the KEEN1.EXE file along with all the other files needed for the game.

Next, browse to the BATCH folder and make a copy of the _BlankNEW.BAT file and rename the copy to CK1.BAT. Now edit the CK1.BAT file and change it to match the following text:

Code: Select all

Echo Off
C:
CD C:\GAMES\ComKeen\Keen1
INPUTMAP up up
IF NOT ERRORLEVEL 1 GOTO PSP
:PC
KEEN1
GOTO END
:PSP
INPUTMAP up up
INPUTMAP down down
INPUTMAP left left
INPUTMAP right right
INPUTMAP cross lctrl
INPUTMAP circle lalt
INPUTMAP triangle space
INPUTMAP square enter
INPUTMAP ltrigger f5
INPUTMAP rtrigger y
INPUTMAP start esc
INPUTMAP select t
PAUSE
INPUTMAP EXEC KEEN1
:END
REM THE FOLLOWING COMMANDS ARE TO RETURN TO THE HDM MENU PROGRAM
CD C:\HDM
X
Here are the 3 lines that should have been changed in editing:

Code: Select all

CD C:\GAMES\Path_to_Game
GameNAME
INPUTMAP EXEC GameNAME
Now we launch DOSBox on your computer and go to the HDM Menu (it loads automatically). In the menu system we need to add a new item. Press the Insert key and select an empty menu item to add a new item. For the title, name it "Commander Keen 1", for the command enter the following text:

Code: Select all

{EXIT}~{KEY C K 1 ENTR}
Be sure that you enter it exactly. The {EXIT} command is to exit the HDM Menu, the ~ (tilde) is to separate commands, the KEY command uses the keys separated by spaces to automate typing a command in DOS. It is typing the name of the batch file we created earlier CK1.BAT, the .BAT extension is not needed in the command. The ENTR is there to represent the ENTER key. Save the menu item. Now press Enter with that item highlighted and it should launch the Commander Keen 1 game for you. When you exit the game it will return to the HDM menu. If you run into problems, reread my directions. If you STILL have trouble reply to this thread and I will try to assist.

You have now finished Step 4!

Step 5 - Understanding DOSBox
For the PSP version of DOSBox, it is necessary to remap the keys and controls to specific buttons and controls on the PSP. If you look back at the batch file we made for Commander Keen you will see a list of INPUTMAP commands. Now it is important to understand what they do so you can customize the controls for other games. Here is the syntax and a list of values that I have gathered for referrence:

Code: Select all

SYNTAX: INPUTMAP [PSP INPUT VALUE] [PC INPUT VALUE]
PSP INPUT         VALUE       PC INPUT              VALUE
dpad up           up          up arrow              up
dpad down         down        down arrow            down
dpad left         left        left arrow            left
dpad right        right       right arrow           right
analog control    analog      joystick              joystick
square            square      left-ctrl             lctrl
cross             ross        left-alt              lalt
triangle          triangle    enter                 enter
square            square      space                 space
left trigger      ltrigger    F5                    f5
right trigger     rtrigger    escape                esc
select            select      Page Up               pgup
start             start       Page Down             pgdown
                              mouse                 mouse
                              left mouse button     button1
                              right mouse button    button2

The last INPUTMAP command in the batch file is INPUTMAP EXEC KEEN1, this is the command used to start the game with the input mapping we just specified.

Now let's look at the dosbox.conf file. Remember the mount command? It was different for the two versions of DOSBox. Here is the PSP version:

Code: Select all

mount c ms0:/mount/cdrive
SYNTAX: mount [drive letter] [path to folder to map as a drive]

It is critical to keep it lowercase for the PSP. This mount command makes the DOSBox see the cdrive folder as the root for the C: drive on the DOSBox virtual PC. The ms0: is the identifier that the PSP uses to refer to your memory card. Also pay close attention to the direction that the slash / marks are slanted. Now look at the PC version of the mount command:

Code: Select all

mount c ..\..\..\..\mount\cdrive
Notice that the slash \ marks are the opposite direction. Also notice that I am using a different method to show the path. The PSP version used the full path with the drive identifier. In the PC version I am asking the DOSBox to map a folder in direct reference to where the default folder for the DOSBox application is. The repeating ..\ is to tell the program to navigate to the parent directory of the current working folder. As you can see we are going up 4 folder levels before mentioning the mount folder which is at the root of the memory card. I did it this way because the memory card does not get mapped to the same drive letter on every computer.

Now let's look at the batch file I used for Kyrandia 1. I used an .ISO file of the CD so that I can have the speech work in the game. Here is the batch file (I named it KYRA1.BAT):

Code: Select all

Echo Off
C:
CD C:\WESTWOOD\KYRACD
INPUTMAP up up
IF NOT ERRORLEVEL 1 GOTO PSP
:PC
imgmount d ..\..\..\..\mount\cdroms\KYRA1.iso -t iso
MAIN
GOTO END
:PSP
imgmount d ms0:/mount/cdroms/KYRA1.iso -t iso
INPUTMAP up up
INPUTMAP down down
INPUTMAP left left
INPUTMAP right right
INPUTMAP cross button1
INPUTMAP circle lalt
INPUTMAP triangle space
INPUTMAP square enter
INPUTMAP rtrigger button2
INPUTMAP analog mouse
INPUTMAP start esc
INPUTMAP select t
INPUTMAP EXEC MAIN
:END
REM THE FOLLOWING COMMANDS ARE TO RETURN TO THE HDM MENU PROGRAM
CD C:\HDM
X
Notice the INPUTMAP commands have changed considerably to set the controls differently. What I want you to pay close attention to though is the imgmount command. This is used to mount a disk image as a CD. Notice that I have sections (":PC", ":PSP", and ":END") of the batch file that I use GOTO commands to redirect the flow of the batch process. If you get errorlevel 1 by using the INPUTMAP command, that means you are running the PC version and should use a different imgmount command syntax and NOT use INPUTMAP to launch the game.



End of HOWTO
Please, reply with any comments and/or questions and I will get back to you. If I feel that more explanation is needed, I will update this post. Hope this helps...
--Bulldog
"I appear here and there, now and then, to this one and that one. A benign but mischievous creature. Very fond of rumpots, crackpots, and how are you, Mr. Wilson?"
cimerians
Posts: 1
Joined: Sun Jun 21, 2009 5:59 am

Great help

Post by cimerians »

This was a fantastic explanation. I did this within 20 minutes and I'm up an running with DOSBOX on my PSP. Its sadly still a pain in the butt but your method is works great.

The only thing I was thrown off on was the HDM menu app. Im not familiar with it. I had to hit INSERT twice to enter in a new menu item and also I took a guess on where to put the command which was underneath the title of the menu item. Its just a blank line and they dont tell you to type a command in there.

These are great instructions thanks again. I did Keen 1 and now I will try a few games on my own like Pool or Radiance and a few others.
Post Reply