annotate src/audio/SDL_mixer_m68k.c @ 1247:ff73ee89ff4b

Don't trample SDL_LoadObject()'s error message in GL loader.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 13 Jan 2006 02:36:35 +0000
parents b8d311d90021
children d910939febfa
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 */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
22
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 m68k assembly mix routines
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
25
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
26 Patrice Mandin
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27 */
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 #if defined(__M68000__) && defined(__GNUC__)
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30 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
31 {
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
32 __asm__ __volatile__ (
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
33
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
34 "tstl %2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
35 " beqs stoploop_u8\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
36 "mixloop_u8:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
37
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
38 /* Mix a sample */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
39
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
40 " moveq #0,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
41 " moveq #0,%%d1\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
42
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
43 " moveb %1@+,%%d0\n" /* d0 = *src++ */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
44 " sub #128,%%d0\n" /* d0 -= 128 */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
45 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
46 " moveb %0@,%%d1\n" /* d1 = *dst */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
48 " add #128,%%d0\n" /* d0 += 128 */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
49
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
50 " add %%d1,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
51
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
52 " moveb %4@(%%d0:w),%0@+\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
53
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
54 /* Loop till done */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
55
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
56 " subql #1,%2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
57 " bhis mixloop_u8\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
58 "stoploop_u8:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
59
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
60 : /* no return value */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
61 : /* input */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
62 "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8)
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
63 : /* clobbered registers */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
64 "d0", "d1", "cc", "memory"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
65 );
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 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
69 {
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
70 __asm__ __volatile__ (
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
71
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
72 "tstl %2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
73 " beqs stoploop_s8\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
74 " moveq #-128,%%d2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
75 " moveq #127,%%d3\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
76 "mixloop_s8:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
77
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
78 /* Mix a sample */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
79
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
80 " moveq #0,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
81 " moveq #0,%%d1\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
82
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
83 " moveb %1@+,%%d0\n" /* d0 = *src++ */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
84 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
85 " moveb %0@,%%d1\n" /* d1 = *dst */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
86 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
87
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
88 " add %%d1,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
89
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
90 " cmp %%d2,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
91 " bges lower_limit_s8\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
92 " move %%d2,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
93 "lower_limit_s8:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
94
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
95 " cmp %%d3,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
96 " bles upper_limit_s8\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
97 " move %%d3,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
98 "upper_limit_s8:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
99 " moveb %%d0,%0@+\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
100
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
101 /* Loop till done */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
102
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
103 " subql #1,%2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
104 " bhis mixloop_s8\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
105 "stoploop_s8:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
106
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
107 : /* no return value */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
108 : /* input */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
109 "a"(dst), "a"(src), "d"(len), "d"(volume)
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
110 : /* clobbered registers */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
111 "d0", "d1", "d2", "d3", "cc", "memory"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
112 );
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 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
116 {
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
117 __asm__ __volatile__ (
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
118
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
119 "tstl %2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
120 " beqs stoploop_s16msb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
121 " movel #-32768,%%d2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
122 " movel #32767,%%d3\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
123 " lsrl #1,%2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
124 "mixloop_s16msb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
125
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
126 /* Mix a sample */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
127
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
128 " move %1@+,%%d0\n" /* d0 = *src++ */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
129 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
130 " move %0@,%%d1\n" /* d1 = *dst */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
131 " extl %%d1\n" /* extend d1 to 32 bits */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
132 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
133
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
134 " addl %%d1,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
135
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
136 " cmpl %%d2,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
137 " bges lower_limit_s16msb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
138 " move %%d2,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
139 "lower_limit_s16msb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
140
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
141 " cmpl %%d3,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
142 " bles upper_limit_s16msb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
143 " move %%d3,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
144 "upper_limit_s16msb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
145 " move %%d0,%0@+\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
146
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
147 /* Loop till done */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
148
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
149 " subql #1,%2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
150 " bhis mixloop_s16msb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
151 "stoploop_s16msb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
152
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
153 : /* no return value */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
154 : /* input */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
155 "a"(dst), "a"(src), "d"(len), "d"(volume)
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
156 : /* clobbered registers */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
157 "d0", "d1", "d2", "d3", "cc", "memory"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
158 );
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 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
162 {
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
163 __asm__ __volatile__ (
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
164
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
165 "tstl %2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
166 " beqs stoploop_s16lsb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
167 " movel #-32768,%%d2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
168 " movel #32767,%%d3\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
169 " lsrl #1,%2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
170 "mixloop_s16lsb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
171
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
172 /* Mix a sample */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
173
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
174 " move %1@+,%%d0\n" /* d0 = *src++ */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
175 " rorw #8,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
176 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
177 " move %0@,%%d1\n" /* d1 = *dst */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
178 " rorw #8,%%d1\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
179 " extl %%d1\n" /* extend d1 to 32 bits */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
180 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
181
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
182 " addl %%d1,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
183
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
184 " cmpl %%d2,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
185 " bges lower_limit_s16lsb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
186 " move %%d2,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
187 "lower_limit_s16lsb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
188
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
189 " cmpl %%d3,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
190 " bles upper_limit_s16lsb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
191 " move %%d3,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
192 "upper_limit_s16lsb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
193 " rorw #8,%%d0\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
194 " move %%d0,%0@+\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
195
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
196 /* Loop till done */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
197
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
198 " subql #1,%2\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
199 " bhis mixloop_s16lsb\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
200 "stoploop_s16lsb:\n"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
201
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
202 : /* no return value */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
203 : /* input */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
204 "a"(dst), "a"(src), "d"(len), "d"(volume)
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
205 : /* clobbered registers */
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
206 "d0", "d1", "d2", "d3", "cc", "memory"
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
207 );
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 #endif
873c2598f969 Add m68k assembly mixing routines
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
210