====== DOSEMU2 ======
Synchronet has run DOS Doors under Linux for years using DOSEMU.  Many Sysops find that it meets their needs very well and is stable. However, DOSEMU has not been maintained, has controversial licensing terms, and not every DOOR program works well with it.  This page will detail the modifications made to get DOSEMU2 running under Synchronet for Linux with DOS-based DOORS.
===== Motivation =====
A primary motivation for some is to get Tradewars 2002 ver 3.09 running under Synchronet for Linux, something not possible to do with Dosemu. 
===== Hobo's Progress =====

Progress has been iffy.  At one time I had the following Tradewars 2002 games running under Dosemu2 and Synchronet:

  * 1.03d
  * 2.0 wide beta 8
  * 2.0 wide beta A
  * 3.09
 
In addition, I had Global Wars, Freshwater Fishing Simulator, Legend Of The Red Dragon ver 3.55, Scrabble, and Stack'Em running under Dosemu2 on a test BBS.

However...  after upgrading to a newer version of Dosemu2...  things simply stopped working.  After much further experimentation I was able to get some of them working, but not all.  Eventually I gave up my efforts on these games.

====== Overview Of The Problem ======
The primary issue with Dosemu2 and Synchronet is that it has different command line options than dosemu, and the external.bat called by Synchronet does not work with dosemu2.  Coming very soon will be my modifications to external.bat and dosemu.ini that work for me so far.  In time I hope that dosemu2 will be fully supported by Synchronet.  That may very well happen before I get this page finished... 


====== Installation of DOSEMU2 ======

There are multiple methods of installing DOSEMU2 to include building from source and through a repository.  Taking a simpler approach and ensuring you have the latest build, we will use the DOSEMU2 repository hosted on Gitlab.

The general procedure to install dosemu2 is as follows:
First, add the repository,

  * ''sudo add-apt-repository ppa:dosemu2/ppa''

Then update and install,

  * ''sudo apt update''
  * ''sudo apt install dosemu2''

**NOTE:** Starting with dosemu2 build 2.0~pre9-7811-4373124b9+202301020131, dosemu2 seems to require the $_xms and $_ems settings to be more than 1024 in order to run.  I (Nightfox) tried "$_xms = (8192)" and "$_ems = (2048)", and newer builds of dosemu2 would run.  Additionally, for TradeWars 2002, it also requires the setting SHELL_LOADHIGH_DEFAULT=0 (otherwise, when running TradeWars 2002, dosemu2 was complaining that it could not initialize the fossil driver and would exit). SHELL_LOADHIGH_DEFAULT=0 is supporeted with newer versions of comcom32.\\
And starting around version 2.0~pre9-7903-9d1ac8737+202302132016, SHELL_LOADHIGH_DEFAULT=0 is now the default, so it doesn't absolutely need to be specified anymore for TradeWars 2002.\\

If you prefer to use the latest FreeDOS environment, change the second command, to read ''sudo apt install dosemu2 fdpp''.  Once you accept the changes to your system, DOSEMU2 and FreeDOS will be installed.

===== Recommended Global Parameters =====
The Sysop of End Of The Line BBS has created a drop-in configuration for DOSEMU2 that "just works" with Ubuntu and probably other Linux variations.

https://www.endofthelinebbs.com/dosemu2.tar.bz2

You can find additional instructions in at

https://www.endofthelinebbs.com/dosemu2.txt


Two files exist to configure DOSEMU2 (and DOSEMU) for Synchronet for Linux.  ''$SBBSCTRL/dosemu.conf'' and ''$SBBSEXEC/dosemu.ini''.  The configuration file, ''$SBBSCTRL/dosemu.conf'' is the configuration file read by DOSEMU2 upon start and ''$SBBSEXEC/dosemu.ini'' is for 
DOOR customization parameters such as drive redirection, UART, etc. (more information can be found in [[howto:dosemu|Use DOS Doors with Synchronet on Linux]] and in the comments within ''$SBBSEXEC/dosemu.ini'').

As specified in [[howto:dosemu|Use DOS Doors with Synchronet on Linux]] Drive Letters, it is recommended to continue using D:, E:, F:, G:, and H:.  To adjust, add a line to ''$SBBSCTRL/dosemu.conf'' to read ''$_hdimage = "+0 -5 +1"''.  This will ensure that DOSEMU2 will skip drives D: through H: and begin adding internal drives at drive I:.  

__(Added by Nightfox)__\\
From [[https://gitlab.synchro.net/main/sbbs/-/issues/433|this issue filed in GitLab, filed by Ragnarok]], there are some recommendations for getting DOSEMU2 working with Synchronet.
\\
Update the cmd settings in exec/dosemu.ini (note that lredir is deprecated according to the dosemu2 documentation; thus, drives are mapped on these command lines - lredir should now be unnecessary in external.bat):\\
  cmd=/usr/bin/env $TERM HOME=$CTRLDIR QUIET=1 DOSDRIVE_D=$NODEDIR DOSDRIVE_E=$XTRNDIR DOSDRIVE_F=$CTRLDIR DOSDRIVE_G=$DATADIR DOSDRIVE_H=$EXECDIR NODEDIR=$NODEDIR $DOSEMUBIN SHELL_LOADHIGH_DEFAULT=0 -d $NODEDIR -d $XTRNDIR -I"video { none }" $VIRTUALCONF -f$DOSEMUCONF -E$EXTBAT -o$NODEDIRdosemu_boot.log $EXTLOG
  [stdio]
  cmd=/usr/bin/env $TERM HOME=$CTRLDIR QUIET=1 DOSDRIVE_D=$NODEDIR DOSDRIVE_E=$XTRNDIR DOSDRIVE_F=$CTRLDIR DOSDRIVE_G=$DATADIR DOSDRIVE_H=$EXECDIR NODEDIR=$NODEDIR $DOSEMUBIN SHELL_LOADHIGH_DEFAULT=0 -d $NODEDIR -d $XTRNDIR -I"video { none }" -I'keystroke "\n"' $VIRTUALCONF -f$DOSEMUCONF -E$EXTBAT -o$NODEDIRdosemu_boot.log $EXTLOG

In ctrl/dosemu.conf, add the following two lines (and change the path to sbbs to match what it is on your system):\\
  $_hdimage = "+0 -2 /sbbs/ctrl /sbbs/data /sbbs/exec +1"
  $_lredir_paths = "/sbbs"

Also, in exec/external.bat, you can remove the lredir commands - the commands above for dosemu.ini use the command-line options to map drives.  However, if you do decide to keep using lredir, it has been suggested to change the backslashes to forward slashes on the lredir lines:
  @lredir D: linux/fs$NODEDIR >NUL
  @lredir E: linux/fs$XTRNDIR >NUL
  @lredir F: linux/fs$CTRLDIR >NUL
  @lredir G: linux/fs$DATADIR >NUL
  @lredir H: linux/fs$EXECDIR >NUL

In my (Nightfox) experience, removing the "linux/fs" portion seems to work:
  @lredir -f E: $XTRNDIR >NUL
  @lredir -f F: $CTRLDIR >NUL
  @lredir -f G: $DATADIR >NUL
  @lredir -f H: $EXECDIR >NUL
  @lredir -f D: $NODEDIR >NUL


For the SHELL_LOADHIGH_DEFAULT=0, alternately, you can edit exechlp.bat (in /usr/share/dosemu/dosemu2-cmds-0.3/dosemu) and if SHELL_LOADHIGH_DEFAULT is in there, set it to 0 (it might be 1).  The SHELL_LOADHIGH_DEFAULT=0 setting is supported with newer versions of comcom32.

===== Troubleshooting =====

  ERROR: fatfs: root directory overflow on /sbbs/ctrl, 16384
  
If this error appears in your dosemu_boot.log in your node directory, it means you /sbbs/ctrl directory contains too many files. It's best not to use /sbbs/ctrl for general storage. Clean out some files and it should work.


===== See Also =====
  * [[:howto:|howto index]]

{{tag>}}
