MS-DOS

From NetHackWiki
Revision as of 23:32, 25 March 2023 by Ray Chason (talk | contribs) (Release for 3.6.7)
Jump to navigation Jump to 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.

Few modern desktops run MS-DOS, and indeed Microsoft discontinued support for the product long ago. Nonetheless, most modern Wintels can play the MS-DOS version of NetHack 3.4.3 or the unofficial build for NetHack 3.6.7, as 32-bit versions of Windows and OS/2 can all run MS-DOS programs. DOSBox runs the MS-DOS NetHack on any platform that can run DOSBox.


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 should 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 greater 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 */
#endif
#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 */
#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 could 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 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 over the 640K limit, even with a minimal set of drivers loaded. Running it on an 8088-based PC is likely to be futile, and even a 286 should 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.

NetHack 3.6.0 through 3.6.5

The addition of special statue glyphs broke the MS-DOS port in NetHack 3.6.0. The default tileset has more colors than the VGA code can handle.

NetHack 3.6.1 adds support for VESA BIOS Extensions, and falls back to the generic statue glyph if the original VGA mode is in use. It also changes the tileset format to a BMP, the same as Windows uses. The tile size is still limited to 16x16 and the colors to 256.

MS-DOS is still semi-officially supported. The code is in the distribution, but the DevTeam has not released an official binary. An unofficial binary distribution of 3.6.7 is available on Github.

NetHack 3.7 and beyond

The current development source adds two features to the MS-DOS port. One can cross-compile the port from Linux, which is much faster than on an emulated DOS machine. Also, the VESA BIOS support is much extended, and can now support an arbitrary tileset.

Microsoft Windows

Windows NT to Windows Vista

This section relates 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. 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. Users of PowerPC or 64-bit versions of Windows must use an emulator.

If you have not enabled VGA graphics mode, the game runs 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 runs full screen, either in tiled mode or drawing the ASCII and IBMgraphics characters on the graphical screen. Attempting to switch to a terminal window causes the game to suspend; this is a limitation of Windows and NetHack cannot overcome it, but it does not harm your game in any way; you can safely switch back to it and keep playing.

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 any sprite-graphics. The MS-DOS version of NetHack still runs but is limited to text mode.

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

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 QEMU with a copy of FreeDOS installed inside, or with DOSBox.

Of course it may not be worth the trouble. 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.

Apple macOS

Users of 68K, PowerPC, or Intel Macs must use an emulator.

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

GNU/Linux

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

In DOSBox, NetHack appears in a window whether in tiled or text mode.

Use of DOSEMU is not recommended. DOSEMU crashes if NetHack is run within it.

References

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

This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.4. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-364}} tag to the current version's tag or {{noversion}} as appropriate.