From: vaughan@ewd.dsto.gov.au (Vaughan Clarkson)
Newsgroups: rec.games.xtank.play,rec.games.xtank.programmer
Subject: Patches fo xtank 1.3e for HP 700s
Keywords: patch xtank hp
Date: 9 Sep 92 20:09:37 GMT
Organization: Defence Science and Technology Organisation, Salisbury, South Australia

I compiled xtank 1.3e and found a few bugs which needed to be fixed to get 1.3e
to work on the HPs.  I've included the patches below.

Maybe there should be an explicit warning in the README that the HPs will only
run correctly if a patch is made to the standard Imake.tmpl to turn off
dynamic linking with libraries?  (hint hint)

The stack size has been doubled in my patches, but I'm not sure if this is
really necessary.  Also, the patches have compiler optimising turned on
(since this seems to work).

Cheers
- Vaughan
-- 
Vaughan Clarkson                  ___________     Email: vaughan@ewd.dsto.gov.au
Computer Systems Engineer              |                   Phone: +61-8-259-6114
& Glider Pilot			       ^                     Fax: +61-8-259-5938
     ---------------------------------(_)---------------------------------

---------------------------------<cut here>-------------------------------------
Common subdirectories: /tmp/xtank1.3e/Bin and ./Bin
Common subdirectories: /tmp/xtank1.3e/Doc and ./Doc
Common subdirectories: /tmp/xtank1.3e/Help and ./Help
diff -c -r /tmp/xtank1.3e/Imake.tmpl ./Imake.tmpl
*** /tmp/xtank1.3e/Imake.tmpl	Wed Sep  9 13:34:49 1992
--- ./Imake.tmpl	Wed Sep  9 11:01:28 1992
***************
*** 687,693 ****
  
                 AR = ArCmd
    BOOTSTRAPCFLAGS = BootstrapCFlags	/* set if cpp does not have uniq sym */
!                CC = CcCmd
                 AS = AsCmd
  #if HasFortran
                 FC = FortranCmd
--- 687,693 ----
  
                 AR = ArCmd
    BOOTSTRAPCFLAGS = BootstrapCFlags	/* set if cpp does not have uniq sym */
!                CC = CcCmd -Wl,-a,archive
                 AS = AsCmd
  #if HasFortran
                 FC = FortranCmd
diff -c -r /tmp/xtank1.3e/Imake.tmpl ./Imake.tmpl/tmp/xtank1.3e/Imakefile.Config ./Imakefile.Config
*** /tmp/xtank1.3e/Imakefile.Config	Tue Sep  8 04:49:35 1992
--- ./Imakefile.Config	Wed Sep  9 11:00:57 1992
***************
*** 173,181 ****
  DEFINES2        = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \
  		-DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \
  		-DBATCH_COLOR_LINES \
! 		-DCODE_SIZE=0x20000 -DSTACK_SIZE=0x8000 $(ARCH_DEFINES)
  
! DEFINES         = -DXTANK_DIR=\"/src/pub/xtank\" $(DEFINES2) \
  		-DALLDEFINES="\"$(DEFINES2)\""
  
  /**/# Things that might need to be defined, for your particular machine
--- 173,181 ----
  DEFINES2        = -DX11 -DUNIX -DS1024x864 -DKEYPAD_DETECT \
  		-DSTINGY_REDRAW -DBATCH_LINES -DBATCH_POINTS \
  		-DBATCH_COLOR_LINES \
! 		-DCODE_SIZE=0x20000 -DSTACK_SIZE=0x10000 $(ARCH_DEFINES)
  
! DEFINES         = -DXTANK_DIR=\"/usr/local/games/lib/xtank\" $(DEFINES2) \
  		-DALLDEFINES="\"$(DEFINES2)\""
  
  /**/# Things that might need to be defined, for your particular machine
Only in .: Makefile
Common subdirectories: /tmp/xtank1.3e/Mazes and ./Mazes
Common subdirectories: /tmp/xtank1.3e/Programs and ./Programs
Common subdirectories: /tmp/xtank1.3e/Src and ./Src
Common subdirectories: /tmp/xtank1.3e/Todo and ./Todo
Common subdirectories: /tmp/xtank1.3e/Util and ./Util
Common subdirectories: /tmp/xtank1.3e/Vehicles and ./Vehicles
Only in .: players
diff -c -r /tmp/xtank1.3e/Bin/xtank ./Bin/xtank
*** /tmp/xtank1.3e/Bin/xtank	Sun Feb  2 08:30:59 1992
--- ./Bin/xtank	Wed Sep  9 11:28:37 1992
***************
*** 1,5 ****
  #!/bin/sh
! XTANK_DIR=/build/lidl/xtank
  XTANK_VEHICLES=Vehicles
  XTANK_MAZES=Mazes
  XTANK_PROGRAMS=Programs
--- 1,5 ----
  #!/bin/sh
! XTANK_DIR=/usr/local/games/lib/xtank
  XTANK_VEHICLES=Vehicles
  XTANK_MAZES=Mazes
  XTANK_PROGRAMS=Programs
***************
*** 12,37 ****
  #
  #FAKEIT=emacs				# should we disguise xtank as $FAKEIT ??
  
! if [ -f /usr/bin/arch ]; then		# a sun3/4 running SunOS 4.X
! 	arch=`/usr/bin/arch`
! elif [ -f /bin/arch ]; then		# a sun running 3.5, or an Ultrix Box
! 	arch=`/bin/arch`
! elif [ -f /bin/machine ]; then		# a mac or ultrix machine
! 	arch=`/bin/machine`
! elif [ -f /usr/ucb/arch ]; then		# something with SVR4
! 	arch=`/usr/ucb/arch`
! elif [ -f /usr/bin/machine ]; then	# a BSD 4.3 machine
! 	arch=`/usr/bin/machine`
! elif [ -d /usr/alliant ]; then		# an alliant FX/8 machine
! 	arch="alliant"
! elif [ -e /dev/speaker ]; then		# An IBM RT
! 	arch="rt"
! elif [ -d /NextApps ]; then		# A NeXT machine
! 	arch="next"
! else
! 	echo "I don't know what kind of machine I'm on, teach me!"
! 	exit 1
! fi
  
  if [ "X$arch" = "Xmips" -a -f /etc/ris ]; then
  	arch="mips-el"
--- 12,39 ----
  #
  #FAKEIT=emacs				# should we disguise xtank as $FAKEIT ??
  
! arch="hp9k8"
! 
! #if [ -f /usr/bin/arch ]; then		# a sun3/4 running SunOS 4.X
! #	arch=`/usr/bin/arch`
! #elif [ -f /bin/arch ]; then		# a sun running 3.5, or an Ultrix Box
! #	arch=`/bin/arch`
! #elif [ -f /bin/machine ]; then		# a mac or ultrix machine
! #	arch=`/bin/machine`
! #elif [ -f /usr/ucb/arch ]; then		# something with SVR4
! #	arch=`/usr/ucb/arch`
! #elif [ -f /usr/bin/machine ]; then	# a BSD 4.3 machine
! #	arch=`/usr/bin/machine`
! #elif [ -d /usr/alliant ]; then		# an alliant FX/8 machine
! #	arch="alliant"
! #elif [ -e /dev/speaker ]; then		# An IBM RT
! #	arch="rt"
! #elif [ -d /NextApps ]; then		# A NeXT machine
! #	arch="next"
! #else
! #	echo "I don't know what kind of machine I'm on, teach me!"
! #	exit 1
! #fi
  
  if [ "X$arch" = "Xmips" -a -f /etc/ris ]; then
  	arch="mips-el"
Only in ./Bin: xtank.hp9k8
Common subdirectories: /tmp/xtank1.3e/Doc/Src and ./Doc/Src
diff -c -r /tmp/xtank1.3e/Help/credits ./Help/credits
*** /tmp/xtank1.3e/Help/credits	Tue Sep  8 03:49:46 1992
--- ./Help/credits	Wed Sep  9 13:37:17 1992
***************
*** 35,41 ****
  Chris Moore        (moore@src.bae.co.uk)
          Teleport mode.
  
! Vaughan Clarkson   (vaughan@ewd.dsto.oz.au)
          HP code fixes, to hopefully get things working.
  
  Olaf Becker        (n9030166@rowlf.cc.wwu.edu)
--- 35,41 ----
  Chris Moore        (moore@src.bae.co.uk)
          Teleport mode.
  
! Vaughan Clarkson   (vaughan@ewd.dsto.gov.au)
          HP code fixes, to hopefully get things working.
  
  Olaf Becker        (n9030166@rowlf.cc.wwu.edu)
Only in ./Mazes: 4Goal1.m
Only in ./Mazes: 4Goal2.m
Only in ./Mazes: 4Goal3.m
Only in ./Mazes: 4Goal4.m
Only in ./Mazes: 4aside.m
Only in ./Mazes: Hockey2.m
Only in ./Mazes: Octo4Goal1.m
Only in ./Mazes: Octo4Goal2.m
Only in ./Mazes: Plus4Goal1.m
Common subdirectories: /tmp/xtank1.3e/Programs/Old and ./Programs/Old
Common subdirectories: /tmp/xtank1.3e/Programs/Old/Old and ./Programs/Old/Old
Only in ./Src: .version
Common subdirectories: /tmp/xtank1.3e/Src/Fixed-Point and ./Src/Fixed-Point
diff -c -r /tmp/xtank1.3e/Src/Imakefile ./Src/Imakefile
*** /tmp/xtank1.3e/Src/Imakefile	Mon Sep  7 06:44:09 1992
--- ./Src/Imakefile	Wed Sep  9 12:19:11 1992
***************
*** 6,14 ****
  
  #include "../Imakefile.Config"
  
!       CDEBUGFLAGS = -g
            DEPLIBS = $(DEPXLIB)
!   LOCAL_LIBRARIES = $(XLIB)
               SRCS = 3d.c XMultiSync.c actions.c animate.c box.c camo.c \
                      collision.c cosell.c disc.c display.c escher.c \
                      explosion.c file.c game.c gr.c graphics.c highlib.c \
--- 6,14 ----
  
  #include "../Imakefile.Config"
  
!       CDEBUGFLAGS = -O
            DEPLIBS = $(DEPXLIB)
!   LOCAL_LIBRARIES = -L/usr/lib/X11R4 $(XLIB) -lC
               SRCS = 3d.c XMultiSync.c actions.c animate.c box.c camo.c \
                      collision.c cosell.c disc.c display.c escher.c \
                      explosion.c file.c game.c gr.c graphics.c highlib.c \
Common subdirectories: /tmp/xtank1.3e/Src/Include and ./Src/Include
Only in ./Src: Makefile
Common subdirectories: /tmp/xtank1.3e/Src/Objects and ./Src/Objects
Common subdirectories: /tmp/xtank1.3e/Src/Old and ./Src/Old
Common subdirectories: /tmp/xtank1.3e/Src/Programs and ./Src/Programs
diff -c -r /tmp/xtank1.3e/Src/Imakefile ./Src/Imakefile/tmp/xtank1.3e/Src/file.c ./Src/file.c
*** /tmp/xtank1.3e/Src/file.c	Mon Aug 31 06:45:10 1992
--- ./Src/file.c	Wed Sep  9 11:11:05 1992
***************
*** 121,127 ****
--- 121,129 ----
  #include "globals.h"
  #ifdef UNIX
  #include <sys/param.h>
+ #ifndef	__hpux
  #include <sys/dir.h>
+ #endif
  #endif
  #if defined(SVR4) || defined(SYSV)
  #include <dirent.h>
diff -c -r /tmp/xtank1.3e/Src/file.c ./Src/file.c/tmp/xtank1.3e/Src/thread.c ./Src/thread.c
*** /tmp/xtank1.3e/Src/thread.c	Mon Sep  7 06:47:35 1992
--- ./Src/thread.c	Wed Sep  9 11:19:17 1992
***************
*** 224,230 ****
  #else
  	/* Stack grows upwards, SP in state[1]. Align to doubleword boundary */
  	/* This is rather ad-hoc... but seems to work. */
! 	thd->state[1] = ((unsigned) (thd + 2) + 100) & ~7;
  #endif
  #endif
  
--- 224,233 ----
  #else
  	/* Stack grows upwards, SP in state[1]. Align to doubleword boundary */
  	/* This is rather ad-hoc... but seems to work. */
! /*	thd->state[1] = ((unsigned) (thd + 2) + 100) & ~7; */
! 	{ unsigned * foo = (unsigned *)thd->state;
! 	foo[1] = ((unsigned) (thd + 2) + 100) & ~7;
! 	}
  #endif
  #endif
  
diff -c -r /tmp/xtank1.3e/Src/thread.c ./Src/thread.c/tmp/xtank1.3e/Src/version.c ./Src/version.c
*** /tmp/xtank1.3e/Src/version.c	Tue Sep  8 12:12:06 1992
--- ./Src/version.c	Wed Sep  9 12:30:05 1992
***************
*** 1,3 ****
  char *version1 = "Xtank UMDENG Release 1.3e";
! char *version2 = "Build #1: (xtank.sun4) Mon Sep  7 22:42:05 EDT 1992";
! char *version3 = "lidl@jolt.eng.umd.edu:/tmp/xtank/Src";
--- 1,3 ----
  char *version1 = "Xtank UMDENG Release 1.3e";
! char *version2 = "Build #5: (xtank.hp9k8) Wed Sep  9 12:30:05 CST 1992";
! char *version3 = "vaughan@oberon:/usr/local/games/lib/xtank1.3e/Src";
diff -c -r /tmp/xtank1.3e/Src/Programs/Imakefile ./Src/Programs/Imakefile
*** /tmp/xtank1.3e/Src/Programs/Imakefile	Sun Jun  7 10:58:56 1992
--- ./Src/Programs/Imakefile	Wed Sep  9 12:24:08 1992
****************** 24,29 ****
--- 24,30 ----
       EXTRA_CCOPTS = -Olimit 1024
  #endif
  #endif
+     CDEBUGFLAGS = -O
             SRCS = tagman.c Bootlegger.c gnat.c \
                    drone.c warrior.c shooter.c eliza.c Buddy.c Flipper.c \
                    Dio.c Diophantine.c artful.c spot.c hud3.c kamikaze.c \
Only in ./Src/Programs: Makefile
Common subdirectories: /tmp/xtank1.3e/Util/panzy and ./Util/panzy
Common subdirectories: /tmp/xtank1.3e/Util/trike and ./Util/trike