Move GSXB callback to C source
authorPatrice Mandin <patmandin@gmail.com>
Wed, 20 Jul 2005 17:44:11 +0000
changeset 1097c83fa1c650dd
parent 1096 37b766becf3b
child 1098 2911ff0a32bb
Move GSXB callback to C source
src/audio/mint/SDL_mintaudio_gsxb.c
src/audio/mint/SDL_mintaudio_it.S
     1.1 --- a/src/audio/mint/SDL_mintaudio_gsxb.c	Wed Jul 20 17:40:58 2005 +0000
     1.2 +++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Wed Jul 20 17:44:11 2005 +0000
     1.3 @@ -77,6 +77,10 @@
     1.4  static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
     1.5  static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
     1.6  
     1.7 +/* GSXB callbacks */
     1.8 +static void Mint_GsxbInterrupt(void);
     1.9 +static void Mint_GsxbNullInterrupt(void);
    1.10 +
    1.11  /*--- Audio driver bootstrap functions ---*/
    1.12  
    1.13  static int Audio_Available(void)
    1.14 @@ -180,7 +184,7 @@
    1.15  	Buffoper(0);
    1.16  
    1.17  	/* Uninstall interrupt */
    1.18 -	if (NSetinterrupt(2, SI_NONE, SDL_MintAudio_EmptyGsxbInterrupt)<0) {
    1.19 +	if (NSetinterrupt(2, SI_NONE, Mint_GsxbNullInterrupt)<0) {
    1.20  		DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n"));
    1.21  	}
    1.22  
    1.23 @@ -342,7 +346,7 @@
    1.24  	}
    1.25  	
    1.26  	/* Install interrupt */
    1.27 -	if (NSetinterrupt(2, SI_PLAY, SDL_MintAudio_GsxbInterrupt)<0) {
    1.28 +	if (NSetinterrupt(2, SI_PLAY, Mint_GsxbInterrupt)<0) {
    1.29  		DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n"));
    1.30  	}
    1.31  
    1.32 @@ -390,3 +394,24 @@
    1.33  
    1.34      return(1);	/* We don't use threaded audio */
    1.35  }
    1.36 +
    1.37 +static void Mint_GsxbInterrupt(void)
    1.38 +{
    1.39 +	Uint8 *newbuf;
    1.40 +
    1.41 +	if (SDL_MintAudio_mutex)
    1.42 +		return;
    1.43 +
    1.44 +	SDL_MintAudio_mutex=1;
    1.45 +
    1.46 +	SDL_MintAudio_numbuf ^= 1;
    1.47 +	SDL_MintAudio_Callback();
    1.48 +	newbuf = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
    1.49 +	Setbuffer(0, newbuf, newbuf + SDL_MintAudio_audiosize);
    1.50 +
    1.51 +	SDL_MintAudio_mutex=0;
    1.52 +}
    1.53 +
    1.54 +static void Mint_GsxbNullInterrupt(void)
    1.55 +{
    1.56 +}
     2.1 --- a/src/audio/mint/SDL_mintaudio_it.S	Wed Jul 20 17:40:58 2005 +0000
     2.2 +++ b/src/audio/mint/SDL_mintaudio_it.S	Wed Jul 20 17:44:11 2005 +0000
     2.3 @@ -30,8 +30,6 @@
     2.4  
     2.5  	.globl	_SDL_MintAudio_Callback
     2.6  
     2.7 -	.globl	_SDL_MintAudio_GsxbInterrupt
     2.8 -	.globl	_SDL_MintAudio_EmptyGsxbInterrupt
     2.9  	.globl	_SDL_MintAudio_XbiosInterrupt
    2.10  	.globl	_SDL_MintAudio_XbiosInterruptMeasureClock
    2.11  	.globl	_SDL_MintAudio_Dma8Interrupt
    2.12 @@ -56,49 +54,6 @@
    2.13  #define	savptr	0x4a2
    2.14  #define	savamt	0x46
    2.15  
    2.16 -/*--- GSXB interrupt vector ---*/
    2.17 -
    2.18 -	.text
    2.19 -_SDL_MintAudio_GsxbInterrupt:
    2.20 -
    2.21 -	/* Check if we are not already running */
    2.22 -	tstw	_SDL_MintAudio_mutex
    2.23 -	bnes	_SDL_MintAudio_EmptyGsxbInterrupt
    2.24 -	notw	_SDL_MintAudio_mutex
    2.25 -	
    2.26 -	/* Swap buffers */
    2.27 -	eorw	#1,_SDL_MintAudio_numbuf
    2.28 -
    2.29 -	moveml	d0-d7/a0-a6,sp@-
    2.30 -
    2.31 -	/* Callback */
    2.32 -	jsr	_SDL_MintAudio_Callback
    2.33 -
    2.34 -	/* Set new buffer */
    2.35 -
    2.36 -	moveq	#0,d0
    2.37 -	movel	_SDL_MintAudio_audiosize,d1
    2.38 -
    2.39 -	movew	_SDL_MintAudio_numbuf,d0
    2.40 -	lsll	#2,d0
    2.41 -	lea	_SDL_MintAudio_audiobuf,a0
    2.42 -	movel	a0@(d0:l),a1
    2.43 -
    2.44 -	lea	a1@(d1:l),a2
    2.45 -
    2.46 -	movel	a2,sp@-
    2.47 -	movel	a1,sp@-
    2.48 -	clrw	sp@-
    2.49 -	movew	#131,sp@-
    2.50 -	trap	#14
    2.51 -	lea	sp@(12),sp
    2.52 -
    2.53 -	moveml	sp@+,d0-d7/a0-a6
    2.54 -
    2.55 -	clrw	_SDL_MintAudio_mutex
    2.56 -_SDL_MintAudio_EmptyGsxbInterrupt:
    2.57 -	rts
    2.58 -
    2.59  /*--- Xbios interrupt vector to measure Falcon external clock ---*/
    2.60  
    2.61  _SDL_MintAudio_XbiosInterruptMeasureClock:          /* 1 mS */