# Talk:NetHack 3.0.6
Overlays
"The MS-DOS port now has support for overlays". What is an overlay in the context of NetHack? How was the-thing-that-needs-overlays done before they were introduced into the MSDOS-version? --ZeroOne 22:15, 6 August 2006 (UTC)

NetHack 2.3e runs comfortably in the lower 640K of a DOS PC.  But 3.0 is so much larger that it can't fit without assistance.  This is perhaps why 3.0 has so many compile time options -- so parts of it can be cut out and some kind of NetHack 3.0 can run on a PC.
An overlay is a piece of the executable that is not resident in memory by default.  It is loaded when a function within it is called, possibly displacing some other overlay which is not currently in use.  This is a very crude way to allow the executable to be larger than main memory.
By adding support for overlays, NetHack 3.0.6 made it possible to run with all the features of the game on an ordinary MS-DOS PC.
Of course the Right Thing is protected mode operation, so that more than 640K of memory could be used.  This was eventually implemented in 3.1.0, and is in use to this day; but in 1989, PCs capable of protected mode operation were not yet on everyone's desk.  Overlays provided the greatest coverage of the PC world -- any PC, as long as it had 640K of memory, could play NetHack.
In 3.0.7, the overlay system became more fine-grained:  each source module could be broken into smaller pieces, each of which could be an overlay.  That's the reason for all the #ifdef OVLx crap you see in the 3.4.3 source code.
Though that infrastructure is still present, it's no longer supported.  What's more, it's slightly broken.  I was able to build an overlaid 3.4.3, but I had to tweak the code to do it, and I also had to cut out tile support.  See this RGRN post for details and a patch. -- Ray Chason 23:07, 6 August 2006 (UTC)