From NetHackWiki
(Redirected from DOS)
Jump to: navigation, search

MS-DOS is the Microsoft Disk Operating System, the most common operating system on PCs made in 1984.

This article deals mainly with support for Hack and NetHack, in versions past and present, on MS-DOS. For a more general view, see the Wikipedia article on MS-DOS.

Operating System Support for the MS-DOS Version of NetHack

Few modern PCs run MS-DOS, and indeed Microsoft discontinued support for the product long ago. Nonetheless, most modern PCs can run the MS-DOS version of NetHack.

On Microsoft Windows

Versions prior to Windows Vista

This section describes the behavior of NetHack on Windows NT, Windows 2000, and Windows XP. Other versions of Windows (in particular Windows 95, Windows 98, and Windows Me) may behave differently, particularly in tiled mode.

Microsoft Windows users can run the MS-DOS version of NetHack, as long as they are running a version for 32-bit Pentium hardware. Users of PowerPC or 64-bit versions of Windows will have to use an emulator.

If you have not enabled VGA graphics mode, the game will run in a terminal window in text mode. You can switch to full screen mode and back by pressing Alt-Enter; this is a feature of Windows and applies to all programs running in terminal windows, not just NetHack.

If you have uncommented the line "#OPTIONS=video:autodetect" in your NetHack.cnf file, the game will run full screen, either in tiled mode or drawing the ASCII and IBMgraphics characters on the graphical screen. Attempting to switch to a terminal window will cause the game to suspend; this is a limitation of Windows and NetHack cannot overcome it. (It won't harm your game in any way; just switch back to it and keep playing.)

Windows Vista

Windows Vista does not support terminal windows in full screen mode. This applies to both MS-DOS programs and text-mode Win32 programs. This limitation prevents MS-DOS programs from using graphics of any kind. The MS-DOS version of NetHack will still run, but will be limited to text mode.

On OS/2

OS/2 users can run the MS-DOS version of NetHack, unless they have the (very rare) PowerPC version.

NetHack on OS/2 works much as it does on Windows, except that the key to switch to full screen mode is Alt-Home.

On Linux

Users of x86 versions of Linux can run the MS-DOS version of NetHack by using DOSEMU. See the website for your distribution for instructions to obtain and install DOSEMU, or build from source.

In DOSEMU, NetHack will appear in a window whether in tiled or text mode.

On Mac

Those users of 68K, PowerPC, or Intel Macs will have to use an emulator (see below).

This page is a stub. Should you wish to do so, you can contribute by expanding this page.

In Emulation

NetHack tiled view on FreeDOS under QEMU

Non-x86 platforms, and AMD64 platforms running 64-bit operating systems, do not support MS-DOS programs directly. They can run the MS-DOS version of NetHack by using an emulator such as DOSEMU, Bochs or QEMU with a copy of FreeDOS installed inside, or with DOSBox. Of course it may not be worth the trouble.

OS X users can use a Mac-specific version of DOSBox called Boxer.

AMD64 platforms running 32-bit operating systems behave the same as Pentium hardware, and can run MS-DOS programs if the operating system supports them.

AMD64-compatible operating systems could, in principle, support MS-DOS. Developers of these operating systems have thus far concluded that it is not worth the effort; it requires some complicated mode-switching code in the kernel, which in turn would have to be debugged and checked for security problems.

Game History on MS-DOS

PCs running MS-DOS had significant limitations compared to contemporary systems such as early Macs, Amigas, and Atari STs; NetHack would in time have to deal with these limitations.

Hack on MS-DOS

The original releases of Hack by Andries Brouwer supported only BSD Unix, but several third-party ports were created for other systems. Among these were the PC Hack series by Don Kneller. PC Hack 1.01 and 1.01e were based on Hack 1.0.1. Later releases included PC Hack 1.03, 3.0, 3.51 and 3.6, all based on Hack 1.0.3 and eventually implementing an early form of IBMgraphics.

The PC Hacks were distributed on BBSes and by shareware dealers, because few PC users at the time had access to the Internet.

NetHack 1.3d through 2.3e

NetHack 1.3d included support for MS-DOS in the mainline code for the first time. It included a Makefile for Microsoft C 3.0 and even came with a "make" program to interpret this Makefile.

NetHack 1.4f added support for Borland's Turbo C product.

As home access to the Internet was still uncommon, these PC NetHacks were also distributed on BBSes and by shareware dealers.

NetHack 3.0.0 through 3.0.5

MS-DOS provides only 640 kilobytes of memory space for all programs, drivers, and the MS-DOS kernel itself. Hack and NetHack through NetHack 2.3e were small enough to fit in this space without any special measures; but NetHack 3.0.0 was a much larger program and would overflow this space if built with all features enabled.

NetHack 3.0.0 through NetHack 3.0.10 have an impressive list of compile-time options, any of which can be turned off to reduce the size of the final program at the expense of producing a game that lacked some of the advanced features. Here is the list from the NetHack 3.0.10 config.h:

/* game features */
#define POLYSELF      /* Polymorph self code by Ken Arromdee */
#define THEOLOGY      /* Smarter gods - The Unknown Hacker */
#define SOUNDS        /* Add more life to the dungeon */
#define KICK          /* Allow kicking things besides doors -Izchak Miller */
/* dungeon features */
#define THRONES       /* Thrones and Courts by M. Stephenson */
#define FOUNTAINS     /* Fountain code by SRT (+ GAN + EB) */
#define SINKS         /* Kitchen sinks - Janet Walz */
#define ALTARS        /* Sacrifice sites - Jean-Christophe Collet */
/* dungeon levels */
#define WALLIFIED_MAZE /* Fancy mazes - Jean-Christophe Collet */
#define REINCARNATION /* Rogue-like levels */
#define STRONGHOLD    /* Challenging special levels - Jean-Christophe Collet*/
/* monsters & objects */
#define ORACLE        /* Include another source of information */
#define MEDUSA        /* Mirrors and the Medusa by Richard P. Hughey */
#define KOPS          /* Keystone Kops by Scott R. Turner */
#define ARMY          /* Soldiers, barracks by Steve Creps */
#define WORM          /* Long worms */
#define GOLEMS        /* Golems, by KAA */
#define INFERNO       /* Demons & Demonlords */
#ifdef INFERNO
#define SEDUCE        /* Succubi/incubi additions, by KAA, suggested by IM */
#define TOLKIEN       /* More varieties of objects and monsters */
#define PROBING       /* Wand of probing code by Gil Neiger */
#define WALKIES       /* Leash code by M. Stephenson */
#define SHIRT         /* Hawaiian shirt code by Steve Linhart */
#define MUSIC         /* Musical instruments - Jean-Christophe Collet */
#define TUTTI_FRUTTI  /* Fruits as in Rogue, but which work... -KAA */
#define SPELLS        /* Spell casting by M. Stephenson */
#define NAMED_ITEMS   /* Special named items handling */
/* difficulty */
#define ELBERETH      /* Allow for disabling the E word - Mike 3point */
#define EXPLORE_MODE  /* Allow non-scoring play with additional powers */
#define HARD          /* Enhanced wizard code by M. Stephenson */
/* I/O */
#define REDO          /* support for redoing last command - DGK */
#define COM_COMPL     /* Command line completion by John S. Bien */
#ifndef AMIGA
#define CLIPPING      /* allow smaller screens -- ERS */

From NetHack 3.0.0 through 3.0.5, cutting out features from the above list was the only way to get a NetHack that would run on an MS-DOS PC.

NetHack 3.0.6 through 3.0.10

NetHack 3.0.6 added support for overlays. An overlay is a piece of executable code that is not always loaded into memory. It is loaded when it is needed, possibly displacing some other overlay. With overlay support, a full-featured 3.0-series NetHack could be played on MS-DOS for the first time.

NetHack 3.0.7 allowed the source files to be divided into smaller pieces, each of which could be a separate overlay. This finer-grained overlay system improved the performance of the program. The support for this division is still present in NetHack 3.4.3, though in disuse; look for directives such as "#ifdef OVL0" and for such preprocessor symbols as STATIC_DCL.

Overlays remained the preferred way to build an MS-DOS NetHack through NetHack 3.0.10.

NetHack 3.1.0 through 3.3.1

By the time that NetHack 3.1.0 was released in 1993, PCs based on the 386 chip were in widespread use. These could operate in protected mode, allowing use of more than the 640K of memory accessible to MS-DOS.

MS-DOS, however, cannot operate in protected mode. The DOS extender was introduced to solve this problem. A DOS extender switches the CPU to protected mode before running the program to which it is bound, and then switches back to real mode whenever it is necessary to enter MS-DOS for any reason.

DJGPP is a port of the GNU C compiler and related tools to MS-DOS, bundled with a DOS extender. NetHack 3.1.0 was the first version offered with an official version built with the DJGPP tools.

The earlier 286 chip can also run in protected mode, but not in a way that the DJGPP tools can support.

Programs built with DJGPP require a 386 to run, and so at first the overlaid versions of NetHack continued to be supported; thus there were two MS-DOS NetHacks, and neither could use the other's bones and save files. In time, however, pre-386 PCs were retired from service, and NetHack continued to grow, eventually straining the overlay system. The overlaid version flickered in and out of supported status; the last NetHack to offer it officially was NetHack 3.3.1.

NetHack 3.4.0 through NetHack 3.4.3

Beginning with NetHack 3.4.0, only the DJGPP version of NetHack has had any official support from the DevTeam. The makefiles and preprocessor support for the overlaid version are still present, but are no longer supported. A recent attempt to build an overlaid NetHack 3.4.3 showed this infrastructure to be slightly broken; it was furthermore necessary to cut out tile support to get the program to fit. [1]

An overlaid NetHack 3.4.3 ends up being so large that the 640K limit can barely accommodate it, even with a minimal set of drivers loaded. Running it on an 8088-based PC is likely to be futile, and even a 286 will be hard-pressed to find enough room. A 386 can load drivers outside the 640K area, but a player with a 386 can run the DJGPP NetHack.


The DevTeam has not released an official binary of NetHack 3.6.0 for MS-DOS. The unmodified sources don't compile properly, mainly because new files are added to the final output and the tileset has additional colors to accommodate the new statue glyphs. The overlay system devised for NetHack 3.0.7 has mostly been removed, though traces remain, such as the STATIC_OVL symbol.

An unofficial binary is available on Github.

Most players with PCs can play the MS-DOS version of NetHack 3.4.3 or the unofficial build for 3.6.0, as 32-bit versions of Windows and OS/2 can all run MS-DOS programs. Linux users, as long as they are running a 32-bit version on PC hardware, can play the MS-DOS version through DOSEMU. Users of non-x86 Linux machines (and Intel Macs, PPC Macs, FreeBSD and BeOS users) can also play MS-DOS NetHack via DOSBOX.

Those players with pre-386 PCs are out of luck; NetHack demands more than their machines can give. They can upgrade or use an earlier version of NetHack.


  1. Ray Chason, Support for real-mode MS-DOS: still worthwhile?, February 8, 2005.