changeset 1097:c83fa1c650dd

Move GSXB callback to C source
author Patrice Mandin <patmandin@gmail.com>
date Wed, 20 Jul 2005 17:44:11 +0000
parents 37b766becf3b
children 2911ff0a32bb
files src/audio/mint/SDL_mintaudio_gsxb.c src/audio/mint/SDL_mintaudio_it.S
diffstat 2 files changed, 27 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/mint/SDL_mintaudio_gsxb.c	Wed Jul 20 17:40:58 2005 +0000
+++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Wed Jul 20 17:44:11 2005 +0000
@@ -77,6 +77,10 @@
 static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
 static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
 
+/* GSXB callbacks */
+static void Mint_GsxbInterrupt(void);
+static void Mint_GsxbNullInterrupt(void);
+
 /*--- Audio driver bootstrap functions ---*/
 
 static int Audio_Available(void)
@@ -180,7 +184,7 @@
 	Buffoper(0);
 
 	/* Uninstall interrupt */
-	if (NSetinterrupt(2, SI_NONE, SDL_MintAudio_EmptyGsxbInterrupt)<0) {
+	if (NSetinterrupt(2, SI_NONE, Mint_GsxbNullInterrupt)<0) {
 		DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n"));
 	}
 
@@ -342,7 +346,7 @@
 	}
 	
 	/* Install interrupt */
-	if (NSetinterrupt(2, SI_PLAY, SDL_MintAudio_GsxbInterrupt)<0) {
+	if (NSetinterrupt(2, SI_PLAY, Mint_GsxbInterrupt)<0) {
 		DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n"));
 	}
 
@@ -390,3 +394,24 @@
 
     return(1);	/* We don't use threaded audio */
 }
+
+static void Mint_GsxbInterrupt(void)
+{
+	Uint8 *newbuf;
+
+	if (SDL_MintAudio_mutex)
+		return;
+
+	SDL_MintAudio_mutex=1;
+
+	SDL_MintAudio_numbuf ^= 1;
+	SDL_MintAudio_Callback();
+	newbuf = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
+	Setbuffer(0, newbuf, newbuf + SDL_MintAudio_audiosize);
+
+	SDL_MintAudio_mutex=0;
+}
+
+static void Mint_GsxbNullInterrupt(void)
+{
+}
--- a/src/audio/mint/SDL_mintaudio_it.S	Wed Jul 20 17:40:58 2005 +0000
+++ b/src/audio/mint/SDL_mintaudio_it.S	Wed Jul 20 17:44:11 2005 +0000
@@ -30,8 +30,6 @@
 
 	.globl	_SDL_MintAudio_Callback
 
-	.globl	_SDL_MintAudio_GsxbInterrupt
-	.globl	_SDL_MintAudio_EmptyGsxbInterrupt
 	.globl	_SDL_MintAudio_XbiosInterrupt
 	.globl	_SDL_MintAudio_XbiosInterruptMeasureClock
 	.globl	_SDL_MintAudio_Dma8Interrupt
@@ -56,49 +54,6 @@
 #define	savptr	0x4a2
 #define	savamt	0x46
 
-/*--- GSXB interrupt vector ---*/
-
-	.text
-_SDL_MintAudio_GsxbInterrupt:
-
-	/* Check if we are not already running */
-	tstw	_SDL_MintAudio_mutex
-	bnes	_SDL_MintAudio_EmptyGsxbInterrupt
-	notw	_SDL_MintAudio_mutex
-	
-	/* Swap buffers */
-	eorw	#1,_SDL_MintAudio_numbuf
-
-	moveml	d0-d7/a0-a6,sp@-
-
-	/* Callback */
-	jsr	_SDL_MintAudio_Callback
-
-	/* Set new buffer */
-
-	moveq	#0,d0
-	movel	_SDL_MintAudio_audiosize,d1
-
-	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@-
-	clrw	sp@-
-	movew	#131,sp@-
-	trap	#14
-	lea	sp@(12),sp
-
-	moveml	sp@+,d0-d7/a0-a6
-
-	clrw	_SDL_MintAudio_mutex
-_SDL_MintAudio_EmptyGsxbInterrupt:
-	rts
-
 /*--- Xbios interrupt vector to measure Falcon external clock ---*/
 
 _SDL_MintAudio_XbiosInterruptMeasureClock:          /* 1 mS */