--- config.h.orig	Sun Jun  8 00:11:14 1997
+++ config.h	Sun Jun  8 00:12:37 1997
@@ -64,6 +64,14 @@
 #define GUS
 #endif /* GUS */
 
+#elif defined(__FreeBSD__)
+#define BIT_32
+#undef NEAR_FAR_PTR
+#define DSP
+#ifndef GUS
+#define GUS
+#endif /* GUS */
+
 #elif defined(MSDOS)
 #define NEAR_FAR_PTR
 #define DSP
--- dsp.c.orig	Sat Oct 21 14:40:29 1995
+++ dsp.c	Sun Jun  8 00:21:50 1997
@@ -22,14 +22,14 @@
  *  linux_dsp.c - Support for the Linux DSP driver from the Voxware(C) Drivers.
  */
 
-#ifdef LINUX
+#ifdef __FreeBSD__
 #include "config.h"
 #include <unistd.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <sys/types.h>
-#include <linux/soundcard.h>
-#include <bytesex.h>
+#include <machine/soundcard.h>
+#include <machine/endian.h>
 #include "main.h"
 #include "dsp.h"
 
@@ -93,5 +93,5 @@
     return;
 }
 
-#endif /* ?LINUX */
+#endif /* ?__FreeBSD__ */
 
--- gus.c.orig	Sun Jun  8 00:05:28 1997
+++ gus.c	Sun Jun  8 00:05:51 1997
@@ -25,8 +25,8 @@
 
 #ifdef GUS
 
-#include <sys/soundcard.h>
-#include <sys/ultrasound.h>
+#include <machine/soundcard.h>
+#include <machine/ultrasound.h>
 #include <unistd.h>
 #include "gus.h"
 #include "mod.h"
--- main.c.orig	Sun Jun  8 00:05:59 1997
+++ main.c	Sun Jun  8 00:10:46 1997
@@ -56,6 +56,10 @@
   printf("         Linux Support by Daniel Marks \n");
   printf("           GUS Support by David Jeske (jeske@uiuc.edu)\n");
 #endif /* LINUX */
+#ifdef __FreeBSD__
+  printf("         FreeBSD Support by Vanilla I. Shu \n");
+  printf("           GUS Support by David Jeske (jeske@uiuc.edu\n");
+#endif /* __FreeBSD__ */
 #if defined(__sgi)
   printf("           SGI Support by Mike Muuss (Mike@arl.mil)\n\n");
 #endif /* __sgi */
@@ -69,6 +73,9 @@
 #ifdef LINUX
   printf("     -b 16 bit samples\n");
 #endif /* ?LINUX */
+#ifdef __FreeBSD__
+  printf("     -b 16 bit samples\n");
+#endif /* __FreeBSD__ */
   printf("     -f set frequency\n");
   printf("     -q quiet (don't print anything)\n");
   printf("     -n don't loop\n");
@@ -76,6 +83,9 @@
 #ifdef LINUX
   printf("     -g do NOT use GUS native mode\n");
 #endif /* ?LINUX */
+#ifdef __FreeBSD__
+  printf("     -g do NOT use GUS native mode\n");
+#endif /* __FreeBSD__ */
   printf("     -p PAL speed adjustment (145bpm start)\n");
   printf("s3mod -sbf 44100 foobar.mod\n");
   printf("   plays in stereo, 16 bits, 44.1 kHz\n\n");
--- mod.c.orig	Sun Jun  8 00:12:48 1997
+++ mod.c	Sun Jun  8 00:14:30 1997
@@ -11,7 +11,7 @@
 
 
 #ifdef GUS
-#include <sys/ultrasound.h>
+#include <machine/ultrasound.h>
 #include "gus.h"
 #endif /* GUS */
 
@@ -130,8 +130,10 @@
     /* Portamento Down */
     if ((track->period += track->port_down) > track->period_high_limit)
       track->period = track->period_high_limit;
-    track->pitch = track->finetune_rate / track->period;
-
+    if (track->period != 0)
+      track->pitch = track->finetune_rate / track->period;
+    else
+      track->pitch = 1;
     track->playing_period = track->period;
   }
 
--- play.c.orig	Sun Jun  8 00:15:23 1997
+++ play.c	Sun Jun  8 00:15:46 1997
@@ -36,7 +36,7 @@
 #include "dsp.h"
 
 #ifdef GUS
-#include <sys/ultrasound.h>
+#include <machine/ultrasound.h>
 #include "gus.h"
 #endif /* GUS */
 
--- gus.h.orig	Sun Jun  8 00:31:14 1997
+++ gus.h	Sun Jun  8 00:31:23 1997
@@ -26,7 +26,7 @@
 #ifndef _GUS_H
 #define _GUS_H 
 
-#include <sys/soundcard.h>
+#include <machine/soundcard.h>
 
 #define ERR_SEQUENCER    51
 #define ERR_NOGUS        53
