diff -ruN linuxdoom-1.10.orig/ChangeLog linuxdoom-1.10/ChangeLog
--- linuxdoom-1.10.orig/ChangeLog	Mon Dec 22 21:30:35 1997
+++ linuxdoom-1.10/ChangeLog	Thu Jan 22 21:16:06 1998
@@ -3,6 +3,66 @@
 
 	* TODO: see below, and in the "TODO" file. Enjoy!
 
+Thu Jan 22 17:23:18 1998     <rafaj@vabo.cz>
+
+	* fpfunc.S: merged back; original i386 and M68k assembly
+	  module, from LinuxDOOM v1.8, due to increasing
+	  of performance. Thanks to Bernd Kreimeier for providing
+	  this. Contains some texture mapping and fixed point
+	  functions for i386 (FixedMul,FixedDiv2,R_DrawColumn,
+	  and R_DrawSpan) - see further. Removed inside notes about
+	  adding to source tree (done now).
+	* README.asm: removed fpfunc.S-related part (it is not
+	  needed there anymore), as we added original fpfunc.S
+	  back to the tree.
+	* README.68k: removed (contained part of m68k assembly
+	  from fpfunc.S).
+	* r_draw.c,m_fixed.c: functions FixedMul, FixedDiv2,
+	  R_DrawColumn, and R_DrawSpan enclosed into #ifndef USEASM
+	  (so that when USEASM is defined, we will use (faster)
+	  ones from fpfunc.S).
+	* i_sound.c: lines 413/424/425 commented out (steptablemid[i]
+	  array with step widths for pitch parameters), as it remains
+	  to be currently unused.
+	* Makefile: added fpfunc.o object to compile fpfunc.S,
+	  enabled -DUSEASM as we use functions in fpfunc.S now.
+	  Flags for linking against libm (-lm) removed (libm is not
+	  needed since we commented out the function in i_sound.c
+	  that was only using it.
+
+Tue Jan 20 11:05:00 1998     <rafaj@vabo.cz>
+
+	* Makefile: modified, added "ggi" object (linuxgdoom)
+	* added "i_ggi.c"; support for GGI from Uwe Maurer
+	  <uwe_maurer@t-online.de> (his "i_video.c"). To
+	  compile GGI support, "make ggi" must be specified.
+	* added "README.68k" - m68k assembly, originally in fpfunc.S
+	* g_game.c,Makefile: added -DALLDEMOS so that all the demos
+	  even from different game version can be played. Note that
+	  this may introduce crash in few cases.
+
+Tue Jan 6 ??:??:?? 1998     <chris@fast-ag.de>
+
+	* i_sound.*,s_sound.c,i_system.c,m_misc.c,Makefile:
+	  background music (MUSSERVER #define) support added,
+	  enable "-DMUSSERV" when compiling; several fixes.
+	* i_svgalib.c: renamed to i_svga.c, few fixes
+	  in startup code (I_InitGraphics() error abort,
+	  don't use I_Error() from this file, use_mouse variable
+	  settable via .doomrc, etc).
+	* Makefile: modified, 'make' will now generate
+	  linuxxdoom binary only; to make the svgalib-doom executable
+	  (linuxsdoom), 'make svga' will do.
+
+Fri Jan 2 15:21:03 1998     <rafaj@vabo.cz>
+
+	* Makefile: modified, added linuxsdoom object
+	* i_svgalib.c: merged back, few small fixes
+	  to get it working with current code. Will
+	  possibly need to be revised a bit.
+	* i_video.c: changed #include <errnos.h> to
+	  #include <errno.h>. Hmm.. maybe a typo ?
+
 Mon Dec 22 20:29:16 1997    <bk@gamers.org>
 
 	* CVS logs and other obsolete stuff removed. Anybody
diff -ruN linuxdoom-1.10.orig/Makefile linuxdoom-1.10/Makefile
--- linuxdoom-1.10.orig/Makefile	Mon Dec 22 20:55:36 1997
+++ linuxdoom-1.10/Makefile	Thu Jan 22 20:20:53 1998
@@ -6,9 +6,12 @@
 #
 CC=  gcc  # gcc or g++
 
-CFLAGS=-g -Wall -DNORMALUNIX -DLINUX # -DUSEASM 
+CFLAGS=-g -Wall -DNORMALUNIX -DLINUX -DMUSSERV -DSNDSERV -DALLDEMOS -DUSEASM 
 LDFLAGS=-L/usr/X11R6/lib
-LIBS=-lXext -lX11 -lnsl -lm
+
+X11LIBS=-lXext -lX11
+VGALIBS=-lvga
+GGILIBS=-lggi
 
 # subdirectory for objects
 O=linux
@@ -20,8 +23,8 @@
 		$(O)/dstrings.o		\
 		$(O)/i_system.o		\
 		$(O)/i_sound.o		\
-		$(O)/i_video.o		\
 		$(O)/i_net.o			\
+		$(O)/i_main.o			\
 		$(O)/tables.o			\
 		$(O)/f_finale.o		\
 		$(O)/f_wipe.o 		\
@@ -74,22 +77,38 @@
 		$(O)/hu_lib.o			\
 		$(O)/s_sound.o		\
 		$(O)/z_zone.o			\
+		$(O)/fpfunc.o		\
 		$(O)/info.o				\
 		$(O)/sounds.o
 
-all:	 $(O)/linuxxdoom
+all:	$(O)/linuxxdoom
+
+svga:	$(O)/linuxsdoom
+
+ggi:	$(O)/linuxgdoom
 
 clean:
 	rm -f *.o *~ *.flc
 	rm -f linux/*
 
-$(O)/linuxxdoom:	$(OBJS) $(O)/i_main.o
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \
-	-o $(O)/linuxxdoom $(LIBS)
+$(O)/linuxxdoom:	$(OBJS) $(O)/i_video.o
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_video.o \
+	-o $(O)/linuxxdoom $(X11LIBS)
+
+$(O)/linuxsdoom:	$(OBJS) $(O)/i_svga.o
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_svga.o \
+	-o $(O)/linuxsdoom $(VGALIBS)
+
+$(O)/linuxgdoom:	$(OBJS) $(O)/i_ggi.o
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_ggi.o \
+	-o $(O)/linuxgdoom $(GGILIBS)
 
 $(O)/%.o:	%.c
 	$(CC) $(CFLAGS) -c $< -o $@
 
+$(O)/%.o:	%.S
+	$(CC) $(CFLAGS) -c $< -o $@
+
 #############################################################
 #
 #############################################################
diff -ruN linuxdoom-1.10.orig/README.asm linuxdoom-1.10/README.asm
--- linuxdoom-1.10.orig/README.asm	Mon Dec 22 22:37:46 1997
+++ linuxdoom-1.10/README.asm	Thu Jan 22 18:29:48 1998
@@ -9,11 +9,6 @@
 Module tmap.S includes the inner loops for texture mapping,
 the interesting one being the floor/ceiling span rendering.
 
-There was another module in the source dump, fpfunc.S, that
-had both texture mapping and fixed point functions. It
-contained implementations both for i386 and M68k. For
-brevity, I include only the i386 fixed point stuff below.
-
 //====================================================
 // tmap.S  as of January 10th, 1997
 
@@ -245,39 +240,4 @@
 	popad
 	ret
 
-
-
-
-//====================================================
-// fpfunc.S  as of January 10th, 1997 (parts)
-
-#ifdef i386
-
-.text
-	.align 4
-.globl _FixedMul
-_FixedMul:	
-	pushl %ebp
-	movl %esp,%ebp
-	movl 8(%ebp),%eax
-	imull 12(%ebp)
-	shrdl $16,%edx,%eax
-	popl %ebp
-	ret
-
-
-	.align 4
-.globl _FixedDiv2
-_FixedDiv2:
-	pushl %ebp
-	movl %esp,%ebp
-	movl 8(%ebp),%eax
-	cdq
-	shldl $16,%eax,%edx
-	sall	$16,%eax
-	idivl	12(%ebp)
-	popl %ebp
-	ret
-
-#endif
 
diff -ruN linuxdoom-1.10.orig/fpfunc.S linuxdoom-1.10/fpfunc.S
--- linuxdoom-1.10.orig/fpfunc.S	Thu Jan  1 01:00:00 1970
+++ linuxdoom-1.10/fpfunc.S	Thu Jan 22 21:13:29 1998
@@ -0,0 +1,506 @@
+//-----------------------------------------------------------------------------
+//
+// $Id:$
+//
+// Copyright (C) 1993-1996 by id Software, Inc.
+//
+// This source is available for distribution and/or modification
+// only under the terms of the DOOM Source Code License as
+// published by id Software. All rights reserved.
+//
+// The source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
+// for more details.
+//
+// DESCRIPTION:
+//   This is the M68k/i386 assembly module that has been
+//    used in one of the linuxdoom releases by id.
+//	 It contains assembly for the following C functions:				
+//	  FixedMul
+//    FixedDiv2
+//    R_DrawColumn
+//    R_DrawSpan
+//
+// If you are going to use this, add a -USEASM switch to
+//  CFLAGS in the Makefile.
+//			
+//-----------------------------------------------------------------------------
+
+
+
+				
+#ifdef USEASM
+
+// -----------------------------------------------------
+// Global defines		
+#define	SCREENWIDTH	320
+
+// This fixes linker errors. At one point in history,
+//  the underscore was necessary, I will keep it for now.
+#define _columnofs			columnofs
+#define _ylookup				ylookup
+#define _centery				centery
+
+#define _dc_x						dc_x	
+#define _dc_yl					dc_yl
+#define _dc_yh					dc_yh
+#define _dc_iscale			dc_iscale
+#define _dc_texturemid  dc_texturemid
+#define _dc_source			dc_source
+#define _dc_colormap		dc_colormap
+
+#define _ds_y						ds_y
+#define _ds_x1					ds_x1
+#define _ds_x2					ds_x2
+#define _ds_xfrac				ds_xfrac
+#define _ds_yfrac				ds_yfrac
+#define _ds_xstep				ds_xstep
+#define _ds_ystep				ds_ystep
+#define _ds_colormap		ds_colormap
+#define _ds_source			ds_source
+
+
+// The same problem occurs for function calls.
+#define _FixedMul				FixedMul
+#define _FixedDiv2			FixedDiv2
+#define _R_DrawColumn		R_DrawColumn
+#define _R_DrawSpan			R_DrawSpan
+
+// -----------------------------------------------------
+// M68k assembly
+//						
+#ifdef m68k
+
+.text
+	.align 1
+.globl _FixedMul
+_FixedMul:
+	link a6,#0
+	movel a6@(8),d0
+	mulsl a6@(12),d1:d0
+	movew d1,d0
+	swap d0
+	unlk a6
+	rts
+	.align 1
+.globl _FixedDiv2
+_FixedDiv2:
+	link a6,#0
+	movel a6@(8),d0
+	swap d0
+	movw d0,d1
+	extl d1
+	movw #0,d0
+	divsl a6@(12),d1:d0
+	unlk a6
+	rts
+	
+/*
+===================
+=
+= R_DrawColumn
+=
+===================
+*/	
+	.align 1
+.globl _R_DrawColumn
+_R_DrawColumn:
+	moveml	d2/d3/d4/d5/d6/d7/a2,sp@-
+	
+	movel	_dc_yh,d3
+	movel	_dc_yl,d2
+	subl 	d2,d3
+	bmi 	L1				// if count < 0, do nothing
+
+	lea		_columnofs,a1
+	movel	_dc_x,d1
+	movel	a1@(d1:l:4),a1
+	lea 	_ylookup,a0
+	addl	a0@(d2:l:4),a1
+
+	movel	_dc_iscale,d4
+	subl	_centery,d2
+	mulsl	d4,d2
+	addl	_dc_texturemid,d2
+
+// d0	scratch offset / pixel 1
+// d1	qaud count
+// d2	frac 1
+// d3	count
+// d4	fracstep
+// d5	SCREENWIDTH
+// d6	frac 2
+// d7	scratch 2
+
+// a0	source
+// a1	dest
+// a2	colormap
+	movel	_dc_source,a0
+	movel	_dc_colormap,a2
+
+	addql	#1,d3
+	movel	d3,d1
+	lsrl	#2,d1
+	beq		Lcsinglestart
+	subql	#1,d1
+	bfextu 	d2{#9:#7},d0	// feed the first step of the pipeline
+	movel	d2,d6
+	addl	d4,d6			// put d6 a step ahead of d2
+	lsll	#1,d4			// make the step a double step
+	movel	#SCREENWIDTH*4,d5
+	jmp		Lcquadloop
+	
+	.align 4
+Lcquadloop:
+	bfextu d6{#9:#7},d7
+	moveb a0@(d0),d0
+	addl d4,d2
+	moveb a0@(d7),d7
+	addl d4,d6
+	moveb a2@(d0),a1@
+	bfextu d2{#9:#7},d0
+	moveb a2@(d7),a1@(SCREENWIDTH)
+	
+	bfextu d6{#9:#7},d7
+	moveb a0@(d0),d0
+	addl d4,d2
+	moveb a0@(d7),d7
+	addl d4,d6
+	moveb a2@(d0),a1@(SCREENWIDTH*2)
+	bfextu d2{#9:#7},d0
+	moveb a2@(d7),a1@(SCREENWIDTH*3)
+
+	addl d5,a1
+	dbra d1,Lcquadloop
+	
+	lsrl	#1,d4			// put the step value back to singles
+	
+Lcsinglestart:
+	andil	#3,d3
+	beq		L1				// no extras
+	movel	#SCREENWIDTH,d5
+	subql	#1,d3
+	
+Lcsingleloop:
+	bfextu d2{#9:#7},d0
+	moveb a0@(d0),d0
+	addl d4,d2
+	moveb a2@(d0),a1@
+
+	addl d5,a1
+	dbra d3,Lcsingleloop
+
+L1:
+	moveml sp@+,d2/d3/d4/d5/d6/d7/a2
+	rts
+
+/*
+===================
+=
+= R_DrawSpan
+=
+===================
+*/
+
+	.align 1
+.globl _R_DrawSpan
+_R_DrawSpan:
+	moveml d2/d3/d4/d5/d6/d7/a2,sp@-
+	
+	movel _ds_x2,d7
+	cmpl _ds_x1,d7
+	movel _ds_y,d1
+	lea _ylookup,a1
+	movel _ds_x1,d0
+	lea _columnofs,a0
+	movel a1@(d1:l:4),a1
+	addl a0@(d0:l:4),a1
+	movel _ds_x2,d3
+	subl _ds_x1,d3
+
+// d0	extracted yfrac / composite
+// d1	extracted xfrac
+// d2	xfrac yfrac
+// d3	loop count
+// d4	xstep ystep
+// d5	pixel
+// d6	quad count
+
+// a0	ds_source
+// a1	dest
+// a2	ds_colormap
+
+	clrl	d5
+	movel	_ds_source,a0
+	movel	_ds_colormap,a2
+	
+// build frac
+	movel	_ds_yfrac,d2
+	moveq	#10,d0
+	lsll	d0,d2
+	andil	#0xffff0000,d2
+	movel	_ds_xfrac,d0
+	lsrl	#6,d0
+	andil	#0xffff,d0
+	addl	d0,d2
+// build step
+	movel	_ds_ystep,d4
+	moveq	#10,d0
+	lsll	d0,d4
+	andil	#0xffff0000,d4
+	movel	_ds_xstep,d0
+	lsrl	#6,d0
+	andil	#0xffff,d0
+	addl	d0,d4
+
+	addql	#1,d3
+	movel	d3,d6
+	lsrl	#2,d6
+	beq		Lsinglestart
+	subql	#1,d6
+//	lsll	#1,d4			// make the step a double step
+
+Lquadloop:
+	bfextu	d2{#0:#6},d0	// extract y
+	bfextu	d2{#16:#6},d1	// extract x
+	lsll	#6,d0
+	addl	d1,d0
+	addl	d4,d2			// advance fraction
+	moveb	a0@(d0),d5		// get source pixel
+	moveb	a2@(d5),a1@+	// translate and write out to dest
+	
+	bfextu	d2{#0:#6},d0	// extract y
+	bfextu	d2{#16:#6},d1	// extract x
+	lsll	#6,d0
+	addl	d1,d0
+	addl	d4,d2			// advance fraction
+	moveb	a0@(d0),d5		// get source pixel
+	moveb	a2@(d5),a1@+	// translate and write out to dest
+	
+	bfextu	d2{#0:#6},d0	// extract y
+	bfextu	d2{#16:#6},d1	// extract x
+	lsll	#6,d0
+	addl	d1,d0
+	addl	d4,d2			// advance fraction
+	moveb	a0@(d0),d5		// get source pixel
+	moveb	a2@(d5),a1@+	// translate and write out to dest
+	
+	bfextu	d2{#0:#6},d0	// extract y
+	bfextu	d2{#16:#6},d1	// extract x
+	lsll	#6,d0
+	addl	d1,d0
+	addl	d4,d2			// advance fraction
+	moveb	a0@(d0),d5		// get source pixel
+	moveb	a2@(d5),a1@+	// translate and write out to dest
+	
+	dbra	d6,Lquadloop
+
+Lsinglestart:
+	andil	#3,d3
+	beq		Ldone			// no extras
+	subql	#1,d3
+Lsingleloop:
+	bfextu	d2{#0:#6},d0	// extract y
+	bfextu	d2{#16:#6},d1	// extract x
+	lsll	#6,d0
+	addl	d1,d0
+	addl	d4,d2			// advance fraction
+	moveb	a0@(d0),d5		// get source pixel
+	moveb	a2@(d5),a1@+	// translate and write out to dest
+	dbra	d3,Lsingleloop
+	
+Ldone:
+	moveml	sp@+,d2/d3/d4/d5/d6/d7/a2
+	rts
+
+#endif
+// 
+// End of M68k assembly 
+// -----------------------------------------------------
+// PC/i386 assembly
+//				
+#ifdef i386
+
+.text
+	.align 4
+.globl _FixedMul
+_FixedMul:	
+	pushl %ebp
+	movl %esp,%ebp
+	movl 8(%ebp),%eax
+	imull 12(%ebp)
+	shrdl $16,%edx,%eax
+	popl %ebp
+	ret
+
+
+	.align 4
+.globl _FixedDiv2
+_FixedDiv2:
+	pushl %ebp
+	movl %esp,%ebp
+	movl 8(%ebp),%eax
+	cdq
+	shldl $16,%eax,%edx
+	sall	$16,%eax
+	idivl	12(%ebp)
+	popl %ebp
+	ret
+
+	
+/*
+==================
+=
+= R_DrawColumn
+=
+eax		colormap
+ebx		scratch
+ecx		count
+edx		frac
+esi		column source
+edi		dest
+ebp		fracstep
+==================
+*/
+	.align 4
+.globl _R_DrawColumn
+_R_DrawColumn:
+	movl 	_dc_yl,%eax
+	movl 	_dc_yh,%ecx
+	subl 	%eax,%ecx
+	incl	%ecx
+	jz		L1
+	js		L1					// no pixels to map
+
+	pushl %ebp
+	pushl %edi
+	pushl %esi
+	pushl %ebx
+
+	movl 	_ylookup(,%eax,4),%edi
+	subl	_centery,%eax		// %eax = dc_yl - centery
+	movl 	_dc_x,%ebx			
+	addl 	_columnofs(,%ebx,4),%edi	// %edi = destination in buffer
+	
+	movl 	_dc_iscale,%ebp		// %ebp = fracstep
+	imull 	%ebp
+	movl	%eax,%edx			// %edx = (centery-dc_yl)*dc_iscale
+	addl 	_dc_texturemid,%edx	// add texture pos at screen center
+	shll	$9,%edx				// shift so units are flush with bit 31
+	shll	$9,%ebp				// shift so units are flush with bit 31
+	
+	movl	_dc_source,%esi		// %esi = top of vertual column
+	movl	_dc_colormap,%eax	// %eax = colormap
+	
+	.align 4,0x90
+L2:
+	movl	%edx,%ebx			// get the current frac position
+	shrl	$25,%ebx			// shift off the fractional bits
+	movb	(%esi,%ebx),%al		// get the source pixel
+	movb	(%eax),%al			// color map it
+	addl	%ebp,%edx			// step the fractional value
+	movb	%al,(%edi)			// write it to the frame buffer
+	addl	$SCREENWIDTH,%edi	// go down to next row
+	decl	%ecx				// any more to do?
+	jnz		L2
+
+// done	
+	popl %ebx
+	popl %esi
+	popl %edi
+	popl %ebp
+L1:
+	ret
+
+
+
+/*
+==================
+=
+= _R_DrawSpan
+=
+eax		colormap
+ebx		scratch
+ecx		frac postion
+edx		frac step
+esi		source
+edi		dest
+ebp		counter
+
+
+==================
+*/
+	.align 4
+.globl _R_DrawSpan
+_R_DrawSpan:
+
+	pushl %ebp
+	pushl %edi
+	pushl %esi
+	pushl %ebx
+
+// get destination
+	movl _ds_y,%edx
+	movl _ds_x1,%eax
+	movl _ylookup(,%edx,4),%edi
+	addl _columnofs(,%eax,4),%edi
+
+// get count
+	movl 	_ds_x2,%ebp
+	subl 	%eax,%ebp
+	incl	%ebp
+	
+// pack position into one word
+	movl	_ds_xfrac,%eax
+	shll	$10,%eax	
+	andl	$0xffff0000,%eax
+	movl	_ds_yfrac,%ecx
+	shrl	$6,%ecx	
+	andl	$0x0000ffff,%ecx
+	orl		%eax,%ecx
+
+// pack step into one word
+	movl	_ds_xstep,%eax
+	shll	$10,%eax	
+	andl	$0xffff0000,%eax
+	movl	_ds_ystep,%edx
+	shrl	$6,%edx	
+	andl	$0x0000ffff,%edx
+	orl		%eax,%edx
+	
+	movl	_ds_colormap,%eax	// %eax = colormap
+	movl	_ds_source,%esi		// %esi = source
+	
+	.align 4,0x90
+L3:
+	shldl 	$22,%ecx,%ebx		// shift y units in
+	shldl 	$6,%ecx,%ebx		// shift x units in
+	andl	$4095,%ebx			// mask off slop bits
+	movb	(%esi,%ebx),%al		// get source pixel
+	movb    (%eax),%al			// translate color
+	addl	%edx,%ecx			// position += step
+	stosb						// write pixel and increment
+	decl	%ebp
+	jnz		L3
+
+// done	
+	popl %ebx
+	popl %esi
+	popl %edi
+	popl %ebp
+	ret
+
+
+#endif
+// -----------------------------------------------------
+// End of PC/i386 assembly
+//
+
+#endif // USEASM
+
+//-----------------------------------------------------------------------------//
+// $Log:$
+//
+//-----------------------------------------------------------------------------
+
diff -ruN linuxdoom-1.10.orig/g_game.c linuxdoom-1.10/g_game.c
--- linuxdoom-1.10.orig/g_game.c	Mon Dec 22 21:35:29 1997
+++ linuxdoom-1.10/g_game.c	Thu Jan 22 18:18:48 1998
@@ -1589,8 +1589,10 @@
     if ( *demo_p++ != VERSION)
     {
       fprintf( stderr, "Demo is from a different game version!\n");
+#ifndef ALLDEMOS
       gameaction = ga_nothing;
       return;
+#endif
     }
     
     skill = *demo_p++; 
diff -ruN linuxdoom-1.10.orig/i_ggi.c linuxdoom-1.10/i_ggi.c
--- linuxdoom-1.10.orig/i_ggi.c	Thu Jan  1 01:00:00 1970
+++ linuxdoom-1.10/i_ggi.c	Thu Jan 22 18:18:48 1998
@@ -0,0 +1,257 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// $Id:$
+//
+// Copyright (C) 1993-1996 by id Software, Inc.
+//
+// This source is available for distribution and/or modification
+// only under the terms of the DOOM Source Code License as
+// published by id Software. All rights reserved.
+//
+// The source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
+// for more details.
+//
+// $Log:$
+//
+// DESCRIPTION:
+//	DOOM graphics stuff for GGI ( http://synergy.caltech.edu/~ggi/ )
+//	Maintainer: Uwe Maurer - uwe_maurer@t-online.de
+//			http://home.t-online.de/home/uwe_maurer
+//-----------------------------------------------------------------------------
+
+static const char
+rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $";
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <ggi/libggi.h>
+
+#include "doomstat.h"
+#include "i_system.h"
+#include "v_video.h"
+#include "m_argv.h"
+#include "d_main.h"
+#include "r_draw.h"
+
+#include "doomdef.h"
+
+ggi_visual_t 	ggivis;
+
+int		width;
+int		height;
+
+// #define KEY_DEBUG
+
+#ifdef KEY_DEBUG
+char str[32];
+char * bits(int a)
+{
+	int i;
+	for (i=0;i<8;i++) str[16-i]=((a & (1<<i))!=0)+'0';	
+	str[8]=' ';
+	for (i=8;i<16;i++) str[15-i]=((a & (1<<i))!=0)+'0';	
+	return str;
+}
+#endif
+
+int key(int sym,int code)
+{
+    	int rc=0;
+#ifdef KEY_DEBUG
+	char text[100];
+	ggiSetGCForeground(ggivis,0);
+	ggiDrawBox(ggivis,0,0,320,24);
+	ggiSetGCForeground(ggivis,255);
+	sprintf(text," %c",KVAL(U(sym)));
+	ggiPuts(ggivis,0,0,text);
+	sprintf(text," %i %x %s",U(sym),U(sym),bits(U(sym)));
+	ggiPuts(ggivis,0,8,text);
+	sprintf(text," %i %x %s",code,code,bits(code));
+	ggiPuts(ggivis,0,16,text);
+#endif
+	switch(KTYP(U(sym)))
+	{
+		case KT_LATIN:
+		case KT_LETTER:
+		case KT_META:
+		switch(KVAL(U(sym)))
+		{
+			case '\033':	rc = KEY_ESCAPE;	break;
+			case '\011':	rc = KEY_TAB;		break;
+			
+			default:
+				rc=KVAL(U(sym));
+				if (rc >='A' && rc <='Z')
+					rc = rc - 'A' + 'a';
+				
+		}
+		break;
+
+		case 0xf2:	// ALT + SHIFT + ARROW KEY
+			switch(code)
+			{
+				case 0x69: rc=KEY_LEFTARROW;	break;
+				case 0x6a: rc=KEY_RIGHTARROW;	break;
+				case 0x67: rc=KEY_UPARROW;	break;
+				case 0x6c: rc=KEY_DOWNARROW;	break;
+				default:
+				printf("Unknown special key (%i)!\n",code);
+			}
+			break;
+		default:
+		switch(U(sym))
+		{
+			 
+      			case K_UP:	rc = KEY_UPARROW;	break;
+      			case K_DOWN:	rc = KEY_DOWNARROW;	break;
+      			case K_LEFT:	rc = KEY_LEFTARROW;	break;
+			case K_RIGHT:	rc = KEY_RIGHTARROW;	break;
+			case K_ENTER:	rc = KEY_ENTER;		break;
+			case K_NORMAL_CTRL: rc=KEY_RCTRL; 	break;
+			case K_NORMAL_SHIFT: rc=KEY_RSHIFT;	break;
+
+			case K_NORMAL_ALTGR:
+			case K_NORMAL_ALT: rc=KEY_RALT;		break;
+      			case K_F1:	rc = KEY_F1;		break;
+			case K_F2:	rc = KEY_F2;		break;
+			case K_F3:	rc = KEY_F3;		break;
+			case K_F4:	rc = KEY_F4;		break;
+			case K_F5:	rc = KEY_F5;		break;
+			case K_F6:	rc = KEY_F6;		break;
+			case K_F7:	rc = KEY_F7;		break;
+			case K_F8:	rc = KEY_F8;		break;
+			case K_F9:	rc = KEY_F9;		break;
+			case K_F10:	rc = KEY_F10;		break;
+			case K_F11:	rc = KEY_F11;		break;
+			case K_F12:	rc = KEY_F12;		break;
+      			case K_PAUSE:	rc = KEY_PAUSE;		break;
+	
+		}
+	}
+
+    return rc;
+
+}
+
+void I_ShutdownGraphics(void)
+{
+	ggiClose(ggivis);
+	ggiExit();
+}
+
+
+void I_StartFrame (void)
+{
+
+}
+
+void I_GetEvent(void)
+{
+	event_t event;
+	ggi_event ev;
+	int evmask=emKeyPress|emKeyRelease;
+
+	while (1)
+	{
+		struct timeval t={0,0};
+		if (ggiEventPoll(ggivis,evmask,&t)==0) return;
+
+		ggiEventRead(ggivis,&ev,evmask);
+
+		switch (ev.any.type)
+		{
+			case evKeyPress:
+				event.type = ev_keydown;
+				event.data1 = key(ev.key.sym,ev.key.code);
+				D_PostEvent(&event);
+				break;
+		 	case evKeyRelease:
+				event.type = ev_keyup;
+				event.data1 = key(ev.key.sym,ev.key.code);
+				D_PostEvent(&event);
+				break;
+	    }
+	}
+}
+
+void I_StartTic (void)
+{
+	I_GetEvent();
+}
+
+
+void I_UpdateNoBlit (void)
+{
+}
+
+void I_FinishUpdate (void)
+{
+
+    static int	lasttic;
+    int		tics;
+    int		i;
+
+    // draws little dots on the bottom of the screen
+    if (devparm)
+    {
+	i = I_GetTime();
+	tics = i - lasttic;
+	lasttic = i;
+	if (tics > 20) tics = 20;
+
+	for (i=0 ; i<tics*2 ; i+=2)
+	    screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
+	for ( ; i<20*2 ; i+=2)
+	    screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
+    
+    }
+
+#ifndef KEY_DEBUG
+	ggiPutBox(ggivis,0,0,width,height,screens[0]);
+#else
+	ggiPutBox(ggivis,0,24,width,height-24,screens[0]);
+#endif
+	ggiFlush(ggivis);
+	I_GetEvent();
+}
+
+
+void I_ReadScreen (byte* scr)
+{
+    memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT);
+}
+
+void I_SetPalette (byte* pal)
+{
+	int i;
+	ggi_color col[256];
+	for (i=0;i<256;i++) 
+	{
+		col[i].r=(*pal++) << (GGI_COLOR_PRECISION-8);
+		col[i].g=(*pal++) << (GGI_COLOR_PRECISION-8);
+		col[i].b=(*pal++) << (GGI_COLOR_PRECISION-8);
+	}
+	ggiSetPaletteVec(ggivis,0,256,col);
+}
+
+void I_InitGraphics(void)
+{
+	ggiInit();
+	ggivis=ggiOpen(NULL);
+
+	signal(SIGINT, (void (*)(int)) I_Quit);
+
+	width = SCREENWIDTH;
+	height = SCREENHEIGHT;
+
+	if (ggiSetGraphMode(ggivis,width,height,width,height,GT_8BIT)<0)
+		I_Error("Can't set mode %ix%i \n",width,height);
+
+	ggiSetInfoFlags(ggivis,GGIFLAG_ASYNC);
+
+}
+
diff -ruN linuxdoom-1.10.orig/i_sound.c linuxdoom-1.10/i_sound.c
--- linuxdoom-1.10.orig/i_sound.c	Mon Dec 22 20:57:15 1997
+++ linuxdoom-1.10/i_sound.c	Thu Jan 22 20:26:37 1998
@@ -40,6 +40,9 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#ifdef MUSSERV
+#include <sys/msg.h>
+#endif
 
 // Linux voxware output.
 #include <linux/soundcard.h>
@@ -58,6 +61,12 @@
 
 #include "doomdef.h"
 
+#ifdef MUSSERV // musserver music hack
+int musserver_msgid=-1;
+char *musserver_filename = "./musserver";
+char *musserver_options = "-f";
+#endif
+
 // UNIX hack, to be removed.
 #ifdef SNDSERV
 // Separate sound server process.
@@ -401,7 +410,7 @@
   int		i;
   int		j;
     
-  int*	steptablemid = steptable + 128;
+  // int*	steptablemid = steptable + 128;
   
   // Okay, reset internal mixing channels to zero.
   /*for (i=0; i<NUM_CHANNELS; i++)
@@ -411,8 +420,8 @@
 
   // This table provides step widths for pitch parameters.
   // I fail to see that this is currently used.
-  for (i=-128 ; i<128 ; i++)
-    steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0);
+  // for (i=-128 ; i<128 ; i++)
+  //   steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0);
   
   
   // Generates volume lookup tables
@@ -440,7 +449,18 @@
   // Internal state variable.
   snd_MusicVolume = volume;
   // Now set volume on output device.
-  // Whatever( snd_MusciVolume );
+#ifdef MUSSERV
+  // Whatever( snd_MusicVolume );
+
+  if (musserver_msgid != -1) {
+    struct musmsg msg_buffer;
+    msg_buffer.msg_type=6;
+    memset(msg_buffer.msg_text,0,sizeof(msg_buffer.msg_text));
+    msg_buffer.msg_text[0]='v';
+    msg_buffer.msg_text[1]=volume;
+    msgsnd(musserver_msgid,(struct msgbuf *)&msg_buffer,sizeof(msg_buffer.msg_text),IPC_NOWAIT);
+  }
+#endif /* #ifdef MUSSERV */
 }
 
 
@@ -482,7 +502,7 @@
 #ifdef SNDSERV 
     if (sndserver)
     {
-	fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep);
+	fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol*8, sep);
 	fflush(sndserver);
     }
     // warning: control reaches end of non-void function.
@@ -734,8 +754,7 @@
 
 
 
-void
-I_InitSound()
+void I_InitSound(void)
 { 
 #ifdef SNDSERV
   char buffer[256];
@@ -825,15 +844,59 @@
 }
 
 
-
-
 //
 // MUSIC API.
-// Still no music done.
-// Remains. Dummies.
 //
-void I_InitMusic(void)		{ }
-void I_ShutdownMusic(void)	{ }
+void I_InitMusic(void)
+{
+#ifdef MUSSERV
+  char buffer[256];
+  int old_uid=-1;
+  
+  musserver_msgid=-1;
+
+  if (getenv("DOOMWADDIR"))
+    sprintf(buffer, "%s/%s",
+	    getenv("DOOMWADDIR"),
+	    musserver_filename);
+  else
+    sprintf(buffer, "%s", musserver_filename);
+
+  if (!access(buffer,X_OK)) {
+    // start musserver via popen() (ugly)
+    if (strlen(musserver_options)) {
+      strcat(buffer," ");
+      strcat(buffer,musserver_options);
+    }
+    if ((old_uid=geteuid()) == 0 && getuid() != 0) { // we are running suid-root!
+      old_uid=geteuid();
+      seteuid(getuid());  // set euid to uid for creating sub-process
+    }
+    if (!popen(buffer,"w")) {
+      fprintf(stderr,"Could not start music server [%s]: %s\n",buffer,strerror(errno));
+      return;
+    }
+    // give all permissions I can
+    musserver_msgid=msgget(53075,IPC_CREAT | 0777);
+    if (old_uid != -1)
+      seteuid(old_uid);
+  }
+  else {
+    fprintf(stderr,"Could not start music server [%s]\n",buffer);
+  }
+#endif /* #ifdef MUSSERV */
+}
+
+void I_ShutdownMusic(void)
+{
+#ifdef MUSSERV
+  if (musserver_msgid != -1) {
+    if (msgctl(musserver_msgid,IPC_RMID,(struct msqid_ds *) NULL)) {
+      fprintf(stderr,"I_ShutdownMusic failed: %s\n",strerror(errno));
+    }
+  }
+#endif /* #ifdef MUSSERV */
+}
 
 static int	looping=0;
 static int	musicdies=-1;
diff -ruN linuxdoom-1.10.orig/i_sound.h linuxdoom-1.10/i_sound.h
--- linuxdoom-1.10.orig/i_sound.h	Mon Dec 22 20:58:01 1997
+++ linuxdoom-1.10/i_sound.h	Thu Jan 22 18:18:49 1998
@@ -31,6 +31,15 @@
 extern FILE* sndserver;
 extern char* sndserver_filename;
 #endif
+#ifdef MUSSERV
+extern int musserver_msgid;
+extern char *musserver_filename;
+extern char *musserver_options;
+struct musmsg {
+  long msg_type;      // what about 64 bit Linux??
+  char msg_text[12];
+};
+#endif
 
 #include "doomstat.h"
 #include "sounds.h"
diff -ruN linuxdoom-1.10.orig/i_svga.c linuxdoom-1.10/i_svga.c
--- linuxdoom-1.10.orig/i_svga.c	Thu Jan  1 01:00:00 1970
+++ linuxdoom-1.10/i_svga.c	Thu Jan 22 18:18:49 1998
@@ -0,0 +1,428 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// $Id:$
+//
+// Copyright (C) 1993-1996 by id Software, Inc.
+//
+// This source is available for distribution and/or modification
+// only under the terms of the DOOM Source Code License as
+// published by id Software. All rights reserved.
+//
+// The source is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
+// for more details.
+//
+// $Log:$
+//
+// DESCRIPTION:
+//	Linux SVGA graphics IO
+//
+//-----------------------------------------------------------------------------
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <signal.h>
+
+#include <vga.h>
+#include <vgakeyboard.h>
+#include <vgamouse.h>
+#if 0
+#include "/usr/local/include/vga.h"
+#include "/usr/local/include/vgakeyboard.h"
+#include "/usr/local/include/vgamouse.h"
+#endif
+
+#include "doomdef.h"
+#include "doomstat.h"
+#include "i_system.h"
+#include "d_main.h"
+#include "d_net.h"
+#include "v_video.h"
+#include "g_game.h"
+
+int             svgalib_inited=0;
+
+extern char     *mousedev;
+extern char     *mousetype;
+extern int      usemouse;
+int             mouserate = MOUSE_DEFAULTSAMPLERATE;
+int             UseDisplay = 1;
+int             UseKeyboard = 1;
+
+char    *framebuffer_ptr;
+
+int con_translate(int ch)
+{
+  int /*up=(!(ch&0x80)),*/ key=ch&0x7f;
+   
+  switch (key)
+  {
+    case 42 : ch=KEY_RSHIFT;                      break;
+    case 54 : ch=KEY_RSHIFT;                      break;
+    case 72 : ch=KEY_UPARROW;                           break;
+    case 80 : ch=KEY_DOWNARROW;                         break;
+    case 75 : ch=KEY_LEFTARROW;                         break;
+    case 77 : ch=KEY_RIGHTARROW;                        break;
+    case 103 : ch=KEY_UPARROW;                           break;
+    case 108 : ch=KEY_DOWNARROW;                         break;
+    case 105 : ch=KEY_LEFTARROW;                         break;
+    case 106 : ch=KEY_RIGHTARROW;                        break;
+    case 29 : ch=KEY_RCTRL;                       break;
+    case 56 : ch=KEY_LALT;                        break;
+    case 97 : ch=KEY_RCTRL;                        break;
+    case 100 : ch=KEY_RALT;                        break;
+    case 119 : ch=KEY_PAUSE;                        break;
+//    case 58 : ch=JK_CAPS;                         break;
+//    case 69 : ch=JK_NUM_LOCK;                     break;
+//    case 71 : ch=JK_HOME;                         break;
+//    case 79 : ch=JK_END;                          break;
+//    case 83 : ch=JK_DEL;                          break;
+    case 57 : ch=' ';                        break;
+    case 1  : ch=KEY_ESCAPE;                          break;
+    case 28  : ch=KEY_ENTER;                       break;
+    case 15  : ch=KEY_TAB;                         break;
+    case 14  : ch=KEY_BACKSPACE;                   break;
+    case 2  :  ch= '1';                break;
+    case 3  :  ch= '2';                break;
+    case 4  :  ch= '3';                break;
+    case 5  :  ch= '4';                break;
+    case 6  :  ch= '5';                break;
+    case 7  :  ch= '6';                break;
+    case 8  :  ch= '7';                break;
+    case 9  :  ch= '8';                break;
+//    case 10  :  ch= '9';                break;
+    case 10  :  ch= KEY_EQUALS;                break;
+    case 11  :  ch= '0';                break;
+    case 12  :  ch= KEY_MINUS;                break;
+    case 13  :  ch= KEY_EQUALS;                break;
+    case 78  :  ch= KEY_EQUALS;                break;
+    case 41  :  ch= '`';                break;
+    case 26  :  ch= '[';                break;
+    case 27  :  ch= ']';                break;
+    case 39  :  ch= ';';                break;
+    case 40  :  ch= '\'';               break;
+    case 51  :  ch= ',';                break;
+    case 52  :  ch= '.';                break;
+    case 53  :  ch= '/';                break;
+    case 43  :  ch= '\\';               break;
+    case 59 :  ch=KEY_F1;                             break; 
+    case 60 :  ch=KEY_F2;                             break; 
+    case 61 :  ch=KEY_F3;                             break; 
+    case 62 :  ch=KEY_F4;                             break; 
+    case 63 :  ch=KEY_F5;                             break; 
+    case 64 :  ch=KEY_F6;                             break; 
+    case 65 :  ch=KEY_F7;                             break; 
+    case 66 :  ch=KEY_F8;                             break; 
+    case 67 :  ch=KEY_F9;                             break; 
+    case 68 :  ch=KEY_F10;                            break; 
+    case 87 :  ch=KEY_F11;                            break; 
+    case 88 :  ch=KEY_F12;                            break; 
+
+    default :
+      switch (key)
+      {
+        case 30 : ch='a';       break;
+        case 48 : ch='b';       break;
+        case 46 : ch='c';       break;
+        case 32 : ch='d';       break;
+        case 18 : ch='e';       break;
+        case 33 : ch='f';       break;
+        case 34 : ch='g';       break;
+        case 35 : ch='h';       break;
+        case 23 : ch='i';       break;
+        case 36 : ch='j';       break;
+        case 37 : ch='k';       break;
+        case 38 : ch='l';       break;
+        case 50 : ch='m';       break;
+        case 49 : ch='n';       break;
+        case 24 : ch='o';       break;
+        case 25 : ch='p';       break;
+        case 16 : ch='q';       break;
+        case 19 : ch='r';       break;
+
+        case 31 : ch='s';       break;
+        case 20 : ch='t';       break;
+        case 22 : ch='u';       break;
+        case 47 : ch='v';       break;
+        case 17 : ch='w';       break;
+        case 45 : ch='x';       break;
+        case 21 : ch='y';       break;
+        case 44 : ch='z';       break;
+        default : ch='a';       break;
+      }
+  }
+  return ch;
+}
+
+void keyhandler(int scancode, int state)
+{
+
+        event_t ev;
+
+        ev.type = state == KEY_EVENTPRESS ? ev_keydown : ev_keyup;
+        ev.data1 = con_translate(scancode);
+
+        D_PostEvent(&ev);
+
+}
+
+void mousehandler(int button, int dx, int dy)
+{
+
+        event_t ev;
+
+        ev.type = ev_mouse;
+        ev.data1 = button;
+        ev.data2 = dx * 3;
+        ev.data3 = -dy * 3;
+
+        D_PostEvent(&ev);
+
+}
+
+void I_StartTic(void)
+{
+        if (!svgalib_inited)
+                return;
+
+        if (UseKeyboard)
+                while (keyboard_update());
+        if (usemouse)
+                while (mouse_update());
+}
+
+void I_ShutdownGraphics(void)
+{
+
+        if (!svgalib_inited) return;
+
+        printf("shutdown graphics called\n");
+        if (UseKeyboard)
+                keyboard_close();
+        if (usemouse)
+                mouse_close();
+        if (UseDisplay)
+                vga_setmode(TEXT);
+        printf("shutdown graphics finished\n");
+}
+
+void I_InitGraphics(void)
+{
+
+        int mtype;
+
+        if (svgalib_inited)
+                return;
+
+    signal(SIGHUP, (void (*)(int)) I_Quit);
+    signal(SIGINT, (void (*)(int)) I_Quit);
+    signal(SIGKILL, (void (*)(int)) I_Quit);
+    signal(SIGTERM, (void (*)(int)) I_Quit);
+    signal(SIGSTOP, (void (*)(int)) I_Quit);
+    signal(SIGQUIT, (void (*)(int)) I_Quit);
+/*
+    signal(SIGILL, (void (*)(int)) I_Quit);
+    signal(SIGTRAP, (void (*)(int)) I_Quit);
+    signal(SIGABRT, (void (*)(int)) I_Quit);
+    signal(SIGIOT, (void (*)(int)) I_Quit);
+    signal(SIGFPE, (void (*)(int)) I_Quit);
+    signal(SIGUSR1, (void (*)(int)) I_Quit);
+    signal(SIGSEGV, (void (*)(int)) I_Quit);
+    signal(SIGUSR2, (void (*)(int)) I_Quit);
+    signal(SIGPIPE, (void (*)(int)) I_Quit);
+    signal(SIGSTKFLT, (void (*)(int)) I_Quit);
+    signal(SIGCHLD, (void (*)(int)) I_Quit);
+    signal(SIGCONT, (void (*)(int)) I_Quit);
+    signal(SIGTSTP, (void (*)(int)) I_Quit);
+    signal(SIGTTIN, (void (*)(int)) I_Quit);
+    signal(SIGTTOU, (void (*)(int)) I_Quit);
+*/
+
+        if (UseDisplay)
+        {
+                if (!vga_hasmode(G320x200x256))
+                {
+                        printf("Cannot support 320x200x256 colors!\n");
+                        I_Quit();
+                }
+                vga_init();
+                vga_setmode(G320x200x256);
+                vga_setpage(0);
+                framebuffer_ptr = (char *) vga_getgraphmem();
+                printf("framebuf = %p\n", framebuffer_ptr);
+        }
+
+
+        if (UseKeyboard)
+        {
+                if (keyboard_init())
+                {
+                        printf("keyboard_init() failed\n");
+                        if (UseDisplay)
+                          vga_setmode(TEXT);
+                        I_Quit();
+                }
+                keyboard_seteventhandler(keyhandler);
+        }
+
+        if (usemouse)
+        {
+                if (!strcasecmp(mousetype, "microsoft"))
+                        mtype = MOUSE_MICROSOFT;
+                if (!strcasecmp(mousetype, "mousesystems"))
+                        mtype = MOUSE_MOUSESYSTEMS;
+                if (!strcasecmp(mousetype, "mmseries"))
+                        mtype = MOUSE_MMSERIES;
+                if (!strcasecmp(mousetype, "logitech"))
+                        mtype = MOUSE_LOGITECH;
+                if (!strcasecmp(mousetype, "busmouse"))
+                        mtype = MOUSE_BUSMOUSE;
+                if (!strcasecmp(mousetype, "ps2"))
+                        mtype = MOUSE_PS2;
+
+                if (mouse_init(mousedev, mtype, mouserate))
+                {
+                        printf("mouse_init() failed\n");
+                        
+                        if (UseKeyboard)
+                          keyboard_close();
+                        if (UseDisplay)
+                          vga_setmode(TEXT);
+                        I_Quit();
+                }
+
+                mouse_seteventhandler(mousehandler);
+        }
+
+        svgalib_inited=1;
+
+}
+
+void I_StartFrame(void)
+{
+}
+
+void I_UpdateNoBlit(void)
+{
+}
+
+void I_FinishUpdate(void)
+{
+
+  static int lasttic;
+  int tics, i;
+
+  if (!svgalib_inited)
+        return;
+
+  // draws little dots on the bottom of the screen
+  if (devparm)
+  {
+
+    i = I_GetTime();
+    tics = i - lasttic;
+    lasttic = i;
+    if (tics > 20) tics = 20;
+
+    for (i=0 ; i<tics*2 ; i+=2)
+      screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
+    for ( ; i<20*2 ; i+=2)
+      screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
+    
+  }
+
+  if (UseDisplay)
+          memcpy(framebuffer_ptr, screens[0], 320*200);
+
+}
+
+void I_ReadScreen(byte *scr)
+{
+        memcpy(scr, screens[0], SCREENWIDTH * SCREENHEIGHT);
+}
+
+void I_SetPalette(byte *palette)
+{
+
+        static int tmppal[256*3];
+        int *tp;
+        int i;
+
+        if (!svgalib_inited)
+                return;
+
+        tp = tmppal;
+        for (i=256*3 ; i ; i--)
+                *(tp++) = gammatable[usegamma][*(palette++)] >> 2;
+
+        if (UseDisplay)
+                vga_setpalvec(0, 256, tmppal);
+
+}
+
+/*
+
+int main(int c, char **v)
+{
+
+        int done = 0;
+        int key;
+        int walker=0;
+        byte pal[256*3];
+        int i;
+
+        screens[0] = (byte *) malloc(320*200);
+        I_InitGraphics();
+        for (i=0 ; i<256 ; i++)
+        {
+                pal[i*3] = i;
+                pal[i*3+1] = i;
+                pal[i*3+2] = i;
+        }
+        I_SetPalette(pal);
+        do
+        {
+                I_StartTic();
+                memset(screens[0], walker, 320*200);
+                if (++walker == 256) walker = 0;
+                I_FinishUpdate();
+//              usleep(100000);
+        } while (!done);
+        I_Quit();
+
+}
+
+*/
+
+/*
+================
+=
+= I_Error
+=
+================
+*/
+
+/*
+extern boolean demorecording;
+
+void I_Error (char *error, ...)
+{
+  va_list               argptr;
+  char          string[1024];
+
+  if (demorecording)
+    G_CheckDemoStatus();
+
+  D_QuitNetGame ();
+  I_ShutdownGraphics();
+  va_start (argptr,error);
+  fprintf (stderr, "Error: ");
+  vfprintf (stderr,error,argptr);
+  fprintf (stderr, "\n");
+  va_end (argptr);
+  exit(-1);
+}
+
+*/
diff -ruN linuxdoom-1.10.orig/i_system.c linuxdoom-1.10/i_system.c
--- linuxdoom-1.10.orig/i_system.c	Mon Dec 22 17:29:13 1997
+++ linuxdoom-1.10/i_system.c	Thu Jan 22 18:18:49 1998
@@ -107,6 +107,7 @@
 void I_Init (void)
 {
     I_InitSound();
+    I_InitMusic();
     //  I_InitGraphics();
 }
 
@@ -159,25 +160,31 @@
 //
 extern boolean demorecording;
 
+#define _ERROR_HDR "Error: "
+
 void I_Error (char *error, ...)
 {
     va_list	argptr;
+    char        err_buff[1024];
 
-    // Message first.
+    // put message first into buffer
     va_start (argptr,error);
-    fprintf (stderr, "Error: ");
-    vfprintf (stderr,error,argptr);
-    fprintf (stderr, "\n");
+    strcpy(err_buff,_ERROR_HDR);
+    vsprintf(err_buff+strlen(_ERROR_HDR),error,argptr);
+    strcat(err_buff,"\n");
     va_end (argptr);
 
-    fflush( stderr );
-
     // Shutdown. Here might be other errors.
     if (demorecording)
 	G_CheckDemoStatus();
 
     D_QuitNetGame ();
     I_ShutdownGraphics();
-    
+
+    // now print the error to stderr
+    fprintf(stderr,"%s",err_buff);
+    fflush( stderr );
+
     exit(-1);
 }
+
diff -ruN linuxdoom-1.10.orig/i_video.c linuxdoom-1.10/i_video.c
--- linuxdoom-1.10.orig/i_video.c	Mon Dec 22 21:39:01 1997
+++ linuxdoom-1.10/i_video.c	Thu Jan 22 18:18:49 1998
@@ -46,7 +46,7 @@
 #include <sys/socket.h>
 
 #include <netinet/in.h>
-#include <errnos.h>
+#include <errno.h>
 #include <signal.h>
 
 #include "doomstat.h"
diff -ruN linuxdoom-1.10.orig/m_fixed.c linuxdoom-1.10/m_fixed.c
--- linuxdoom-1.10.orig/m_fixed.c	Mon Dec 22 00:48:59 1997
+++ linuxdoom-1.10/m_fixed.c	Thu Jan 22 18:51:41 1998
@@ -36,7 +36,7 @@
 #include "m_fixed.h"
 
 
-
+#ifndef		USEASM
 
 // Fixme. __USE_C_FIXED__ or something.
 
@@ -48,7 +48,7 @@
     return ((long long) a * (long long) b) >> FRACBITS;
 }
 
-
+#endif		// USEASM
 
 //
 // FixedDiv, C version.
@@ -64,7 +64,7 @@
     return FixedDiv2 (a,b);
 }
 
-
+#ifndef		USEASM
 
 fixed_t
 FixedDiv2
@@ -85,3 +85,5 @@
 	I_Error("FixedDiv: divide by zero");
     return (fixed_t) c;
 }
+
+#endif		// USEASM
diff -ruN linuxdoom-1.10.orig/m_misc.c linuxdoom-1.10/m_misc.c
--- linuxdoom-1.10.orig/m_misc.c	Mon Dec 22 21:43:11 1997
+++ linuxdoom-1.10/m_misc.c	Thu Jan 22 18:18:50 1998
@@ -209,10 +209,14 @@
 
 // UNIX hack, to be removed.
 #ifdef SNDSERV
-extern char*	sndserver_filename;
+//extern char*	sndserver_filename;
 extern int	mb_used;
 #endif
 
+#if defined(SNDSERV) || defined(MUSSERV)
+#include "i_sound.h"
+#endif
+
 #ifdef LINUX
 char*		mousetype;
 char*		mousedev;
@@ -256,6 +260,10 @@
 #ifdef SNDSERV
     {"sndserver", (int *) &sndserver_filename, (int) "sndserver"},
     {"mb_used", &mb_used, 2},
+#endif
+#ifdef MUSSERV
+    {"musserver", (int *) &musserver_filename, (int) "musserver"},
+    {"musopts", (int *) &musserver_options, (int) ""},
 #endif
     
 #endif
diff -ruN linuxdoom-1.10.orig/r_draw.c linuxdoom-1.10/r_draw.c
--- linuxdoom-1.10.orig/r_draw.c	Mon Dec 22 21:58:20 1997
+++ linuxdoom-1.10/r_draw.c	Thu Jan 22 21:22:36 1998
@@ -95,6 +95,8 @@
 // just for profiling 
 int			dccount;
 
+#ifndef		USEASM
+
 //
 // A column is a vertical slice/span from a wall texture that,
 //  given the DOOM style restrictions on the view orientation,
@@ -207,6 +209,7 @@
 }
 #endif
 
+#endif		// USEASM
 
 void R_DrawColumnLow (void) 
 { 
@@ -514,6 +517,7 @@
 // just for profiling
 int			dscount;
 
+#ifndef		USEASM
 
 //
 // Draws the actual span.
@@ -636,6 +640,7 @@
 } 
 #endif
 
+#endif		// USEASM
 
 //
 // Again..
diff -ruN linuxdoom-1.10.orig/s_sound.c linuxdoom-1.10/s_sound.c
--- linuxdoom-1.10.orig/s_sound.c	Mon Dec 22 22:01:29 1997
+++ linuxdoom-1.10/s_sound.c	Thu Jan 22 18:18:50 1998
@@ -29,6 +29,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifdef MUSSERV
+#include <sys/msg.h>
+#endif
+
 #include "i_system.h"
 #include "i_sound.h"
 #include "sounds.h"
@@ -364,7 +368,7 @@
   if (sfx->lumpnum < 0)
     sfx->lumpnum = I_GetSfxLumpNum(sfx);
 
-#ifndef SNDSRV
+#ifndef SNDSERV
   // cache data if necessary
   if (!sfx->data)
   {
@@ -678,6 +682,20 @@
     // load & register it
     music->data = (void *) W_CacheLumpNum(music->lumpnum, PU_MUSIC);
     music->handle = I_RegisterSong(music->data);
+
+#ifdef MUSSERV
+
+    if (musserver_msgid != -1) {
+      struct musmsg msg_buffer;
+
+      sprintf(namebuf, "d_%s", music->name);
+      msg_buffer.msg_type=6;
+      memset(msg_buffer.msg_text,0,sizeof(msg_buffer.msg_text));
+      strcpy(msg_buffer.msg_text,namebuf);
+      msgsnd(musserver_msgid,(struct msgbuf *)&msg_buffer,sizeof(msg_buffer.msg_text),IPC_NOWAIT);
+    }
+
+#endif /* #ifdef MUSSERV */
 
     // play it
     I_PlaySong(music->handle, looping);
