comparison src/audio/SDL_mixer_m68k.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents d910939febfa
children 99210400e8b9
comparison
equal deleted inserted replaced
1894:c69cee13dd76 1895:c121d94672cb
26 26
27 Patrice Mandin 27 Patrice Mandin
28 */ 28 */
29 29
30 #if defined(__M68000__) && defined(__GNUC__) 30 #if defined(__M68000__) && defined(__GNUC__)
31 void SDL_MixAudio_m68k_U8(char* dst, char* src, long len, long volume, char* mix8) 31 void
32 SDL_MixAudio_m68k_U8(char *dst, char *src, long len, long volume, char *mix8)
32 { 33 {
33 __asm__ __volatile__ ( 34 __asm__ __volatile__("tstl %2\n" " beqs stoploop_u8\n" "mixloop_u8:\n"
34 35 /* Mix a sample */
35 "tstl %2\n" 36 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
36 " beqs stoploop_u8\n" 37 " sub #128,%%d0\n" /* d0 -= 128 */
37 "mixloop_u8:\n" 38 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
38 39 " moveb %0@,%%d1\n" /* d1 = *dst */
39 /* Mix a sample */ 40 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
40 41 " add #128,%%d0\n" /* d0 += 128 */
41 " moveq #0,%%d0\n" 42 " add %%d1,%%d0\n"
42 " moveq #0,%%d1\n" 43 " moveb %4@(%%d0:w),%0@+\n"
43 44 /* Loop till done */
44 " moveb %1@+,%%d0\n" /* d0 = *src++ */ 45 " subql #1,%2\n" " bhis mixloop_u8\n" "stoploop_u8:\n": /* no return value */
45 " sub #128,%%d0\n" /* d0 -= 128 */ 46 : /* input */
46 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 47 "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8): /* clobbered registers */
47 " moveb %0@,%%d1\n" /* d1 = *dst */ 48 "d0", "d1", "cc", "memory");
48 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
49 " add #128,%%d0\n" /* d0 += 128 */
50
51 " add %%d1,%%d0\n"
52
53 " moveb %4@(%%d0:w),%0@+\n"
54
55 /* Loop till done */
56
57 " subql #1,%2\n"
58 " bhis mixloop_u8\n"
59 "stoploop_u8:\n"
60
61 : /* no return value */
62 : /* input */
63 "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8)
64 : /* clobbered registers */
65 "d0", "d1", "cc", "memory"
66 );
67 } 49 }
68 50
69 void SDL_MixAudio_m68k_S8(char* dst, char* src, long len, long volume) 51 void
52 SDL_MixAudio_m68k_S8(char *dst, char *src, long len, long volume)
70 { 53 {
71 __asm__ __volatile__ ( 54 __asm__ __volatile__("tstl %2\n"
72 55 " beqs stoploop_s8\n"
73 "tstl %2\n" 56 " moveq #-128,%%d2\n"
74 " beqs stoploop_s8\n" 57 " moveq #127,%%d3\n" "mixloop_s8:\n"
75 " moveq #-128,%%d2\n" 58 /* Mix a sample */
76 " moveq #127,%%d3\n" 59 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
77 "mixloop_s8:\n" 60 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
78 61 " moveb %0@,%%d1\n" /* d1 = *dst */
79 /* Mix a sample */ 62 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
80 63 " add %%d1,%%d0\n"
81 " moveq #0,%%d0\n" 64 " cmp %%d2,%%d0\n"
82 " moveq #0,%%d1\n" 65 " bges lower_limit_s8\n"
83 66 " move %%d2,%%d0\n"
84 " moveb %1@+,%%d0\n" /* d0 = *src++ */ 67 "lower_limit_s8:\n"
85 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 68 " cmp %%d3,%%d0\n"
86 " moveb %0@,%%d1\n" /* d1 = *dst */ 69 " bles upper_limit_s8\n"
87 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 70 " move %%d3,%%d0\n"
88 71 "upper_limit_s8:\n" " moveb %%d0,%0@+\n"
89 " add %%d1,%%d0\n" 72 /* Loop till done */
90 73 " subql #1,%2\n" " bhis mixloop_s8\n" "stoploop_s8:\n": /* no return value */
91 " cmp %%d2,%%d0\n" 74 : /* input */
92 " bges lower_limit_s8\n" 75 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
93 " move %%d2,%%d0\n" 76 "d0", "d1", "d2", "d3", "cc", "memory");
94 "lower_limit_s8:\n"
95
96 " cmp %%d3,%%d0\n"
97 " bles upper_limit_s8\n"
98 " move %%d3,%%d0\n"
99 "upper_limit_s8:\n"
100 " moveb %%d0,%0@+\n"
101
102 /* Loop till done */
103
104 " subql #1,%2\n"
105 " bhis mixloop_s8\n"
106 "stoploop_s8:\n"
107
108 : /* no return value */
109 : /* input */
110 "a"(dst), "a"(src), "d"(len), "d"(volume)
111 : /* clobbered registers */
112 "d0", "d1", "d2", "d3", "cc", "memory"
113 );
114 } 77 }
115 78
116 void SDL_MixAudio_m68k_S16MSB(short* dst, short* src, long len, long volume) 79 void
80 SDL_MixAudio_m68k_S16MSB(short *dst, short *src, long len, long volume)
117 { 81 {
118 __asm__ __volatile__ ( 82 __asm__ __volatile__("tstl %2\n"
119 83 " beqs stoploop_s16msb\n"
120 "tstl %2\n" 84 " movel #-32768,%%d2\n"
121 " beqs stoploop_s16msb\n" 85 " movel #32767,%%d3\n"
122 " movel #-32768,%%d2\n" 86 " lsrl #1,%2\n" "mixloop_s16msb:\n"
123 " movel #32767,%%d3\n" 87 /* Mix a sample */
124 " lsrl #1,%2\n" 88 " move %1@+,%%d0\n" /* d0 = *src++ */
125 "mixloop_s16msb:\n" 89 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
126 90 " move %0@,%%d1\n" /* d1 = *dst */
127 /* Mix a sample */ 91 " extl %%d1\n" /* extend d1 to 32 bits */
128 92 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
129 " move %1@+,%%d0\n" /* d0 = *src++ */ 93 " addl %%d1,%%d0\n"
130 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 94 " cmpl %%d2,%%d0\n"
131 " move %0@,%%d1\n" /* d1 = *dst */ 95 " bges lower_limit_s16msb\n"
132 " extl %%d1\n" /* extend d1 to 32 bits */ 96 " move %%d2,%%d0\n"
133 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 97 "lower_limit_s16msb:\n"
134 98 " cmpl %%d3,%%d0\n"
135 " addl %%d1,%%d0\n" 99 " bles upper_limit_s16msb\n"
136 100 " move %%d3,%%d0\n"
137 " cmpl %%d2,%%d0\n" 101 "upper_limit_s16msb:\n" " move %%d0,%0@+\n"
138 " bges lower_limit_s16msb\n" 102 /* Loop till done */
139 " move %%d2,%%d0\n" 103 " subql #1,%2\n" " bhis mixloop_s16msb\n" "stoploop_s16msb:\n": /* no return value */
140 "lower_limit_s16msb:\n" 104 : /* input */
141 105 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
142 " cmpl %%d3,%%d0\n" 106 "d0", "d1", "d2", "d3", "cc", "memory");
143 " bles upper_limit_s16msb\n"
144 " move %%d3,%%d0\n"
145 "upper_limit_s16msb:\n"
146 " move %%d0,%0@+\n"
147
148 /* Loop till done */
149
150 " subql #1,%2\n"
151 " bhis mixloop_s16msb\n"
152 "stoploop_s16msb:\n"
153
154 : /* no return value */
155 : /* input */
156 "a"(dst), "a"(src), "d"(len), "d"(volume)
157 : /* clobbered registers */
158 "d0", "d1", "d2", "d3", "cc", "memory"
159 );
160 } 107 }
161 108
162 void SDL_MixAudio_m68k_S16LSB(short* dst, short* src, long len, long volume) 109 void
110 SDL_MixAudio_m68k_S16LSB(short *dst, short *src, long len, long volume)
163 { 111 {
164 __asm__ __volatile__ ( 112 __asm__ __volatile__("tstl %2\n"
165 113 " beqs stoploop_s16lsb\n"
166 "tstl %2\n" 114 " movel #-32768,%%d2\n"
167 " beqs stoploop_s16lsb\n" 115 " movel #32767,%%d3\n"
168 " movel #-32768,%%d2\n" 116 " lsrl #1,%2\n" "mixloop_s16lsb:\n"
169 " movel #32767,%%d3\n" 117 /* Mix a sample */
170 " lsrl #1,%2\n" 118 " move %1@+,%%d0\n" /* d0 = *src++ */
171 "mixloop_s16lsb:\n" 119 " rorw #8,%%d0\n" " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
172 120 " move %0@,%%d1\n" /* d1 = *dst */
173 /* Mix a sample */ 121 " rorw #8,%%d1\n" " extl %%d1\n" /* extend d1 to 32 bits */
174 122 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
175 " move %1@+,%%d0\n" /* d0 = *src++ */ 123 " addl %%d1,%%d0\n"
176 " rorw #8,%%d0\n" 124 " cmpl %%d2,%%d0\n"
177 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 125 " bges lower_limit_s16lsb\n"
178 " move %0@,%%d1\n" /* d1 = *dst */ 126 " move %%d2,%%d0\n"
179 " rorw #8,%%d1\n" 127 "lower_limit_s16lsb:\n"
180 " extl %%d1\n" /* extend d1 to 32 bits */ 128 " cmpl %%d3,%%d0\n"
181 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 129 " bles upper_limit_s16lsb\n"
182 130 " move %%d3,%%d0\n"
183 " addl %%d1,%%d0\n" 131 "upper_limit_s16lsb:\n"
184 132 " rorw #8,%%d0\n" " move %%d0,%0@+\n"
185 " cmpl %%d2,%%d0\n" 133 /* Loop till done */
186 " bges lower_limit_s16lsb\n" 134 " subql #1,%2\n" " bhis mixloop_s16lsb\n" "stoploop_s16lsb:\n": /* no return value */
187 " move %%d2,%%d0\n" 135 : /* input */
188 "lower_limit_s16lsb:\n" 136 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
189 137 "d0", "d1", "d2", "d3", "cc", "memory");
190 " cmpl %%d3,%%d0\n"
191 " bles upper_limit_s16lsb\n"
192 " move %%d3,%%d0\n"
193 "upper_limit_s16lsb:\n"
194 " rorw #8,%%d0\n"
195 " move %%d0,%0@+\n"
196
197 /* Loop till done */
198
199 " subql #1,%2\n"
200 " bhis mixloop_s16lsb\n"
201 "stoploop_s16lsb:\n"
202
203 : /* no return value */
204 : /* input */
205 "a"(dst), "a"(src), "d"(len), "d"(volume)
206 : /* clobbered registers */
207 "d0", "d1", "d2", "d3", "cc", "memory"
208 );
209 } 138 }
210 #endif 139 #endif
211 140 /* vi: set ts=4 sw=4 expandtab: */