MS-DOS

MS-DOS is the Microsoft Disk Operating System, the most common operating system on PCs make before about 1995.

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. 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.

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

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 and beyond
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.

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.

Today
MS-DOS remains a supported NetHack platform. Most players with PCs can play the MS-DOS version of NetHack, as 32-bit versions of Windows and OS/2 can all run MS-DOS programs. Even Linux users, as long as they are running a 32-bit version on PC hardware, can play the MS-DOS version through DOSEMU.

Players who cannot play the MS-DOS NetHack are those with pre-386 PCs; those with 64-bit hardware running 64-bit operating systems (which don't support the 16-bit code needed to start the DOS extender); and, of course, those with Macs or other non-PC hardware.