For Documentation: Userguides and howto's


Postby mirekluza » 2004-1-14 @ 06:20

What is DPMI?
Definition: "The DOS Protected Mode Interface (DPMI) was defined to allow DOS programs to access the extended memory of PC architecture computers while maintaining system protection DPMI defines a specific subset of DOS and BIOS calls that can be made by protected mode DOS programs."
Basically it means that it enables to write DOS programs without classic DOS limitations. Since DPMI is also supported in newer operating systems (Windows), it means that properly written DOS applications can work there as well. If there are new DOS application written at this time (at least DOS ports of games like Nethack, Angband etc. are still being produced), they use DPMI.
DPMI can be used directly or indirectly (by DOS extenders like DOS4GW.EXE - this feature enables those games to work in Windows).

In version 0.60 DOSBOX provided internal DPMI server switchable in DOSBOX.CONF (option "dpmi"). Since version 0.61 this server will be probably removed (it may or may not be still accessible in debug version of DOSBOX). DOSBOX should now be able to use external DPMI servers, which are usually provided with programs requiring DPMI. A lot of DPMI supporting programs can work both with or without DPMI (for example programs using DOS4GW.EXE extender.
However it still usefull to know about DPMI, because there are programs which need it, or the program contains DPMI not working in DOSBOX or (because of a different bug) the program does not work in version without DPMI.

DPMI servers
a) There are two basic types of DPMI: 16 bit and 32 bit. In majority cases 32 bit DPMI is used.
b) DPMI server installs itself just once, if a game with bundled DPMI server finds out that DPMI already exists, it uses what is available (not its own bundled server).
c) DPMI needs enough memory. So first thing to check (when there are DPMI problems) is setting of memory in DOSBOX.CONF (DOSBOX allows up to 64 MB).

16 bit DPMI
I met this only rarely. Apart from DPMI testing package I met just one game optionally using it (Ultima 8 ).
I tested one 16 bit DPMI client - the one probided with Borland DOS based Compilers (Borland C, Borland Pascal). It consists of about six files (DPMI*.*, RTM, RTMRES.EXE). I tested it by DPMI testing utilities after starting it by RTMRES.EXE and it seemed ok. It did not work with Ultima 8, but this could be some game specific problem. In any case it would be something to try if you have program with 16 bit DPMI. There may be some other DPMI servers on Internet. Or DOSBOX 0.60 can be used.

32 bit DPMI
This is widely used. 32 bit DPMI is optionally used by DOS4GW.EXE extender which means that it can be used by majority newer games. However since it is optional, there is usually no reason to use it. I mention it here because I met one game with this extender which crashed in DOSBOX without DPMI (because of some other DOSBOX bug). Installing DPMI enabled to run it.
Apart from the programs mentioned above, there are programs using directly DPMI which must have it. At present time these are usually some rogue-like games like Nethack, Angband, Moria etc. They usually come bundled with DPMI server CWSDPMI.EXE which is automatically run when DPMI is not available. It sounds simple but there are problems with some (or at least one) versions of CWSDPMI.EXE in DOSBOX. I tested these versions:

- b9 (Beta 9 (?)) (size 18135 Byte, packed by PkLite)
- release 3 (size 20217 Byte)
- release 4 (20473 Byte)

It is possible to see the version by running "CWSDPMI -p" (it installs itself as resident program and shows copyright).

The version "release 4" (probably the newest) has some problems with DOSBOX (tested in DOSBOX 0.61RC1). In its default configuration it crashes any DPMI using program in DOSBOX. The problem seems to be with swap file (see CSWDPMI.DOC). The method to avoid it is to switch off swap file (by parameter -s-) or to specify your own swap file in the current directory (e.g. -sa.swp specifies file a.swp). Since this must be done from command line it is necessary to run CSWDPMI separately.
NETHACK v3.3.1 contains "release 4" version of CSWDPMI.EXE. So trying to start "nethack.exe" directly crashes DOSBOX. The solution is simple, start CSWDPMI separately:

CWSDPMI -p -s-

The first line start CWSDPMI, telling it to remain resident (-p) and not to use swap file (-s-). The second starts NETHACK.
The same applies for any other DPMI program/game.

DOSBox Moderator
Posts: 1697
Joined: 2003-8-21 @ 04:19


Postby mirekluza » 2004-1-30 @ 10:50

The DOSBOX now runs correctly wth CWSDPMI release 4 and release 5 (at least various rogue like games like Nethack are ok). Therefore the above mentioned method how to use CWSDPMI release 4 is no longer needed.
But the rule remains: when some DPMI game does not work, try to use different DPMI server or try to configure the server differenly. This enables to find out where the bug really is (in DPMI server or in the game).

DOSBox Moderator
Posts: 1697
Joined: 2003-8-21 @ 04:19

Return to DOSBox Guides

Who is online

Users browsing this forum: No registered users and 0 guests