fsxNet Wiki

BBS Development & Resources

User Tools

Site Tools


doors:tutorials:dos:dosbox

DOS doors With DosBox

This guide is aimed at Raspbian Linux (Stretch) on Raspberry PI, but should work on any Linux/UNIX like system DosBox supports.

Step 1. Install Pre-Requisites

To compile DosBox, you will need SDL 1.2 and SDL-net in addition to the usual development toolchain. You will also need Subversion to get dosbox and patch to patch it.

  sudo apt-get install build-essential libsdl1.2-dev libsdl-net1.2-dev subversion automake dos2unix

Step 2. Fetch DosBox

The most recent DosBox release has some issues with DOS doors, and the most recent Subversion code also has issues, so you will need a specific revision from the subversion repository. In my tests I have found r3933 to work well. Other revisions may work, but have not been tested.

  svn checkout -r3933 svn://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk dosbox-code-0

Step 3. Patch DosBox

Now we have the DosBox code, you will probably want to patch it to fix a specific bug that happens with some doors which will appear as though when you press enter, it receives the enter command twice.

  wget https://gist.githubusercontent.com/apamment/bb438d9be6dc8e67c36239fd64047ece/raw/3e942c68d7a970f3404bffc2408165d810c4bef7/dosbox-nullmodem.diff
  
  cd dosbox-code-0
  
  patch -p1 < ../dosbox-nullmodem.diff

Step 4. Compile DosBox

Compiling DosBox takes a long time on the Raspberry PI and will appear to have frozen a few times - particularly when compiling the render-scalers file - don't worry, just leave it it will eventually move on.

  ./autogen.sh
  ./configure
  make
  sudo make install

These commands will compile and install DosBox into /usr/local/bin.

Step 5. Create Configuration File

Next you will need to create a config file which enables the serial port for socket inheritance, and also mounts drives so that DosBox can access both your doors and your BBS drop files.

An example for my WWIV setup is here: dosbox.conf

In this example, drive C: is the location where my doors are stored and drive D: is the location of WWIV's temporary node files (drop files).

Step 6. Create Shell Script to Invoke DosBox

The shell script you need will vary from system to system, but basically, you want to:

  • ensure no one else is using the door before you start it
  • make DosBox not use an X11 window,
  • ensure that the dropfiles have DOS line endings
  • launch DosBox with the command to start the batch file in the next section.

Some bulletin board systems have mechanisms to make sure only one person is using a door at a time, others do not. If your BBS system supports such a mechanism, you do not need to do it in the shell script.

Also some BBSes write dropfiles with DOS line endings instead of UNIX line endings, so you may not need to do that in the script.

Here is an example script I use for Freshwater Fishing on WWIV:

  #!/bin/bash
  export SDL_VIDEODRIVER="dummy"
  NODE=$1
  SOCKET=$2
  /usr/bin/unix2dos /home/wwiv/temp/${NODE}/door.sys
  /usr/local/bin/dosbox -socket $SOCKET -c "C:\ffs.bat ${NODE}" -conf /home/wwiv/doors/dos/dosbox.conf

Notice my setup does not need to check if the door is in use, but it does need to convert the drop file to use DOS line endings.

An example where you can check if the door is in use would be:

  #!/bin/bash
  export SDL_VIDEODRIVER="dummy"
  NODE=$1
  SOCKET=$2
  
  if [ ! -e /home/wwiv/doors/dos/ffs.inuse ]; then
     touch /home/wwiv/doors/dos/ffs.inuse
     /usr/bin/unix2dos /home/wwiv/temp/${NODE}/door.sys
     /usr/local/bin/dosbox -socket $SOCKET -c "C:\ffs.bat ${NODE}" -conf /home/wwiv/doors/dos/dosbox.conf
     rm /home/wwiv/doors/dos/ffs.inuse
  fi

This will just dump the user back to the BBS if the door is in use. You could get fancy and use the 'inuse' door I created which will display an in-use message and then quit (INUSE Door), but that is outside the scope of this document.

You will also need to make the bash script executable:

  chmod +x somescript.sh

Step 7. Create Batch File to Start Door

Please note, you will need to setup your doors using DosBox in the normal fashion, either you set them up on a machine where you have a monitor attached and transfer the files over, or you run DosBox directly from your PI with either remote X11 or a local monitor.

You will also most likely need a Fossil driver, BNU works well. (Get the stable release 1.70).

Different doors will need to be called in different ways, but the important thing to remember is that you end the batch file with “exit” else the door will stay stuck in DosBox.

Here is an example I use for freshwater fishing:

  @echo off
  C:
  cd\bnu
  bnu /L0=11520
  cd\ffs
  fishing 2 D:\%1  /F
  exit

This loads BNU, then launches the door with the drop file remember my dropfiles are in D:\(node)\

Step 8. Setup BBS to call Shell Script

Finally, you will want to setup your BBS to call the script you made in Step 6. You also need to pass the node number and socket handle.

In WWIV the command line looks like this:

  /home/wwiv/doors/dos/ffs.sh %N %H

Where %N is the node number, and %H the socket handle.

doors/tutorials/dos/dosbox.txt · Last modified: 2017/09/04 03:34 by apam