[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] audiodev for ColdFire



Hello.

Here is a patch to compile audiodev.xdd for ColdFire.
While the resulting xdd is perfectly correct, it does not work well on the FireBee.

First, EmuTOS lacks the SND_DSP flag in the _SND cookie, so audiodev.xdd initializes itself in PSG (YM2149) mode. The sound is inaudible by default, fortunately a single key press turns it on, thanks to the key click. After that, we can guess the sound, but it is trashy inside the noise. Even if the FireBee's YM2149 is very accurate for normal soundchip, it doesn't seem to work well for digitized sounds.

And even if Falcon sound support was enabled, it would not work because Falcon DMA sound is not properly emulated on the FireBee hardware.

Anyway, as far as software is concerned, this ColdFire patch is correct.

Alan, please commit!

audiodev.patch
Added support for audiodev on ColdFire. Provided by Vincent Riviere.

--
Vincent Rivière
diff -aurN -x CVS freemint-CVS-20141002.orig/sys/xdd/audio/Makefile freemint-CVS-20141002/sys/xdd/audio/Makefile
--- freemint-CVS-20141002.orig/sys/xdd/audio/Makefile	2014-10-02 23:09:13.000000000 +0200
+++ freemint-CVS-20141002/sys/xdd/audio/Makefile	2014-10-07 21:30:01.312500000 +0200
@@ -28,7 +28,7 @@
 
 # default definitions
 SGENFILES = $(TARGET)
-OBJS = $(COBJS:.c=.o) $(SOBJS:.s=.o)
+OBJS = $(COBJS:.c=.o) $(SOBJS:.S=.o)
 
 $(TARGET): $(OBJS) $(LIBKERNTARGET)
 	$(LD) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
diff -aurN -x CVS freemint-CVS-20141002.orig/sys/xdd/audio/SRCFILES freemint-CVS-20141002/sys/xdd/audio/SRCFILES
--- freemint-CVS-20141002.orig/sys/xdd/audio/SRCFILES	2014-10-02 23:09:13.000000000 +0200
+++ freemint-CVS-20141002/sys/xdd/audio/SRCFILES	2014-10-07 21:33:32.890625000 +0200
@@ -17,6 +17,6 @@
 	psgtab.c
 
 SOBJS = \
-	audioasm.s
+	audioasm.S
 
 SRCFILES = $(HEADER) $(COBJS) $(SOBJS)
diff -aurN -x CVS freemint-CVS-20141002.orig/sys/xdd/audio/audioasm.S freemint-CVS-20141002/sys/xdd/audio/audioasm.S
--- freemint-CVS-20141002.orig/sys/xdd/audio/audioasm.S	2014-10-02 23:09:13.000000000 +0200
+++ freemint-CVS-20141002/sys/xdd/audio/audioasm.S	2014-10-07 22:59:59.578125000 +0200
@@ -23,25 +23,54 @@
 	.long 0
 
 _new_gpi7_vector:
+#ifdef __mcoldfire__
+	lea	sp@(-16), sp
+	moveml	d0-d1/a0-a1, sp@
+#else
 	moveml	d0-d1/a0-a1, sp@-
+#endif
 	moveal	_timer_func, a0
 	jsr a0@			| do thangs...
+#ifdef __mcoldfire__
+	lea	mfp_isra:w, a0
+	moveb	#0x7f, a0@
+	moveml	sp@, d0-d1/a0-a1
+	lea	sp@(16), sp
+#else
 	moveml	sp@+, d0-d1/a0-a1
 	moveb	#0x7f, mfp_isra:w
+#endif
 	rte
 
 _new_timera_vector:
+#ifdef __mcoldfire__
+	lea	sp@(-16), sp
+	moveml	d0-d1/a0-a1, sp@
+#else
 	moveml	d0-d1/a0-a1, sp@-
+#endif
 	moveal	_timer_func, a0
 	jsr	a0@			| do things...
+#ifdef __mcoldfire__
+	lea	mfp_isra:w, a0
+	moveb	#0xdf, a0@
+	moveml	sp@, d0-d1/a0-a1
+	lea	sp@(16), sp
+#else
 	moveml	sp@+, d0-d1/a0-a1
 	moveb	#0xdf, mfp_isra:w
+#endif
 	rte
 
 	.globl _digitab, _playptr, _playlen, _psg_player
 
 _psg_player:
+#ifdef __mcoldfire__
+	lea	sp@(-16), sp
+	moveml	d0-d1/a0-a1, sp@
+#else
 	moveml	d0-d1/a0-a1, sp@-
+#endif
 	tstl	_playlen
 	bgt	_psg_player_1
 	moveal	_timer_func, a0
@@ -56,12 +85,30 @@
 	movel	a0, _playptr
 	lsll	#3, d0
 	lea	_digitab, a0
+#ifdef __mcoldfire__
+	addl	d0, a0
+	lea	0xffff8800:w, a1
+	moveb	a0@+, a1@
+	moveb	a0@+, a1@(2)
+	moveb	a0@+, a1@
+	moveb	a0@+, a1@(2)
+	moveb	a0@+, a1@
+	moveb	a0@, a1@(2)
+#else
 	movel	a0@(0,d0:w), d1
 	movew	a0@(4,d0:w), d0
 	lea	0xffff8800:w, a0
 	movepl	d1, a0@(0)
 	movepw	d0, a0@(0)
+#endif
 _psg_player_2:
+#ifdef __mcoldfire__
+	lea	mfp_isra:w, a0
+	moveb	#0xdf, a0@
+	moveml	sp@, d0-d1/a0-a1
+	lea	sp@(16), sp
+#else
 	moveml	sp@+, d0-d1/a0-a1
 	moveb	#0xdf, mfp_isra:w
+#endif
 	rte