changeset 704:c4803992e09c

Small bugfixes
author Patrice Mandin <patmandin@gmail.com>
date Sat, 30 Aug 2003 20:00:11 +0000
parents ca809c1b41ca
children 6ae8eacccc7c
files src/audio/mint/SDL_mintaudio.c src/audio/mint/SDL_mintaudio.h src/audio/mint/SDL_mintaudio_dma8.c src/audio/mint/SDL_mintaudio_gsxb.c src/audio/mint/SDL_mintaudio_it.S src/audio/mint/SDL_mintaudio_mcsn.c src/audio/mint/SDL_mintaudio_stfa.c src/audio/mint/SDL_mintaudio_xbios.c
diffstat 8 files changed, 80 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/mint/SDL_mintaudio.c	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio.c	Sat Aug 30 20:00:11 2003 +0000
@@ -38,9 +38,9 @@
 
 SDL_AudioDevice *SDL_MintAudio_device;
 Uint8 *SDL_MintAudio_audiobuf[2];	/* Pointers to buffers */
-long SDL_MintAudio_audiosize;		/* Length of audio buffer=spec->size */
-long SDL_MintAudio_numbuf;		/* Buffer to play */
-long SDL_MintAudio_mutex;
+unsigned long SDL_MintAudio_audiosize;		/* Length of audio buffer=spec->size */
+unsigned short SDL_MintAudio_numbuf;		/* Buffer to play */
+unsigned short SDL_MintAudio_mutex;
 cookie_stfa_t	*SDL_MintAudio_stfa;
 
 /* The callback function, called by each driver whenever needed */
--- a/src/audio/mint/SDL_mintaudio.h	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio.h	Sat Aug 30 20:00:11 2003 +0000
@@ -106,9 +106,9 @@
 /* Variables */
 extern SDL_AudioDevice *SDL_MintAudio_device;
 extern Uint8 *SDL_MintAudio_audiobuf[2];	/* Pointers to buffers */
-extern long SDL_MintAudio_audiosize;		/* Length of audio buffer=spec->size */
-extern long SDL_MintAudio_numbuf;		/* Buffer to play */
-extern long SDL_MintAudio_mutex;
+extern unsigned long SDL_MintAudio_audiosize;		/* Length of audio buffer=spec->size */
+extern unsigned short SDL_MintAudio_numbuf;		/* Buffer to play */
+extern unsigned short SDL_MintAudio_mutex;
 extern cookie_stfa_t *SDL_MintAudio_stfa;
 
 /* Functions */
--- a/src/audio/mint/SDL_mintaudio_dma8.c	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio_dma8.c	Sat Aug 30 20:00:11 2003 +0000
@@ -223,7 +223,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -263,7 +263,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -327,10 +327,6 @@
 	SDL_CalculateAudioSpec(spec);
 
 	/* Allocate memory for audio buffers in DMA-able RAM */
-	spec->size = spec->samples;
-	spec->size *= spec->channels;
-	spec->size *= (spec->format & 0xFF)/8;
-
 	DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
 
 	SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
--- a/src/audio/mint/SDL_mintaudio_gsxb.c	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Sat Aug 30 20:00:11 2003 +0000
@@ -214,9 +214,10 @@
 	resolution = spec->format & 0x00ff;
 	format_signed = ((spec->format & 0x8000)!=0);
 	format_bigendian = ((spec->format & 0x1000)!=0);
-	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",resolution));
-	DEBUG_PRINT(("signed=%d, ", format_signed));
-	DEBUG_PRINT(("big endian=%d, ", format_bigendian));
+
+	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
+	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -268,9 +269,9 @@
 			spec->format = spec->format & (~0x1000);
 		}
 	} else {
-		if (snd_format & SND_FORMATBIGENDIAN) {
+		if (snd_format & SND_FORMATLITTLEENDIAN) {
 			/* Ok */
-		} else if (snd_format & SND_FORMATLITTLEENDIAN) {
+		} else if (snd_format & SND_FORMATBIGENDIAN) {
 			/* Give big endian format */
 			spec->format |= 0x1000;
 		}
@@ -289,7 +290,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -368,10 +369,6 @@
 	SDL_CalculateAudioSpec(spec);
 
 	/* Allocate memory for audio buffers in DMA-able RAM */
-	spec->size = spec->samples;
-	spec->size *= spec->channels;
-	spec->size *= (spec->format & 0xFF)/8;
-
 	DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
 
 	SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
--- a/src/audio/mint/SDL_mintaudio_it.S	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio_it.S	Sat Aug 30 20:00:11 2003 +0000
@@ -62,27 +62,27 @@
 	notw	_SDL_MintAudio_mutex
 	
 	/* Swap buffers */
-	moveml	d0-d2/a0-a2,sp@-
+	eorw	#1,_SDL_MintAudio_numbuf
 
-	movel	_SDL_MintAudio_numbuf,d0
-	movel	_SDL_MintAudio_audiobuf,a0
-	eorl	#1,d0
-	beqs	SDL_MintAudio_GsxbBuffer0
-	movel	_SDL_MintAudio_audiobuf+4,a0
-SDL_MintAudio_GsxbBuffer0:
-	movel	d0,_SDL_MintAudio_numbuf
+	moveml	d0-d2/a0-a2,sp@-
 
 	/* Callback */
-	movel	a0,sp@-
 	jsr	_SDL_MintAudio_Callback
-	movel	sp@+,a0
+
+	/* Set new buffer */
+
+	moveq	#0,d0
+	movel	_SDL_MintAudio_audiosize,d1
 
-	/* Setbuffer xbios function */
-	movel	_SDL_MintAudio_audiosize,d1
-	lea	a0@(0,d1:l),a1
+	movew	_SDL_MintAudio_numbuf,d0
+	lsll	#2,d0
+	lea	_SDL_MintAudio_audiobuf,a0
+	movel	a0@(d0:l),a1
 
+	lea	a1@(d1:l),a2
+
+	movel	a2,sp@-
 	movel	a1,sp@-
-	movel	a0,sp@-
 	clrw	sp@-
 	movew	#131,sp@-
 	trap	#14
@@ -110,27 +110,27 @@
 	notw	_SDL_MintAudio_mutex
 	
 	/* Swap buffers */
-	moveml	d0-d2/a0-a2,sp@-
+	eorw	#1,_SDL_MintAudio_numbuf
 
-	movel	_SDL_MintAudio_numbuf,d0
-	movel	_SDL_MintAudio_audiobuf,a0
-	eorl	#1,d0
-	beqs	SDL_MintAudio_XbiosBuffer0
-	movel	_SDL_MintAudio_audiobuf+4,a0
-SDL_MintAudio_XbiosBuffer0:
-	movel	d0,_SDL_MintAudio_numbuf
+	moveml	d0-d2/a0-a2,sp@-
 
 	/* Callback */
-	movel	a0,sp@-
 	jsr	_SDL_MintAudio_Callback
-	movel	sp@+,a0
+
+	/* Set new buffer */
+
+	moveq	#0,d0
+	movel	_SDL_MintAudio_audiosize,d1
 
-	/* Setbuffer xbios function */
-	movel	_SDL_MintAudio_audiosize,d1
-	lea	a0@(0,d1:l),a1
+	movew	_SDL_MintAudio_numbuf,d0
+	lsll	#2,d0
+	lea	_SDL_MintAudio_audiobuf,a0
+	movel	a0@(d0:l),a1
 
+	lea	a1@(d1:l),a2
+
+	movel	a2,sp@-
 	movel	a1,sp@-
-	movel	a0,sp@-
 	clrw	sp@-
 	movew	#131,sp@-
 	trap	#14
@@ -158,20 +158,21 @@
 	notw	_SDL_MintAudio_mutex
 	
 	/* Swap buffers */
+	eorw	#1,_SDL_MintAudio_numbuf
+
 	moveml	d0-d1/a0-a1,sp@-
 
-	movel	_SDL_MintAudio_numbuf,d0
-	movel	_SDL_MintAudio_audiobuf,d1
-	eorl	#1,d0
-	beqs	SDL_MintAudio_Dma8Buffer0
-	movel	_SDL_MintAudio_audiobuf+4,d1
-SDL_MintAudio_Dma8Buffer0:
-	movel	d0,_SDL_MintAudio_numbuf
+	/* Callback */
+	jsr	_SDL_MintAudio_Callback
+
+	/* Set new buffer */
 
-	/* Callback */
-	movel	d1,sp@-
-	jsr	_SDL_MintAudio_Callback
-	movel	sp@+,d1
+	moveq	#0,d0
+
+	movew	_SDL_MintAudio_numbuf,d0
+	lslw	#2,d0
+	lea	_SDL_MintAudio_audiobuf,a0
+	movel	a0@(d0:w),d1
 
 	/* Modify DMA addresses */
 	lea	0xffff8900:w,a0
@@ -213,30 +214,30 @@
 	notw	_SDL_MintAudio_mutex
 	
 	/* Swap buffers */
+	eorw	#1,_SDL_MintAudio_numbuf
+
 	moveml	d0-d1/a0-a1,sp@-
 
-	movel	_SDL_MintAudio_numbuf,d0
-	movel	_SDL_MintAudio_audiobuf,d1
-	eorl	#1,d0
-	beqs	SDL_MintAudio_StfaBuffer0
-	movel	_SDL_MintAudio_audiobuf+4,d1
-SDL_MintAudio_StfaBuffer0:
-	movel	d0,_SDL_MintAudio_numbuf
+	/* Callback */
+	jsr	_SDL_MintAudio_Callback
+
+	/* Set new buffer */
 
-	/* Callback */
-	movel	d1,sp@-
-	jsr	_SDL_MintAudio_Callback
-	movel	sp@+,d1
+	moveq	#0,d0
+	movel	_SDL_MintAudio_stfa,a1
+
+	movew	_SDL_MintAudio_numbuf,d0
+	lslw	#2,d0
+	lea	_SDL_MintAudio_audiobuf,a0
+	movel	a0@(d0:w),d1
 
 	/* Modify STFA replay buffers */
-	movel	_SDL_MintAudio_stfa,a0
-	movel	d1,a0@(STFA_SOUND_START)
+	movel	d1,a1@(STFA_SOUND_START)
 	addl	_SDL_MintAudio_audiosize,d1
-	movel	d1,a0@(STFA_SOUND_END)
+	movel	d1,a1@(STFA_SOUND_END)
 
 	moveml	sp@+,d0-d1/a0-a1
 
 	clrw	_SDL_MintAudio_mutex
 SDL_MintAudio_StfaEnd:
 	rte
-
--- a/src/audio/mint/SDL_mintaudio_mcsn.c	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio_mcsn.c	Sat Aug 30 20:00:11 2003 +0000
@@ -212,7 +212,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -263,7 +263,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -352,10 +352,6 @@
 	SDL_CalculateAudioSpec(spec);
 
 	/* Allocate memory for audio buffers in DMA-able RAM */
-	spec->size = spec->samples;
-	spec->size *= spec->channels;
-	spec->size *= (spec->format & 0xFF)/8;
-
 	DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
 
 	SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
--- a/src/audio/mint/SDL_mintaudio_stfa.c	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio_stfa.c	Sat Aug 30 20:00:11 2003 +0000
@@ -206,7 +206,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -223,7 +223,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -254,15 +254,15 @@
 	} else {
 		cookie_stfa->sound_control |= STFA_FORMAT_MONO;
 	}
-	if (spec->format & 0x8000) {
+	if ((spec->format & 0x8000)!=0) {
 		cookie_stfa->sound_control |= STFA_FORMAT_SIGNED;
 	} else {
 		cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED;
 	}
-	if (spec->format & 0x1000) {
+	if ((spec->format & 0x1000)!=0) {
+		cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN;
+	} else {
 		cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN;
-	} else {
-		cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN;
 	}
 
 	/* Set buffer */
@@ -292,10 +292,6 @@
 	SDL_CalculateAudioSpec(spec);
 
 	/* Allocate memory for audio buffers in DMA-able RAM */
-	spec->size = spec->samples;
-	spec->size *= spec->channels;
-	spec->size *= (spec->format & 0xFF)/8;
-
 	DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
 
 	SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);
--- a/src/audio/mint/SDL_mintaudio_xbios.c	Sat Aug 30 17:12:10 2003 +0000
+++ b/src/audio/mint/SDL_mintaudio_xbios.c	Sat Aug 30 20:00:11 2003 +0000
@@ -192,7 +192,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -215,7 +215,7 @@
 
 	DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
-	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0)));
+	DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0)));
 	DEBUG_PRINT(("channels=%d, ", spec->channels));
 	DEBUG_PRINT(("freq=%d\n", spec->freq));
 
@@ -292,10 +292,6 @@
 	SDL_CalculateAudioSpec(spec);
 
 	/* Allocate memory for audio buffers in DMA-able RAM */
-	spec->size = spec->samples;
-	spec->size *= spec->channels;
-	spec->size *= (spec->format & 0xFF)/8;
-
 	DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
 
 	SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);