Skip to content

Commit

Permalink
Import fuse-0.4.1; submitted by Alexander Yurchenko <[email protected]>.
Browse files Browse the repository at this point in the history
fuse is a free version of ZX Spectrum emulator. It emulates
48K/128K/+2/+2A machine, supports loading from .tzx files,
has sound and kempston joystick emulation, emulates various
printers you could attach to the Spectrum.
  • Loading branch information
Christian Weisgerber committed Feb 27, 2002
1 parent 870c5ec commit 13e4675
Show file tree
Hide file tree
Showing 10 changed files with 335 additions and 0 deletions.
41 changes: 41 additions & 0 deletions emulators/fuse/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# $OpenBSD: Makefile,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $
# $RuOBSD: Makefile,v 1.4 2002/02/12 02:37:09 grange Exp $

COMMENT= "Free Unix Spectrum Emulator"

DISTNAME= fuse-0.4.1
CATEGORIES= emulators
NEED_VERSION= 1.504

HOMEPAGE= http://www.srcf.ucam.org/~pak21/spectrum/fuse.html

MAINTAINER= Alexander Yurchenko <[email protected]>

# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes

MASTER_SITES= http://www.srcf.ucam.org/~pak21/spectrum/ \
ftp://ftp.worldofspectrum.org/pub/sinclair/emulators/unix/

USE_X11= Yes
LIB_DEPENDS= glib.1.2::devel/glib

CONFIGURE_STYLE= gnu

FLAVORS=gtk
FLAVOR?=

.if ${FLAVOR:L:Mgtk}
LIB_DEPENDS= gtk.1.2,gdk.1.2::x11/gtk+
.else
CONFIGURE_ARGS= --without-gtk
.endif

post-extract:
@ln -s ${FILESDIR}/sunsound.c ${WRKSRC}
@ln -s ${FILESDIR}/sunsound.h ${WRKSRC}

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions emulators/fuse/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD5 (fuse-0.4.1.tar.gz) = 938d993293f318376e1ba8ca9cf9cecb
RMD160 (fuse-0.4.1.tar.gz) = c0745aa268b6a1e14345f2d6a676a1c61b3d0799
SHA1 (fuse-0.4.1.tar.gz) = e765fed04d3bd1fc03193af12273144a06a4f9ce
126 changes: 126 additions & 0 deletions emulators/fuse/files/sunsound.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/* $OpenBSD: sunsound.c,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $ */
/* $RuOBSD: sunsound.c,v 1.2 2002/02/12 01:52:18 grange Exp $ */

#include "config.h"

#if defined(HAVE_SYS_AUDIOIO_H) /* SUN sound */

#include <sys/types.h>
#include <sys/audioio.h>
#include <sys/ioctl.h>

#include <fcntl.h>
#include <string.h>
#include <unistd.h>

#include "sunsound.h"

/* using (8) 64 byte frags for 8kHz, scale up for higher */
#define BASE_SOUND_FRAG_PWR 6

static int soundfd = -1;
static int sixteenbit = 0;

int
sunsound_init(freqptr, stereoptr)
int *freqptr, *stereoptr;
{
int frag;
struct audio_info ai;

if ((soundfd = open("/dev/audio", O_WRONLY)) == -1)
return 1;

AUDIO_INITINFO(&ai);

ai.play.encoding = AUDIO_ENCODING_ULINEAR;
ai.play.precision = 8;
if (ioctl(soundfd, AUDIO_SETINFO, &ai) == -1) {
/* try 16-bit, may be a 16-bit only device */
ai.play.precision = 16;
if (ioctl(soundfd, AUDIO_SETINFO, &ai) == -1) {
close(soundfd);
return 1;
}
sixteenbit = 1;
}

ai.play.channels = *stereoptr ? 2 : 1;
if (ioctl(soundfd, AUDIO_SETINFO, &ai) == -1) {
/* if it failed make sure the opposite is ok */
ai.play.channels = *stereoptr ? 1 : 2;
if (ioctl(soundfd, AUDIO_SETINFO, &ai) == -1) {
close(soundfd);
return 1;
}
*stereoptr = *stereoptr ? 1 : 2;
}

ai.play.sample_rate = *freqptr;
if (ioctl(soundfd, AUDIO_SETINFO, &ai) == -1) {
close(soundfd);
return 1;
}

frag = 0x80000 | BASE_SOUND_FRAG_PWR;
if (*freqptr > 8250)
frag++;
if (*freqptr > 16500)
frag++;
if (*freqptr > 33000)
frag++;
if (*stereoptr)
frag++;
if (sixteenbit)
frag++;
ai.blocksize = 1 << (frag & 0xffff);
ai.hiwat = ((unsigned)frag >> 16) & 0x7fff;
if (ai.hiwat == 0)
ai.hiwat = 65536;
if (ioctl(soundfd, AUDIO_SETINFO, &ai) == -1) {
close(soundfd);
return 1;
}

return 0;
}

void
sunsound_end()
{
ioctl(soundfd, AUDIO_FLUSH);
close(soundfd);
}

void
sunsound_frame(data, len)
unsigned char *data;
int len;
{
unsigned char buf16[8192];
int ret=0, ofs=0;

if (sixteenbit) {
unsigned char *src, *dst;
int f;

src = data;
dst = buf16;
for (f = 0; f < len; f++) {
*dst++ = 128;
*dst++ = *src++ - 128;
}

data = buf16;
len <<= 1;
}

while (len) {
if ((ret = write(soundfd, data + ofs, len)) == -1)
break;
ofs += ret;
len -= ret;
}
}

#endif /* HAVE_SYS_AUDIOIO_H */
11 changes: 11 additions & 0 deletions emulators/fuse/files/sunsound.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* $OpenBSD: sunsound.h,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $ */
/* $RuOBSD: sunsound.h,v 1.1 2002/02/11 22:56:25 grange Exp $ */

#ifndef FUSE_SUNSOUND_H
#define FUSE_SUNSOUND_H

int sunsound_init(int *, int *);
void sunsound_end(void);
void sunsound_frame(unsigned char *, int);

#endif /* FUSE_SUNSOUND_H */
52 changes: 52 additions & 0 deletions emulators/fuse/patches/patch-Makefile_in
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
$OpenBSD: patch-Makefile_in,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $
$RuOBSD: patch-Makefile_in,v 1.2 2002/02/12 02:37:09 grange Exp $
--- Makefile.in.orig Tue Feb 5 02:05:57 2002
+++ Makefile.in Tue Feb 12 04:45:33 2002
@@ -76,7 +76,7 @@

SUBDIRS = lib libspectrum man myglib roms ui utils widget z80

-fuse_SOURCES = ay.c display.c event.c fuse.c keyboard.c keysyms.c machine.c osssound.c settings.c snapshot.c sound.c spec128.c spec48.c specplus2.c specplus3.c spectrum.c tape.c timer.c uidisplay.c utils.c joystick.c printer.c
+fuse_SOURCES = ay.c display.c event.c fuse.c keyboard.c keysyms.c machine.c osssound.c sunsound.c settings.c snapshot.c sound.c spec128.c spec48.c specplus2.c specplus3.c spectrum.c tape.c timer.c uidisplay.c utils.c joystick.c printer.c


BUILT_SOURCES = keysyms.c
@@ -85,7 +85,7 @@
LDADD = @GLIB_LIBS@ @GTK_LIBS@ libspectrum/libspectrum.a myglib/libmyglib.a ui/aalib/libuiaalib.a ui/fb/libuifb.a ui/gtk/libuigtk.a ui/svga/libuisvga.a ui/xlib/libuixlib.a widget/libwidget.a z80/libz80.a


-noinst_HEADERS = ay.h display.h event.h fuse.h keyboard.h keysyms.h machine.h osssound.h settings.h snapshot.h sound.h spec128.h spec48.h specplus2.h specplus3.h spectrum.h tape.h timer.h types.h utils.h joystick.h printer.h
+noinst_HEADERS = ay.h display.h event.h fuse.h keyboard.h keysyms.h machine.h osssound.h sunsound.h settings.h snapshot.h sound.h spec128.h spec48.h specplus2.h specplus3.h spectrum.h tape.h timer.h types.h utils.h joystick.h printer.h


EXTRA_DIST = AUTHORS README THANKS hacking/ui.txt keysyms.dat keysyms.pl
@@ -105,9 +105,9 @@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
fuse_OBJECTS = ay.o display.o event.o fuse.o keyboard.o keysyms.o \
-machine.o osssound.o settings.o snapshot.o sound.o spec128.o spec48.o \
-specplus2.o specplus3.o spectrum.o tape.o timer.o uidisplay.o utils.o \
-joystick.o printer.o
+machine.o osssound.o sunsound.o settings.o snapshot.o sound.o spec128.o \
+spec48.o specplus2.o specplus3.o spectrum.o tape.o timer.o uidisplay.o \
+utils.o joystick.o printer.o
fuse_LDADD = $(LDADD)
fuse_DEPENDENCIES = libspectrum/libspectrum.a myglib/libmyglib.a \
ui/aalib/libuiaalib.a ui/fb/libuifb.a ui/gtk/libuigtk.a \
@@ -390,6 +390,7 @@
display.h spectrum.h spec48.h spec128.h specplus2.h specplus3.h \
tape.h utils.h z80/z80.h
osssound.o: osssound.c config.h types.h sound.h spectrum.h osssound.h
+sunsound.o: sunsound.c config.h sunsound.h
printer.o: printer.c config.h fuse.h machine.h ay.h types.h display.h \
spectrum.h printer.h
settings.o: settings.c config.h fuse.h machine.h ay.h types.h display.h \
@@ -397,7 +398,7 @@
snapshot.o: snapshot.c config.h display.h types.h fuse.h \
libspectrum/libspectrum.h machine.h ay.h spectrum.h sound.h \
snapshot.h spec128.h utils.h z80/z80.h z80/z80_macros.h
-sound.o: sound.c config.h osssound.h fuse.h machine.h ay.h types.h \
+sound.o: sound.c config.h osssound.h sunsound.h fuse.h machine.h ay.h types.h \
display.h spectrum.h settings.h sound.h
spec128.o: spec128.c config.h ay.h types.h display.h fuse.h joystick.h \
keyboard.h machine.h spectrum.h snapshot.h sound.h spec128.h \
14 changes: 14 additions & 0 deletions emulators/fuse/patches/patch-config_h_in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$OpenBSD: patch-config_h_in,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $
$RuOBSD: patch-config_h_in,v 1.1 2002/02/11 22:54:34 grange Exp $
--- config.h.in.orig Sat Feb 9 17:41:51 2002
+++ config.h.in Sat Feb 9 17:41:54 2002
@@ -80,6 +80,9 @@
/* Define if you have the <sys/soundcard.h> header file. */
#undef HAVE_SYS_SOUNDCARD_H

+/* Define if you have the <sys/audioio.h> header file. */
+#undef HAVE_SYS_AUDIOIO_H
+
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

12 changes: 12 additions & 0 deletions emulators/fuse/patches/patch-configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$OpenBSD: patch-configure,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $
--- configure.orig Tue Feb 26 22:29:50 2002
+++ configure Tue Feb 26 22:30:05 2002
@@ -1370,7 +1370,7 @@ EOF

fi

-for ac_hdr in sys/time.h unistd.h sys/soundcard.h
+for ac_hdr in sys/time.h unistd.h sys/soundcard.h sys/audioio.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
53 changes: 53 additions & 0 deletions emulators/fuse/patches/patch-sound_c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
$OpenBSD: patch-sound_c,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $
$RuOBSD: patch-sound_c,v 1.1 2002/02/11 22:54:34 grange Exp $
--- sound.c.orig Sat Feb 9 17:52:59 2002
+++ sound.c Sat Feb 9 17:52:02 2002
@@ -47,6 +47,9 @@
#if defined(HAVE_SYS_SOUNDCARD_H)
#include "osssound.h"
#endif
+#if defined(HAVE_SYS_AUDIOIO_H)
+#include "sunsound.h"
+#endif

#include "fuse.h"
#include "machine.h"
@@ -177,7 +180,7 @@
int f,ret;

/* if we don't have any sound I/O code compiled in, don't do sound */
-#if !defined(HAVE_SYS_SOUNDCARD_H) /* only type for now */
+#if !defined(HAVE_SYS_SOUNDCARD_H) && !defined(HAVE_SYS_AUDIOIO_H)
return;
#endif

@@ -199,6 +202,9 @@
#if defined(HAVE_SYS_SOUNDCARD_H)
ret=osssound_init(&sound_freq,&sound_stereo);
#endif
+#if defined(HAVE_SYS_AUDIOIO_H)
+ret=sunsound_init(&sound_freq,&sound_stereo);
+#endif

if(ret)
return;
@@ -294,6 +300,9 @@
#if defined(HAVE_SYS_SOUNDCARD_H)
osssound_end();
#endif
+#if defined(HAVE_SYS_AUDIOIO_H)
+ sunsound_end();
+#endif
sound_enabled=0;
}
}
@@ -758,6 +767,9 @@

#if defined(HAVE_SYS_SOUNDCARD_H)
osssound_frame(sound_buf,sound_framesiz*sound_channels);
+#endif
+#if defined(HAVE_SYS_AUDIOIO_H)
+sunsound_frame(sound_buf,sound_framesiz*sound_channels);
#endif

sound_oldpos[0]=sound_oldpos[1]=-1;
6 changes: 6 additions & 0 deletions emulators/fuse/pkg/DESCR
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fuse is a free version of ZX Spectrum emulator. It emulates
48K/128K/+2/+2A machine, supports loading from .tzx files,
has sound and kempston joystick emulation, emulates various
printers you could attach to the Spectrum.

WWW: ${HOMEPAGE}
17 changes: 17 additions & 0 deletions emulators/fuse/pkg/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2002/02/27 00:37:10 naddy Exp $
@comment $RuOBSD: PLIST,v 1.3 2002/02/12 02:37:09 grange Exp $
bin/fuse
bin/tzxlist
man/man1/fuse.1
man/man1/tzxlist.1
share/fuse/128-0.rom
share/fuse/128-1.rom
share/fuse/48.rom
share/fuse/keyboard.scr
share/fuse/plus2-0.rom
share/fuse/plus2-1.rom
share/fuse/plus3-0.rom
share/fuse/plus3-1.rom
share/fuse/plus3-2.rom
share/fuse/plus3-3.rom
@dirrm share/fuse

0 comments on commit 13e4675

Please sign in to comment.