grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / AHI / Device / dspechofuncs_68k.s
blob78ace0621fd4a4dae3924d8107beac4001186222
1 /*
2 AHI - Hardware independent audio subsystem
3 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
18 MA 02139, USA.
21 .global _EchoMono16
22 .type _EchoMono16,@func
23 .global _EchoStereo16
24 .type _EchoStereo16,@func
25 .global _EchoMono32
26 .type _EchoMono32,@func
27 .global _EchoStereo32
28 .type _EchoStereo32,@func
29 .global _EchoMulti32
30 .type _EchoMulti32,@func
33 .set ahiecho_Delay, 0
34 .set ahiecho_Code, 4
35 .set ahiecho_FeedbackDS, 8
36 .set ahiecho_FeedbackDO, 12
37 .set ahiecho_FeedbackNS, 16
38 .set ahiecho_FeedbackNO, 20
39 .set ahiecho_MixN, 24
40 .set ahiecho_MixD, 28
41 .set ahiecho_Offset, 32
42 .set ahiecho_SrcPtr, 36
43 .set ahiecho_DstPtr, 40
44 .set ahiecho_EndPtr, 44
45 .set ahiecho_BufferLength, 48
46 .set ahiecho_BufferSize, 52
47 .set ahiecho_Buffer, 56
49 /**
50 *** DSPECHO
51 **/
54 void
55 EchoXX( LONG loops,
56 struct Echo *es,
57 void **buffer,
58 void **srcptr,
59 void **dstptr)
62 .MACRO DSPECHO_PRE
63 movem.l d0-a6,-(sp)
64 move.l 16*4+0(sp),d7
65 move.l 16*4+4(sp),a0
66 move.l 16*4+8(sp),a2
67 move.l (a2),a1
68 move.l 16*4+12(sp),a4
69 move.l (a4),a3
70 move.l 16*4+16(sp),a5
71 move.l (a5),a6
73 subq.l #1,d7
74 bmi 2f
75 .ENDM
79 .MACRO DSPECHO_POST
81 move.l a1,(a2)
82 move.l a3,(a4)
83 move.l a6,(a5)
84 movem.l (sp)+,d0-a6
85 rts
86 .ENDM
89 _EchoMono16:
90 DSPECHO_PRE
92 /* in:
93 * a0 struct Echo*
94 * a1 & x[n]
95 * a3 & d[n-N]
96 * a6 & d[n]
100 move.w (a1),d0 /* Get sample x[n] */
101 ext.l d0
102 move.l d0,d1
103 muls.l ahiecho_MixN(a0),d0
104 move.w (a3)+,d3 /* Get delayed sample d[n-N] */
105 ext.l d3
106 move.l d3,d2
107 muls.l ahiecho_MixD(a0),d3
108 add.l d0,d3
109 swap.w d3
110 move.w d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
112 addq.l #1,d2 /* Fix for -1 */
113 muls.l ahiecho_FeedbackDS(a0),d2 /* d2=FeedbackDS*d[n-N] */
115 muls.l ahiecho_FeedbackNS(a0),d1
116 add.l d1,d2 /* d2=...+FeedbackNS*x[n] */
117 swap.w d2
119 move.w d2,(a6)+ /* store d2 */
120 dbf d7,1b
121 DSPECHO_POST
124 _EchoStereo16:
125 DSPECHO_PRE
127 /* in:
128 * a0 struct Echo*
129 * a1 & x[n]
130 * a3 & d[n-N]
131 * a6 & d[n]
135 move.w (a1),d0 /* Get left sample x[n] */
136 ext.l d0
137 move.l d0,d1
138 muls.l ahiecho_MixN(a0),d0
139 move.w (a3)+,d3 /* Get left delayed sample d[n-N]*/
140 ext.l d3
141 move.l d3,d2
142 muls.l ahiecho_MixD(a0),d3
143 add.l d0,d3
144 swap.w d3
145 move.w d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
147 move.w (a1),d0 /* Get right sample x[n] */
148 ext.l d0
149 move.l d0,d4
150 muls.l ahiecho_MixN(a0),d0
151 move.w (a3)+,d3 /*Get right delayed sample d[n-N]*/
152 ext.l d3
153 move.l d3,d5
154 muls.l ahiecho_MixD(a0),d3
155 add.l d0,d3
156 swap.w d3
157 move.w d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
159 addq.l #1,d2 /* Fix for -1 */
160 move.l d2,d0
161 muls.l ahiecho_FeedbackDS(a0),d2 /* d2=FeedbackDS*d[n-N] (left) */
162 muls.l ahiecho_FeedbackDO(a0),d0
164 addq.l #1,d5 /* Fix for -1 */
165 move.l d5,d3
166 muls.l ahiecho_FeedbackDS(a0),d5 /* d5=FeedbackDS*d[n-N] (right) */
167 muls.l ahiecho_FeedbackDO(a0),d3
169 add.l d3,d2 /* d2=...+FeedbackDO*d[n-N] */
170 add.l d0,d5 /* d5=...+FeedbackDO*d[n-N] */
172 move.l d1,d0
173 muls.l ahiecho_FeedbackNS(a0),d0
174 add.l d0,d2 /* d2=...+FeedbackNS*x[n] */
175 muls.l ahiecho_FeedbackNO(a0),d1
176 add.l d1,d5 /* d5=...+FeedbackNO*x[n] */
178 move.l d4,d0
179 muls.l ahiecho_FeedbackNO(a0),d0
180 add.l d0,d2 /* d2=...+FeedbackNO*x[n] */
181 muls.l ahiecho_FeedbackNS(a0),d4
182 add.l d4,d5 /* d5=...+FeedbackNS*x[n] */
184 swap.w d5
185 move.w d5,d2
186 move.l d2,(a6)+ /* store d2 and d5 */
187 dbf d7,1b
188 DSPECHO_POST
191 _EchoMono32:
192 DSPECHO_PRE
194 /* in:
195 * a0 struct Echo*
196 * a1 & x[n]
197 * a3 & d[n-N]
198 * a6 & d[n]
201 /** The delay buffer is only 16 bit, and only the upper word of the 32 bit
202 *** input data is used! */
205 move.w (a1),d0 /* Get sample x[n] (high word) */
206 ext.l d0
207 move.l d0,d1
208 muls.l ahiecho_MixN(a0),d0
209 move.w (a3)+,d3 /* Get delayed sample d[n-N] */
210 ext.l d3
211 move.l d3,d2
212 muls.l ahiecho_MixD(a0),d3
213 add.l d0,d3
214 move.l d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
216 addq.l #1,d2 /* Fix for -1 */
217 muls.l ahiecho_FeedbackDS(a0),d2 /* d2=FeedbackDS*d[n-N] */
219 muls.l ahiecho_FeedbackNS(a0),d1
220 add.l d1,d2 /* d2=...+FeedbackNS*x[n] */
222 swap.w d2
223 move.w d2,(a6)+ /* store d2 */
224 dbf d7,1b
225 DSPECHO_POST
228 _EchoStereo32:
229 DSPECHO_PRE
231 /* in:
232 * a0 struct Echo*
233 * a1 & x[n]
234 * a3 & d[n-N]
235 * a6 & d[n]
238 /** The delay buffer is only 16 bit, and only the upper word of the 32 bit
239 *** input data is used! */
242 move.w (a1),d0 /*Get left sample x[n] (high word)*/
243 ext.l d0
244 move.l d0,d1
245 muls.l ahiecho_MixN(a0),d0
246 move.w (a3)+,d3 /* Get left delayed sample d[n-N]*/
247 ext.l d3
248 move.l d3,d2
249 muls.l ahiecho_MixD(a0),d3
250 add.l d0,d3
251 move.l d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
253 move.w (a1),d0 /* Get right sample x[n] (high word) */
254 ext.l d0
255 move.l d0,d4
256 muls.l ahiecho_MixN(a0),d0
257 move.w (a3)+,d3 /*Get right delayed sample d[n-N]*/
258 ext.l d3
259 move.l d3,d5
260 muls.l ahiecho_MixD(a0),d3
261 add.l d0,d3
262 move.l d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
264 addq.l #1,d2 /* Fix for -1 */
265 move.l d2,d0
266 muls.l ahiecho_FeedbackDS(a0),d2 /* d2=FeedbackDS*d[n-N] (left) */
267 muls.l ahiecho_FeedbackDO(a0),d0
269 addq.l #1,d5 /* Fix for -1 */
270 move.l d5,d3
271 muls.l ahiecho_FeedbackDS(a0),d5 /* d5=FeedbackDS*d[n-N] (right) */
272 muls.l ahiecho_FeedbackDO(a0),d3
274 add.l d3,d2 /* d2=...+FeedbackDO*d[n-N] */
275 add.l d0,d5 /* d5=...+FeedbackDO*d[n-N] */
277 move.l d1,d0
278 muls.l ahiecho_FeedbackNS(a0),d0
279 add.l d0,d2 /* d2=...+FeedbackNS*x[n] */
280 muls.l ahiecho_FeedbackNO(a0),d1
281 add.l d1,d5 /* d5=...+FeedbackNO*x[n] */
283 move.l d4,d0
284 muls.l ahiecho_FeedbackNO(a0),d0
285 add.l d0,d2 /* d2=...+FeedbackNO*x[n] */
286 muls.l ahiecho_FeedbackNS(a0),d4
287 add.l d4,d5 /* d5=...+FeedbackNS*x[n] */
289 swap.w d5
290 move.w d5,d2
291 move.l d2,(a6)+ /* store d1 and d4 */
292 dbf d7,1b
293 DSPECHO_POST
296 _EchoMulti32:
297 DSPECHO_PRE
299 /* in:
300 * a0 struct Echo*
301 * a1 & x[n]
302 * a3 & d[n-N]
303 * a6 & d[n]
306 /** The delay buffer is only 16 bit, and only the upper word of the 32 bit
307 *** input data is used! */
310 move.w (a1),d0 /*Get left sample x[n] (high word)*/
311 ext.l d0
312 move.l d0,d1
313 muls.l ahiecho_MixN(a0),d0
314 move.w (a3)+,d3 /* Get left delayed sample d[n-N]*/
315 ext.l d3
316 move.l d3,d2
317 muls.l ahiecho_MixD(a0),d3
318 add.l d0,d3
319 move.l d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
321 move.w (a1),d0 /* Get right sample x[n] (high word) */
322 ext.l d0
323 move.l d0,d4
324 muls.l ahiecho_MixN(a0),d0
325 move.w (a3)+,d3 /*Get right delayed sample d[n-N]*/
326 ext.l d3
327 move.l d3,d5
328 muls.l ahiecho_MixD(a0),d3
329 add.l d0,d3
330 move.l d3,(a1)+ /* x[n]=MixN*x[n]+MixD*d[n-N] */
332 addq.l #1,d2 /* Fix for -1 */
333 move.l d2,d0
334 muls.l ahiecho_FeedbackDS(a0),d2 /* d2=FeedbackDS*d[n-N] (left) */
335 muls.l ahiecho_FeedbackDO(a0),d0
337 addq.l #1,d5 /* Fix for -1 */
338 move.l d5,d3
339 muls.l ahiecho_FeedbackDS(a0),d5 /* d5=FeedbackDS*d[n-N] (right) */
340 muls.l ahiecho_FeedbackDO(a0),d3
342 add.l d3,d2 /* d2=...+FeedbackDO*d[n-N] */
343 add.l d0,d5 /* d5=...+FeedbackDO*d[n-N] */
345 move.l d1,d0
346 muls.l ahiecho_FeedbackNS(a0),d0
347 add.l d0,d2 /* d2=...+FeedbackNS*x[n] */
348 muls.l ahiecho_FeedbackNO(a0),d1
349 add.l d1,d5 /* d5=...+FeedbackNO*x[n] */
351 move.l d4,d0
352 muls.l ahiecho_FeedbackNO(a0),d0
353 add.l d0,d2 /* d2=...+FeedbackNO*x[n] */
354 muls.l ahiecho_FeedbackNS(a0),d4
355 add.l d4,d5 /* d5=...+FeedbackNS*x[n] */
357 swap.w d5
358 move.w d5,d2
359 move.l d2,(a6)+ /* store d1 and d4 */
361 add.w #6*4,a1
362 add.w #6*2,a3
363 add.w #6*2,a6
365 dbf d7,1b
366 DSPECHO_POST
368 .end