src/audio/SDL_mixer_m68k.c
branchSDL-1.3
changeset 1662 782fd950bd46
parent 1402 d910939febfa
child 1668 4da1ee79c9af
     1.1 --- a/src/audio/SDL_mixer_m68k.c	Sun May 21 17:27:13 2006 +0000
     1.2 +++ b/src/audio/SDL_mixer_m68k.c	Sun May 28 13:04:16 2006 +0000
     1.3 @@ -28,184 +28,113 @@
     1.4  */
     1.5  
     1.6  #if defined(__M68000__) && defined(__GNUC__)
     1.7 -void SDL_MixAudio_m68k_U8(char* dst, char* src, long len, long volume, char* mix8)
     1.8 +void
     1.9 +SDL_MixAudio_m68k_U8 (char *dst, char *src, long len, long volume, char *mix8)
    1.10  {
    1.11 -    __asm__ __volatile__ (
    1.12 -
    1.13 -	"tstl	%2\n"
    1.14 -"	beqs	stoploop_u8\n"
    1.15 -"mixloop_u8:\n"
    1.16 -
    1.17 -	/* Mix a sample */
    1.18 -
    1.19 -"	moveq	#0,%%d0\n"
    1.20 -"	moveq	#0,%%d1\n"
    1.21 -
    1.22 -"	moveb	%1@+,%%d0\n"	/* d0 = *src++ */
    1.23 -"	sub	#128,%%d0\n"	/* d0 -= 128 */
    1.24 -"	muls	%3,%%d0\n"	/* d0 *= volume (0<=volume<=128) */
    1.25 -"	moveb	%0@,%%d1\n"	/* d1 = *dst */
    1.26 -"	asr	#7,%%d0\n"	/* d0 /= 128 (SDL_MIX_MAXVOLUME) */
    1.27 -"	add	#128,%%d0\n"	/* d0 += 128 */
    1.28 -
    1.29 -"	add	%%d1,%%d0\n"
    1.30 -
    1.31 -"	moveb	%4@(%%d0:w),%0@+\n"
    1.32 -
    1.33 -	/* Loop till done */
    1.34 -
    1.35 -"	subql	#1,%2\n"
    1.36 -"	bhis	mixloop_u8\n"
    1.37 -"stoploop_u8:\n"
    1.38 -
    1.39 -	 : /* no return value */
    1.40 -	 : /* input */
    1.41 -	 	"a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8)	
    1.42 -	 : /* clobbered registers */
    1.43 -	 	"d0", "d1", "cc", "memory" 
    1.44 -	 );
    1.45 +    __asm__ __volatile__ ("tstl	%2\n" "	beqs	stoploop_u8\n" "mixloop_u8:\n"
    1.46 +                          /* Mix a sample */
    1.47 +                          "	moveq	#0,%%d0\n" "	moveq	#0,%%d1\n" "	moveb	%1@+,%%d0\n"    /* d0 = *src++ */
    1.48 +                          "	sub	#128,%%d0\n"    /* d0 -= 128 */
    1.49 +                          "	muls	%3,%%d0\n"      /* d0 *= volume (0<=volume<=128) */
    1.50 +                          "	moveb	%0@,%%d1\n"     /* d1 = *dst */
    1.51 +                          "	asr	#7,%%d0\n"      /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
    1.52 +                          "	add	#128,%%d0\n"    /* d0 += 128 */
    1.53 +                          "	add	%%d1,%%d0\n"
    1.54 +                          "	moveb	%4@(%%d0:w),%0@+\n"
    1.55 +                          /* Loop till done */
    1.56 +                          "	subql	#1,%2\n" "	bhis	mixloop_u8\n" "stoploop_u8:\n": /* no return value */
    1.57 +                          :     /* input */
    1.58 +                          "a" (dst), "a" (src), "d" (len), "d" (volume), "a" (mix8):    /* clobbered registers */
    1.59 +                          "d0", "d1", "cc", "memory");
    1.60  }
    1.61  
    1.62 -void SDL_MixAudio_m68k_S8(char* dst, char* src, long len, long volume)
    1.63 +void
    1.64 +SDL_MixAudio_m68k_S8 (char *dst, char *src, long len, long volume)
    1.65  {
    1.66 -    __asm__ __volatile__ (
    1.67 -
    1.68 -	"tstl	%2\n"
    1.69 -"	beqs	stoploop_s8\n"
    1.70 -"	moveq	#-128,%%d2\n"
    1.71 -"	moveq	#127,%%d3\n"
    1.72 -"mixloop_s8:\n"
    1.73 -
    1.74 -	/* Mix a sample */
    1.75 -
    1.76 -"	moveq	#0,%%d0\n"
    1.77 -"	moveq	#0,%%d1\n"
    1.78 -
    1.79 -"	moveb	%1@+,%%d0\n"	/* d0 = *src++ */
    1.80 -"	muls	%3,%%d0\n"	/* d0 *= volume (0<=volume<=128) */
    1.81 -"	moveb	%0@,%%d1\n"	/* d1 = *dst */
    1.82 -"	asr	#7,%%d0\n"	/* d0 /= 128 (SDL_MIX_MAXVOLUME) */
    1.83 -
    1.84 -"	add	%%d1,%%d0\n"
    1.85 -
    1.86 -"	cmp	%%d2,%%d0\n"
    1.87 -"	bges	lower_limit_s8\n"
    1.88 -"	move	%%d2,%%d0\n"
    1.89 -"lower_limit_s8:\n"
    1.90 -
    1.91 -"	cmp	%%d3,%%d0\n"
    1.92 -"	bles	upper_limit_s8\n"
    1.93 -"	move	%%d3,%%d0\n"
    1.94 -"upper_limit_s8:\n"
    1.95 -"	moveb	%%d0,%0@+\n"
    1.96 -
    1.97 -	/* Loop till done */
    1.98 -
    1.99 -"	subql	#1,%2\n"
   1.100 -"	bhis	mixloop_s8\n"
   1.101 -"stoploop_s8:\n"
   1.102 -
   1.103 -	 : /* no return value */
   1.104 -	 : /* input */
   1.105 -	 	"a"(dst), "a"(src), "d"(len), "d"(volume)	
   1.106 -	 : /* clobbered registers */
   1.107 -	 	"d0", "d1", "d2", "d3", "cc", "memory" 
   1.108 -	 );
   1.109 +    __asm__ __volatile__ ("tstl	%2\n"
   1.110 +                          "	beqs	stoploop_s8\n"
   1.111 +                          "	moveq	#-128,%%d2\n"
   1.112 +                          "	moveq	#127,%%d3\n" "mixloop_s8:\n"
   1.113 +                          /* Mix a sample */
   1.114 +                          "	moveq	#0,%%d0\n" "	moveq	#0,%%d1\n" "	moveb	%1@+,%%d0\n"    /* d0 = *src++ */
   1.115 +                          "	muls	%3,%%d0\n"      /* d0 *= volume (0<=volume<=128) */
   1.116 +                          "	moveb	%0@,%%d1\n"     /* d1 = *dst */
   1.117 +                          "	asr	#7,%%d0\n"      /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
   1.118 +                          "	add	%%d1,%%d0\n"
   1.119 +                          "	cmp	%%d2,%%d0\n"
   1.120 +                          "	bges	lower_limit_s8\n"
   1.121 +                          "	move	%%d2,%%d0\n"
   1.122 +                          "lower_limit_s8:\n"
   1.123 +                          "	cmp	%%d3,%%d0\n"
   1.124 +                          "	bles	upper_limit_s8\n"
   1.125 +                          "	move	%%d3,%%d0\n"
   1.126 +                          "upper_limit_s8:\n" "	moveb	%%d0,%0@+\n"
   1.127 +                          /* Loop till done */
   1.128 +                          "	subql	#1,%2\n" "	bhis	mixloop_s8\n" "stoploop_s8:\n": /* no return value */
   1.129 +                          :     /* input */
   1.130 +                          "a" (dst), "a" (src), "d" (len), "d" (volume):        /* clobbered registers */
   1.131 +                          "d0", "d1", "d2", "d3", "cc", "memory");
   1.132  }
   1.133  
   1.134 -void SDL_MixAudio_m68k_S16MSB(short* dst, short* src, long len, long volume)
   1.135 +void
   1.136 +SDL_MixAudio_m68k_S16MSB (short *dst, short *src, long len, long volume)
   1.137  {
   1.138 -    __asm__ __volatile__ (
   1.139 -
   1.140 -	"tstl	%2\n"
   1.141 -"	beqs	stoploop_s16msb\n"
   1.142 -"	movel	#-32768,%%d2\n"
   1.143 -"	movel	#32767,%%d3\n"
   1.144 -"	lsrl	#1,%2\n"
   1.145 -"mixloop_s16msb:\n"
   1.146 -
   1.147 -	/* Mix a sample */
   1.148 -
   1.149 -"	move	%1@+,%%d0\n"	/* d0 = *src++ */
   1.150 -"	muls	%3,%%d0\n"	/* d0 *= volume (0<=volume<=128) */
   1.151 -"	move	%0@,%%d1\n"	/* d1 = *dst */
   1.152 -"	extl	%%d1\n"		/* extend d1 to 32 bits */
   1.153 -"	asrl	#7,%%d0\n"	/* d0 /= 128 (SDL_MIX_MAXVOLUME) */
   1.154 -
   1.155 -"	addl	%%d1,%%d0\n"
   1.156 -
   1.157 -"	cmpl	%%d2,%%d0\n"
   1.158 -"	bges	lower_limit_s16msb\n"
   1.159 -"	move	%%d2,%%d0\n"
   1.160 -"lower_limit_s16msb:\n"
   1.161 -
   1.162 -"	cmpl	%%d3,%%d0\n"
   1.163 -"	bles	upper_limit_s16msb\n"
   1.164 -"	move	%%d3,%%d0\n"
   1.165 -"upper_limit_s16msb:\n"
   1.166 -"	move	%%d0,%0@+\n"
   1.167 -
   1.168 -	/* Loop till done */
   1.169 -
   1.170 -"	subql	#1,%2\n"
   1.171 -"	bhis	mixloop_s16msb\n"
   1.172 -"stoploop_s16msb:\n"
   1.173 -
   1.174 -	 : /* no return value */
   1.175 -	 : /* input */
   1.176 -	 	"a"(dst), "a"(src), "d"(len), "d"(volume)	
   1.177 -	 : /* clobbered registers */
   1.178 -	 	"d0", "d1", "d2", "d3", "cc", "memory" 
   1.179 -	 );
   1.180 +    __asm__ __volatile__ ("tstl	%2\n"
   1.181 +                          "	beqs	stoploop_s16msb\n"
   1.182 +                          "	movel	#-32768,%%d2\n"
   1.183 +                          "	movel	#32767,%%d3\n"
   1.184 +                          "	lsrl	#1,%2\n" "mixloop_s16msb:\n"
   1.185 +                          /* Mix a sample */
   1.186 +                          "	move	%1@+,%%d0\n"    /* d0 = *src++ */
   1.187 +                          "	muls	%3,%%d0\n"      /* d0 *= volume (0<=volume<=128) */
   1.188 +                          "	move	%0@,%%d1\n"     /* d1 = *dst */
   1.189 +                          "	extl	%%d1\n" /* extend d1 to 32 bits */
   1.190 +                          "	asrl	#7,%%d0\n"      /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
   1.191 +                          "	addl	%%d1,%%d0\n"
   1.192 +                          "	cmpl	%%d2,%%d0\n"
   1.193 +                          "	bges	lower_limit_s16msb\n"
   1.194 +                          "	move	%%d2,%%d0\n"
   1.195 +                          "lower_limit_s16msb:\n"
   1.196 +                          "	cmpl	%%d3,%%d0\n"
   1.197 +                          "	bles	upper_limit_s16msb\n"
   1.198 +                          "	move	%%d3,%%d0\n"
   1.199 +                          "upper_limit_s16msb:\n" "	move	%%d0,%0@+\n"
   1.200 +                          /* Loop till done */
   1.201 +                          "	subql	#1,%2\n" "	bhis	mixloop_s16msb\n" "stoploop_s16msb:\n": /* no return value */
   1.202 +                          :     /* input */
   1.203 +                          "a" (dst), "a" (src), "d" (len), "d" (volume):        /* clobbered registers */
   1.204 +                          "d0", "d1", "d2", "d3", "cc", "memory");
   1.205  }
   1.206  
   1.207 -void SDL_MixAudio_m68k_S16LSB(short* dst, short* src, long len, long volume)
   1.208 +void
   1.209 +SDL_MixAudio_m68k_S16LSB (short *dst, short *src, long len, long volume)
   1.210  {
   1.211 -    __asm__ __volatile__ (
   1.212 -
   1.213 -	"tstl	%2\n"
   1.214 -"	beqs	stoploop_s16lsb\n"
   1.215 -"	movel	#-32768,%%d2\n"
   1.216 -"	movel	#32767,%%d3\n"
   1.217 -"	lsrl	#1,%2\n"
   1.218 -"mixloop_s16lsb:\n"
   1.219 -
   1.220 -	/* Mix a sample */
   1.221 -
   1.222 -"	move	%1@+,%%d0\n"	/* d0 = *src++ */
   1.223 -"	rorw	#8,%%d0\n"
   1.224 -"	muls	%3,%%d0\n"	/* d0 *= volume (0<=volume<=128) */
   1.225 -"	move	%0@,%%d1\n"	/* d1 = *dst */
   1.226 -"	rorw	#8,%%d1\n"
   1.227 -"	extl	%%d1\n"		/* extend d1 to 32 bits */
   1.228 -"	asrl	#7,%%d0\n"	/* d0 /= 128 (SDL_MIX_MAXVOLUME) */
   1.229 -
   1.230 -"	addl	%%d1,%%d0\n"
   1.231 -
   1.232 -"	cmpl	%%d2,%%d0\n"
   1.233 -"	bges	lower_limit_s16lsb\n"
   1.234 -"	move	%%d2,%%d0\n"
   1.235 -"lower_limit_s16lsb:\n"
   1.236 -
   1.237 -"	cmpl	%%d3,%%d0\n"
   1.238 -"	bles	upper_limit_s16lsb\n"
   1.239 -"	move	%%d3,%%d0\n"
   1.240 -"upper_limit_s16lsb:\n"
   1.241 -"	rorw	#8,%%d0\n"
   1.242 -"	move	%%d0,%0@+\n"
   1.243 -
   1.244 -	/* Loop till done */
   1.245 -
   1.246 -"	subql	#1,%2\n"
   1.247 -"	bhis	mixloop_s16lsb\n"
   1.248 -"stoploop_s16lsb:\n"
   1.249 -
   1.250 -	 : /* no return value */
   1.251 -	 : /* input */
   1.252 -	 	"a"(dst), "a"(src), "d"(len), "d"(volume)	
   1.253 -	 : /* clobbered registers */
   1.254 -	 	"d0", "d1", "d2", "d3", "cc", "memory" 
   1.255 -	 );
   1.256 +    __asm__ __volatile__ ("tstl	%2\n"
   1.257 +                          "	beqs	stoploop_s16lsb\n"
   1.258 +                          "	movel	#-32768,%%d2\n"
   1.259 +                          "	movel	#32767,%%d3\n"
   1.260 +                          "	lsrl	#1,%2\n" "mixloop_s16lsb:\n"
   1.261 +                          /* Mix a sample */
   1.262 +                          "	move	%1@+,%%d0\n"    /* d0 = *src++ */
   1.263 +                          "	rorw	#8,%%d0\n" "	muls	%3,%%d0\n"      /* d0 *= volume (0<=volume<=128) */
   1.264 +                          "	move	%0@,%%d1\n"     /* d1 = *dst */
   1.265 +                          "	rorw	#8,%%d1\n" "	extl	%%d1\n" /* extend d1 to 32 bits */
   1.266 +                          "	asrl	#7,%%d0\n"      /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
   1.267 +                          "	addl	%%d1,%%d0\n"
   1.268 +                          "	cmpl	%%d2,%%d0\n"
   1.269 +                          "	bges	lower_limit_s16lsb\n"
   1.270 +                          "	move	%%d2,%%d0\n"
   1.271 +                          "lower_limit_s16lsb:\n"
   1.272 +                          "	cmpl	%%d3,%%d0\n"
   1.273 +                          "	bles	upper_limit_s16lsb\n"
   1.274 +                          "	move	%%d3,%%d0\n"
   1.275 +                          "upper_limit_s16lsb:\n"
   1.276 +                          "	rorw	#8,%%d0\n" "	move	%%d0,%0@+\n"
   1.277 +                          /* Loop till done */
   1.278 +                          "	subql	#1,%2\n" "	bhis	mixloop_s16lsb\n" "stoploop_s16lsb:\n": /* no return value */
   1.279 +                          :     /* input */
   1.280 +                          "a" (dst), "a" (src), "d" (len), "d" (volume):        /* clobbered registers */
   1.281 +                          "d0", "d1", "d2", "d3", "cc", "memory");
   1.282  }
   1.283  #endif
   1.284 -
   1.285 +/* vi: set ts=4 sw=4 expandtab: */