Mercurial > sdl-ios-xcode
annotate src/audio/SDL_mixer_m68k.c @ 3975:e85e65aec22f SDL-1.2
Added S60 port.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 24 Jun 2007 18:26:35 +0000 |
parents | d910939febfa |
children | 782fd950bd46 c121d94672cb a1b03ba2fcd0 |
rev | line source |
---|---|
633
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
1 /* |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
633
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
633
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
4 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
9 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
13 Library General Public License for more details. |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
14 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
18 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
19 Sam Lantinga |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
20 slouken@libsdl.org |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
22 #include "SDL_config.h" |
633
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
23 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
24 /* |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
25 m68k assembly mix routines |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
26 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
27 Patrice Mandin |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
28 */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
29 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
30 #if defined(__M68000__) && defined(__GNUC__) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
31 void SDL_MixAudio_m68k_U8(char* dst, char* src, long len, long volume, char* mix8) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
32 { |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
33 __asm__ __volatile__ ( |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
34 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
35 "tstl %2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
36 " beqs stoploop_u8\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
37 "mixloop_u8:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
38 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
39 /* Mix a sample */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
40 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
41 " moveq #0,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
42 " moveq #0,%%d1\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
43 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
44 " moveb %1@+,%%d0\n" /* d0 = *src++ */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
45 " sub #128,%%d0\n" /* d0 -= 128 */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
46 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
47 " moveb %0@,%%d1\n" /* d1 = *dst */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
48 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
49 " add #128,%%d0\n" /* d0 += 128 */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
50 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
51 " add %%d1,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
52 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
53 " moveb %4@(%%d0:w),%0@+\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
54 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
55 /* Loop till done */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
56 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
57 " subql #1,%2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
58 " bhis mixloop_u8\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
59 "stoploop_u8:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
60 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
61 : /* no return value */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
62 : /* input */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
63 "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
64 : /* clobbered registers */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
65 "d0", "d1", "cc", "memory" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
66 ); |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
67 } |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
68 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
69 void SDL_MixAudio_m68k_S8(char* dst, char* src, long len, long volume) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
70 { |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
71 __asm__ __volatile__ ( |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
72 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
73 "tstl %2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
74 " beqs stoploop_s8\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
75 " moveq #-128,%%d2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
76 " moveq #127,%%d3\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
77 "mixloop_s8:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
78 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
79 /* Mix a sample */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
80 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
81 " moveq #0,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
82 " moveq #0,%%d1\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
83 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
84 " moveb %1@+,%%d0\n" /* d0 = *src++ */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
85 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
86 " moveb %0@,%%d1\n" /* d1 = *dst */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
87 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
88 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
89 " add %%d1,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
90 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
91 " cmp %%d2,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
92 " bges lower_limit_s8\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
93 " move %%d2,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
94 "lower_limit_s8:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
95 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
96 " cmp %%d3,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
97 " bles upper_limit_s8\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
98 " move %%d3,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
99 "upper_limit_s8:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
100 " moveb %%d0,%0@+\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
101 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
102 /* Loop till done */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
103 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
104 " subql #1,%2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
105 " bhis mixloop_s8\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
106 "stoploop_s8:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
107 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
108 : /* no return value */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
109 : /* input */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
110 "a"(dst), "a"(src), "d"(len), "d"(volume) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
111 : /* clobbered registers */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
112 "d0", "d1", "d2", "d3", "cc", "memory" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
113 ); |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
114 } |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
115 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
116 void SDL_MixAudio_m68k_S16MSB(short* dst, short* src, long len, long volume) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
117 { |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
118 __asm__ __volatile__ ( |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
119 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
120 "tstl %2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
121 " beqs stoploop_s16msb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
122 " movel #-32768,%%d2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
123 " movel #32767,%%d3\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
124 " lsrl #1,%2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
125 "mixloop_s16msb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
126 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
127 /* Mix a sample */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
128 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
129 " move %1@+,%%d0\n" /* d0 = *src++ */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
130 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
131 " move %0@,%%d1\n" /* d1 = *dst */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
132 " extl %%d1\n" /* extend d1 to 32 bits */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
133 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
134 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
135 " addl %%d1,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
136 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
137 " cmpl %%d2,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
138 " bges lower_limit_s16msb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
139 " move %%d2,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
140 "lower_limit_s16msb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
141 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
142 " cmpl %%d3,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
143 " bles upper_limit_s16msb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
144 " move %%d3,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
145 "upper_limit_s16msb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
146 " move %%d0,%0@+\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
147 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
148 /* Loop till done */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
149 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
150 " subql #1,%2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
151 " bhis mixloop_s16msb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
152 "stoploop_s16msb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
153 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
154 : /* no return value */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
155 : /* input */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
156 "a"(dst), "a"(src), "d"(len), "d"(volume) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
157 : /* clobbered registers */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
158 "d0", "d1", "d2", "d3", "cc", "memory" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
159 ); |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
160 } |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
161 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
162 void SDL_MixAudio_m68k_S16LSB(short* dst, short* src, long len, long volume) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
163 { |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
164 __asm__ __volatile__ ( |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
165 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
166 "tstl %2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
167 " beqs stoploop_s16lsb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
168 " movel #-32768,%%d2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
169 " movel #32767,%%d3\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
170 " lsrl #1,%2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
171 "mixloop_s16lsb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
172 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
173 /* Mix a sample */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
174 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
175 " move %1@+,%%d0\n" /* d0 = *src++ */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
176 " rorw #8,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
177 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
178 " move %0@,%%d1\n" /* d1 = *dst */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
179 " rorw #8,%%d1\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
180 " extl %%d1\n" /* extend d1 to 32 bits */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
181 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
182 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
183 " addl %%d1,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
184 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
185 " cmpl %%d2,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
186 " bges lower_limit_s16lsb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
187 " move %%d2,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
188 "lower_limit_s16lsb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
189 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
190 " cmpl %%d3,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
191 " bles upper_limit_s16lsb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
192 " move %%d3,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
193 "upper_limit_s16lsb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
194 " rorw #8,%%d0\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
195 " move %%d0,%0@+\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
196 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
197 /* Loop till done */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
198 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
199 " subql #1,%2\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
200 " bhis mixloop_s16lsb\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
201 "stoploop_s16lsb:\n" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
202 |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
203 : /* no return value */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
204 : /* input */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
205 "a"(dst), "a"(src), "d"(len), "d"(volume) |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
206 : /* clobbered registers */ |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
207 "d0", "d1", "d2", "d3", "cc", "memory" |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
208 ); |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
209 } |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
210 #endif |
873c2598f969
Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff
changeset
|
211 |