[comp.sources.bugs] PC Nethack 2.2 bugs + help wanted linking

creps@silver.bacs.indiana.edu (Steve Creps) (12/07/87)

   I've gotten this baby compiled after fixing a few errors, but still not
working. Here are the errors I found:

pcmain.c: line 135: insert an #endif line for "#ifdef WIZARD".

options.c: 446: append a ; to this line

pcunix.c: lines 17, 20: take out the "sys/"

	: lines 94, 108, 118, 127, 147: Change the slashes (/) to backslashes
	since they are used in MS-DOS instead of slashes. Also, you'll need
	two backslashes, since one backslash means to use the next character
	literally. Summary: change "/" to "\\".

   Now to ask for help linking. It links with no error or warning messages,
but every time I run it I get "Error 2000: stack overflow." I've tried
/STACK:4000, /STACK:65536, values in between, and even /STACK:0xa00, which
used to work on the old version of Nethack, but always get a stack overflow.
Anyone have any ideas?

-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
	creps@silver.bacs.indiana.edu
"F-14 Tomcat! There IS no substitute."

rick@pcrat.UUCP (Rick Richardson) (12/08/87)

In article <492@silver.bacs.indiana.edu> creps@silver.UUCP (Steve Creps) writes:
>
>   Now to ask for help linking. It links with no error or warning messages,
>but every time I run it I get "Error 2000: stack overflow."

I can't even get a link with MS C 5.0.  Complains about stack and data >64K.

I got a successful link under VENIX 2.3 with the AT&T large model SGS
(same compiler as microport, PC6300+), but it dumps core when I try
to throw or zap.  Unfortunately, neither adb nor sdb are up to dealing
with a program this size.

To save a lot of grief, I'd like to just snag a binary copy that works.
VENIX 2.3 can run either VENIX or Microport binaries.  And I'd also
like an MS-DOS binary for friends and family.  Anyone willing to make
these available for uucp'ing?
-- 
	Rick Richardson, President, PC Research, Inc.
(201) 542-3734 (voice, nights)   OR   (201) 834-1378 (voice, days)
		seismo!uunet!pcrat!rick

iverson@cory.Berkeley.EDU (Tim Iverson) (12/08/87)

In article <492@silver.bacs.indiana.edu> creps@silver.UUCP (Steve Creps) writes:
>pcmain.c: line 135: insert an #endif line for "#ifdef WIZARD".
yup.
>options.c: 446: append a ; to this line
yup.
>pcunix.c: lines 17, 20: take out the "sys/"
not necesary on my system - bastardized msc4.0

>	: lines 94, 108, 118, 127, 147: Change the slashes (/) to backslashes
>	since they are used in MS-DOS instead of slashes. Also, you'll need
>	two backslashes, since one backslash means to use the next character
>	literally. Summary: change "/" to "\\".

MS-DOS will cheerfully support "/" as well as "\" for system calls: this
fix isn't needed.

>   Now to ask for help linking. It links with no error or warning messages,
>but every time I run it I get "Error 2000: stack overflow." I've tried
>/STACK:4000, /STACK:65536, values in between, and even /STACK:0xa00, which
>used to work on the old version of Nethack, but always get a stack overflow.
>Anyone have any ideas?

This one got me too.  What you need is 1) do not specify -Gs (no stack
checking on runtime), 2) use "/noi /stack:0xf00 /seg:1024" for the linker
switches, and 3) use "-Gt32" on the compiler (MSC4.0) to set the threshold
at which objects are placed in their own separate segment.  A lower threshold
would allow a larger stack, but this works so far and I'm not about to
recompile everything again.

Once you get it compiled and able to run, you will realize several other
problems:  the GRAPHICS code still has the same old machine dependent word
order bug, the MSDOSCOLOR option is very ugly and can't be changed without
recompiling - should have been done with a different termcap file instead of
coded in, cursor optimization is real lame and doesn't work (doesn't
optimize and doesn't put the cursor in the right place), the nethack.cnf
file is very broken.  In essence, 2.2 is just as much of a "hack" as the old
version.  The maze vertical wall is still horizontal (why? why?).  If you
can wait 'till next week, I'll post my fixes.


- Tim Iverson
  iverson@cory.Berkeley.EDU
  ucbvax!cory!iverson

tim@doug.UUCP (Tim J Ihde) (12/09/87)

In article <428@pcrat.UUCP>, rick@pcrat.UUCP (Rick Richardson) writes:
> 
> I can't even get a link with MS C 5.0.  Complains about stack and data >64K.
> 

This means that the default data segment, which contains initialized global
data and the stack, is larger than 64K.  With the good 'ol *86 machines,
this is the big nono.  What you need to do to get around this is to look
at some of the files that contain lots of initialized globals and tell
the compiler to use a segment other than the default for that modules data.
I don't remember the exact files I used, but it seems that one of the
shopkeeper files was a good candidate.

The syntax for telling the compiler to move initialized data to segment
other than the default is to add:

	-Au -ND MOREDATA

to the MSC command line.  This will create a separate data segment for this
module called MOREDATA and put all initialized data into it.  Append this
ONLY for the files that have lots of data.  Once this is done the linker
should not complain.  You will probably have to do this for several files,
but hey - that's the fun of segments. :-)

		tim

PS	This technique was developed with the old version of NETHACK, I
	haven't actually tried 2.2 yet.  Must download all the files
	first . . .

-- 
Tim J. Ihde					ihnp4!ctsmain!doug!tim
(201) 535-9897

Ok, we can all agree that this is my fault.

rick@pcrat.UUCP (Rick Richardson) (12/10/87)

In article <384@doug.UUCP> tim@doug.UUCP (Tim J Ihde) writes:
>In article <428@pcrat.UUCP>, rick@pcrat.UUCP (Rick Richardson) writes:
>> I can't even get a link with MS C 5.0.  Complains about stack and data >64K.
>other than the default is to add:
>
>	-Au -ND MOREDATA
>
>to the MSC command line.  This will create a separate data segment for this
>module called MOREDATA and put all initialized data into it.  Append this

I just tried recompiling:
	cl -c -AL -ND MOREDATA shknam.c
And lo... I got a successful link.  Thanks.  I also, in a previous attempt,
used '-Gt1' on all the files, so that may have had some effect too.  Who
knows.

However, moving around a bit in the maze (all the wall chars are wrong),
and whammo PC resets.  Doesn't look like 2.2 will be under the tree
this year.  I'm going to try one more attempt, this time with all
optimizations turned off.
-- 
	Rick Richardson, President, PC Research, Inc.
(201) 542-3734 (voice, nights)   OR   (201) 834-1378 (voice, days)
		seismo!uunet!pcrat!rick

mk59200@tut.fi (Kolkka Markku Olavi) (12/10/87)

I have successfully compiled and linked Nethack using MSC 4.0
and it looks great, exept in a few points.  The inventory
display is spread all over the screen if there aren't enough
items to force a full-screen display.  It seems that after 
printing each line the cursor is moved one step down, but
it doesn't move left to the right place.

Also, when I teleport away from an unlit room, some quote characters
are left behind around the place I was in.

Markku Kolkka at Tampere University of Technology, Finland
mk59200@tut.fi
...mcvax!tut!mk59200