Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Support for real-mode MS-DOS: still worthwhile?

211 views
Skip to first unread message

Ray Chason

unread,
Feb 8, 2005, 8:36:30 PM2/8/05
to
Just to see if it could still be done, or if maybe it was time to drop
support for it, I tried to make a 16-bit MS-DOS build of NetHack. I was
indeed able to get it to run, although it doesn't exactly dance.

The necessary tweaks to the code were surprisingly few:

* In eat.c, the function "maybe_finished_meal" is defined in OVL1,
but references the static variable "victual" in OVLB. The easiest
thing to do was to move the function to OVLB.

* In invent.c, the function "display_pickinv" is declared static,
but referenced from another overlay. It is redeclared with the
STATIC_DCL and STATIC_OVL macros.

* In objnam.c, the function "nextobuf" is likewise declared static,
but referenced from another overlay. It is redeclared with the
STATIC_DCL and STATIC_OVL macros.

It was also necessary to add mapglyph.o to the schema files, schema1.BC
and schema2.BC, and to modify the makefile to fix some syntax that this
particular version of Make didn't understand. I imagine that the file
schema3.MSC also needs to be modified, but I leave the build on the
Microsoft compiler as an exercise for the reader.

With this done, and schema 2 selected, the program compiled...but was too
big to run, asking for about 43,800 bytes more memory. This is on a
Windows XP box on which the MEM command reports:

655360 bytes total conventional memory
655360 bytes available to MS-DOS
598480 largest executable program size

1048576 bytes total contiguous extended memory
0 bytes available contiguous extended memory
941056 bytes available XMS memory
MS-DOS resident in High Memory Area

Borland's compilers have tended to generate larger code with each new
version, and perhaps using 3.1, as the makefile comment suggests, might
get this build under size.

As it was, I used 4.52. Linking in NOEHL.LIB was helpful, cutting the
memory requirement by about 20K. (The libraries use some C++ exception
handlers internally, which are quite large; NOEHx.LIB replaces them
with smaller stubs.) Cutting out tile support also helped, and got the
program to run.

I played a short game as a Tourist, and rather quickly got myself killed.

The program felt quite sluggish, taking a slight but noticeable moment to
respond to the keyboard. This was on a 2.4 GHz Celeron. I shudder to
think how it might have responded on an original IBM PC.

Back to the memory requirement. Even with schema 2, which is set up to
place everything possible in the overlays, Nethack needed practically the
whole lower 640K to run. In particular, it needed, as MEM reported,
MS-DOS resident in the High Memory Area.

But if you even *have* a High Memory Area, then you have at least a 286.
Even if using an earlier compiler might further shrink the requirement,
Nethack is already close to demanding more than an 8088-based PC can give.
There is, it seems, already a minimum requirement of a 286; and if there
is not, there likely will be in some future version.

Maybe it's time to drop support for the real-mode build. If it is still
desirable to support Nethack on a 286, it may be possible to find, or
write, a suitable 16-bit DOS extender, leaving no need to put up with
overlays. Cutting out overlays would remove some of the clutter from
the code without impairing the builds for more modern hardware.

Here is a patch that makes the necessary changes, and creates the exact
makefile that I used to build a real mode Nethack.

--CUT HERE--CUT HERE--CUT HERE--CUT HERE--CUT HERE--CUT HERE--CUT HERE--
diff -U 3 -r nethack-3.4.3/src/eat.c nethack-3.4.3-msdos16/src/eat.c
--- nethack-3.4.3/src/eat.c Sun Dec 07 18:39:13 2003
+++ nethack-3.4.3-msdos16/src/eat.c Mon Feb 07 22:56:49 2005
@@ -2563,9 +2563,6 @@
}
}

-#endif /* OVLB */
-#ifdef OVL1
-
/* called when eatfood occupation has been interrupted,
or in the case of theft, is about to be interrupted */
boolean
@@ -2581,6 +2578,6 @@
return FALSE;
}

-#endif /* OVL1 */
+#endif /* OVLB */

/*eat.c*/
diff -U 3 -r nethack-3.4.3/src/invent.c nethack-3.4.3-msdos16/src/invent.c
--- nethack-3.4.3/src/invent.c Sun Dec 07 18:39:13 2003
+++ nethack-3.4.3-msdos16/src/invent.c Mon Feb 07 22:57:21 2005
@@ -19,7 +19,7 @@
STATIC_DCL boolean FDECL(putting_on, (const char *));
STATIC_PTR int FDECL(ckunpaid,(struct obj *));
STATIC_PTR int FDECL(ckvalidcat,(struct obj *));
-static char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *));
+STATIC_DCL char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *));
#ifdef OVLB
STATIC_DCL boolean FDECL(this_type_only, (struct obj *));
STATIC_DCL void NDECL(dounpaid);
@@ -1689,7 +1689,7 @@
* inventory and return a count as well as a letter. If out_cnt is not null,
* any count returned from the menu selection is placed here.
*/
-static char
+STATIC_OVL char
display_pickinv(lets, want_reply, out_cnt)
register const char *lets;
boolean want_reply;
diff -U 3 -r nethack-3.4.3/src/objnam.c nethack-3.4.3-msdos16/src/objnam.c
--- nethack-3.4.3/src/objnam.c Sun Dec 07 18:39:13 2003
+++ nethack-3.4.3-msdos16/src/objnam.c Mon Feb 07 22:56:11 2005
@@ -13,7 +13,7 @@
#ifdef OVLB
static boolean FDECL(wishymatch, (const char *,const char *,BOOLEAN_P));
#endif
-static char *NDECL(nextobuf);
+STATIC_DCL char *NDECL(nextobuf);
static void FDECL(add_erosion_words, (struct obj *, char *));

struct Jitem {
@@ -77,7 +77,7 @@
#ifdef OVLB

/* manage a pool of BUFSZ buffers, so callers don't have to */
-static char *
+STATIC_OVL char *
nextobuf()
{
static char NEARDATA bufs[NUMOBUF][BUFSZ];
diff -U 3 -r nethack-3.4.3/sys/msdos/Makefile.BC
nethack-3.4.3-msdos16/sys/msdos/Makefile.BC
--- nethack-3.4.3/sys/msdos/Makefile.BC Sun Dec 07 18:39:13 2003
+++ nethack-3.4.3-msdos16/sys/msdos/Makefile.BC Tue Feb 08 00:34:56 2005
@@ -54,7 +54,7 @@
UUDECODE = uudecode # Unix style uudecoder

#BCTOP = c:\borlandc # main Borland C++ directory
-BCTOP = c:\bc31
+BCTOP = c:\bc45

#
# Yacc/Lex ... if you got 'em.
@@ -164,7 +164,7 @@
# "video".
#

-TILESUPPORT = Y
+TILESUPPORT = N

#
# C COMPILER AND LINKER SETTINGS
@@ -329,9 +329,10 @@
#

LWCASE = /c # treat case as significant
-LMAP = /m # create map file
+LMAP = /s # create map file
LINIT = $(BCLIB)\C0$(MODEL) # initialization object file
LOVL = /oOVLY # overlay all needed segments
+LEXC = $(BCLIB)\NOEH$(MODEL).LIB

#
# Stack Sizes
@@ -481,7 +482,7 @@

LFLAGSU = $(LDFLAGSU) $(LUSTACK) $(LINIT)
LFLAGSN = $(LDFLAGSN) $(LNSTACK) $(LWCASE) $(LMAXSEG) $(INTOVL) $(LMAXALL) \
- $(LINFO) $(LINIT) $(LOVL)
+ $(LMAP) $(LINFO) $(LINIT) $(LEXC) $(LOVL)

#
# Make Roolz dude.
@@ -1001,21 +1002,21 @@

#
# Inline files :
-# Specifying the "<<" means to start an inline file.
-# Another "<<" at the start of a line closes the
+# Specifying the "&&!" means to start an inline file.
+# Another "!" at the start of a line closes the
# inline file.
#
-# DO NOT INDENT THE << below!
+# DO NOT INDENT THE ! below!
#

$(GAMEFILE) : $(ALLOBJ)
@echo Linking....
- $(LINK) $(LFLAGSN) @<<$(GAME).lnk
+ $(LINK) $(LFLAGSN) @&&!
$(ALLOBJ)
$(GAMEFILE)
$(GAME)
$(TERMLIB) $(MOVETR) $(CLIB) $(BCOVL) $(BCMDL)
-<<
+!
@if exist $(GAMEDIR)\$(GAME).bak del $(GAMEDIR)\$(GAME).bak

#
@@ -1273,28 +1274,28 @@
#

$(U)gif2txt.exe: $(GIFREADERS) $(TEXT_IO)
- @$(LINK) $(LFLAGSU) << $(@B).lnk
+ @$(LINK) $(LFLAGSU) &&!
$(GIFREADERS) $(TEXT_IO)
$@,,$(CLIB) $(BCMDL)
-<<
+!

$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
- @$(LINK) $(LFLAGSU) << $(@B).lnk
+ @$(LINK) $(LFLAGSU) &&!
$(PPMWRITERS) $(TEXT_IO)
$@,,$(CLIB) $(BCMDL);
-<<
+!

$(U)gif2txt2.exe: $(GIFREAD2) $(TEXT_IO2)
- @$(LINK) $(LFLAGSU) << $(@B).lnk
+ @$(LINK) $(LFLAGSU) &&!
$(GIFREAD2) $(TEXT_IO2)
$@,,$(CLIB) $(BCMDL);
-<<
+!

$(U)txt2ppm2.exe: $(PPMWRIT2) $(TEXT_IO2)
- @$(LINK) $(LFLAGSU) << $(@B).lnk
+ @$(LINK) $(LFLAGSU) &&!
$(PPMWRIT2) $(TEXT_IO2)
$@,,$(CLIB) $(BCMDL);
-<<
+!

#
# Required for tile support
@@ -1376,7 +1377,7 @@
@echo dungeon >>dlb.lst
@echo license >>dlb.lst
@echo msdoshlp.txt >>dlb.lst
- @for %%N in (*.lev) do echo %%N >>dlb.lst
+ @for %N in (*.lev) do echo %N >>dlb.lst
$(U)dlb_main cvIf dlb.lst $(SRC)\nhdat
@cd $(SRC)

diff -U 3 -r nethack-3.4.3/sys/msdos/schema1.BC
nethack-3.4.3-msdos16/sys/msdos/schema1.BC
--- nethack-3.4.3/sys/msdos/schema1.BC Sun Dec 07 18:39:13 2003
+++ nethack-3.4.3-msdos16/sys/msdos/schema1.BC Mon Feb 07 22:54:12 2005
@@ -101,6 +101,7 @@
-zCmakemon_1 -zAOVLY -zCOVL71
-zCmakemon_2 -zAOVLY -zCOVL72
-zCmakemon_b -zAOVLY -zCOVL73
+-zCmapglyph_o
-zCmcastu_0 -zAOVLY -zCOVL74
-zCmcastu_b -zAOVLY -zCOVL75
-zCmhitm_0 -zAOVLY -zCOVL76
diff -U 3 -r nethack-3.4.3/sys/msdos/schema2.BC
nethack-3.4.3-msdos16/sys/msdos/schema2.BC
--- nethack-3.4.3/sys/msdos/schema2.BC Sun Dec 07 18:39:13 2003
+++ nethack-3.4.3-msdos16/sys/msdos/schema2.BC Mon Feb 07 22:54:25 2005
@@ -97,6 +97,7 @@
-zCmakemon_1 -zAOVLY -zCOVL85
-zCmakemon_2 -zAOVLY -zCOVL86
-zCmakemon_b -zAOVLY -zCOVL87
+-zCmapglyph_o
-zCmcastu_0 -zAOVLY -zCOVL88
-zCmcastu_b -zAOVLY -zCOVL89
-zCmhitm_0 -zAOVLY -zCOVL90
--CUT HERE--CUT HERE--CUT HERE--CUT HERE--CUT HERE--CUT HERE--CUT HERE--

--
--------------===============<[ Ray Chason ]>===============--------------
The War on Terra is not meant to be won.
Delendae sunt RIAA, MPAA et Windoze

Chaos Master

unread,
Feb 8, 2005, 11:43:37 PM2/8/05
to
This is Ray Chason for forever:

> Just to see if it could still be done, or if maybe it was time to drop
> support for it, I tried to make a 16-bit MS-DOS build of NetHack. I was
> indeed able to get it to run, although it doesn't exactly dance.

I would drop support for 16-bit MS-DOS... nobody seems to use a 8086 or
286 PC anymore.

IME, NetHack needs a 486 to be playable well enough.

[]s
--
Chaos Master®, posting from Canoas, Rio Grande do Sul, Brazil - 29.55° S
/ 51.11° W / GMT-2h / 15m .

"People told me I can't dress like a fairy.
I say, I'm in a rock band and I can do what the hell I want!"
-- Amy Lee

(My e-mail address isn't read. Please reply to the group!)

Jesse Meyer

unread,
Feb 9, 2005, 4:57:55 AM2/9/05
to
Chaos Master <renan...@ibestvip.com.br> wrote:
> This is Ray Chason for forever:
>> Just to see if it could still be done, or if maybe it was time to drop
>> support for it, I tried to make a 16-bit MS-DOS build of NetHack. I was
>> indeed able to get it to run, although it doesn't exactly dance.
>
> I would drop support for 16-bit MS-DOS... nobody seems to use a 8086 or
> 286 PC anymore.
>
> IME, NetHack needs a 486 to be playable well enough.

A few years ago, I played NetHack on a 486. Worked fine, no lag that I
noticed. I would expect that the current version would run at about the
same speed.

ADOM, OTOH, was laggy. :(

Nethack: The most efficient popular roguelike? ;)

--
With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead. -- RFC 1925

Raymond Martineau

unread,
Feb 9, 2005, 11:43:19 AM2/9/05
to
On Wed, 9 Feb 2005 03:57:55 -0600, Jesse Meyer
<meyer_sp...@ideaone.net> wrote:

>Chaos Master <renan...@ibestvip.com.br> wrote:
>> This is Ray Chason for forever:
>>> Just to see if it could still be done, or if maybe it was time to drop
>>> support for it, I tried to make a 16-bit MS-DOS build of NetHack. I was
>>> indeed able to get it to run, although it doesn't exactly dance.
>>
>> I would drop support for 16-bit MS-DOS... nobody seems to use a 8086 or
>> 286 PC anymore.
>>
>> IME, NetHack needs a 486 to be playable well enough.
>
>A few years ago, I played NetHack on a 486. Worked fine, no lag that I
>noticed. I would expect that the current version would run at about the
>same speed.

That sounds correct.

>ADOM, OTOH, was laggy. :(

Adom is generally laggy because of a low-quality LOS code that isn't as
good as it could be. IIRC, there are ways to optimize it so that it can be
mour accurrate and run much faster.

>Nethack: The most efficient popular roguelike? ;)

IIRC, Angband on a 386 seemed to work quite well - or was I running it on a
Pentium 133? It's been so long that I don't remember which one I had at
the time. ;)

Of coruse, there's changes to the Angband's AI code that would cause it to
run slowly on low-end computers. But still, it's quite a close contender.

Svein Ove Aas

unread,
Feb 9, 2005, 5:38:30 PM2/9/05
to
Ray Chason wrote:

> Maybe it's time to drop support for the real-mode build. If it is still
> desirable to support Nethack on a 286, it may be possible to find, or
> write, a suitable 16-bit DOS extender, leaving no need to put up with
> overlays. Cutting out overlays would remove some of the clutter from
> the code without impairing the builds for more modern hardware.

Time to write NethackOS?
It would be a fun exercise.. I doubt it needs much in the way of an OS..

Chaos Master

unread,
Feb 9, 2005, 9:47:08 PM2/9/05
to
This is Jesse Meyer for forever:


> > IME, NetHack needs a 486 to be playable well enough.
>
> A few years ago, I played NetHack on a 486. Worked fine, no lag that I
> noticed. I would expect that the current version would run at about the
> same speed.
>
> ADOM, OTOH, was laggy. :(

ADOM is laggy on anything less than a Pentium 133 with 16MB RAM, as it
uses more processing power and holds more memory in stuff/swapping to
disk...

(Right now I play NH and ADOM on a 233MHz Pentium with 128MB RAM)

0 new messages