SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2004 Sam Lantinga
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 Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "SDL_config.h"
25 m68k assembly mix routines
30 #if defined(__M68000__) && defined(__GNUC__)
32 SDL_MixAudio_m68k_U8(char *dst, char *src, long len, long volume, char *mix8)
34 __asm__ __volatile__("tstl %2\n" " beqs stoploop_u8\n" "mixloop_u8:\n"
36 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
37 " sub #128,%%d0\n" /* d0 -= 128 */
38 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
39 " moveb %0@,%%d1\n" /* d1 = *dst */
40 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
41 " add #128,%%d0\n" /* d0 += 128 */
43 " moveb %4@(%%d0:w),%0@+\n"
45 " subql #1,%2\n" " bhis mixloop_u8\n" "stoploop_u8:\n": /* no return value */
47 "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8): /* clobbered registers */
48 "d0", "d1", "cc", "memory");
52 SDL_MixAudio_m68k_S8(char *dst, char *src, long len, long volume)
54 __asm__ __volatile__("tstl %2\n"
57 " moveq #127,%%d3\n" "mixloop_s8:\n"
59 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
60 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
61 " moveb %0@,%%d1\n" /* d1 = *dst */
62 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
65 " bges lower_limit_s8\n"
69 " bles upper_limit_s8\n"
71 "upper_limit_s8:\n" " moveb %%d0,%0@+\n"
73 " subql #1,%2\n" " bhis mixloop_s8\n" "stoploop_s8:\n": /* no return value */
75 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
76 "d0", "d1", "d2", "d3", "cc", "memory");
80 SDL_MixAudio_m68k_S16MSB(short *dst, short *src, long len, long volume)
82 __asm__ __volatile__("tstl %2\n"
83 " beqs stoploop_s16msb\n"
84 " movel #-32768,%%d2\n"
85 " movel #32767,%%d3\n"
86 " lsrl #1,%2\n" "mixloop_s16msb:\n"
88 " move %1@+,%%d0\n" /* d0 = *src++ */
89 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
90 " move %0@,%%d1\n" /* d1 = *dst */
91 " extl %%d1\n" /* extend d1 to 32 bits */
92 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
95 " bges lower_limit_s16msb\n"
97 "lower_limit_s16msb:\n"
99 " bles upper_limit_s16msb\n"
101 "upper_limit_s16msb:\n" " move %%d0,%0@+\n"
103 " subql #1,%2\n" " bhis mixloop_s16msb\n" "stoploop_s16msb:\n": /* no return value */
105 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
106 "d0", "d1", "d2", "d3", "cc", "memory");
110 SDL_MixAudio_m68k_S16LSB(short *dst, short *src, long len, long volume)
112 __asm__ __volatile__("tstl %2\n"
113 " beqs stoploop_s16lsb\n"
114 " movel #-32768,%%d2\n"
115 " movel #32767,%%d3\n"
116 " lsrl #1,%2\n" "mixloop_s16lsb:\n"
118 " move %1@+,%%d0\n" /* d0 = *src++ */
119 " rorw #8,%%d0\n" " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
120 " move %0@,%%d1\n" /* d1 = *dst */
121 " rorw #8,%%d1\n" " extl %%d1\n" /* extend d1 to 32 bits */
122 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
125 " bges lower_limit_s16lsb\n"
127 "lower_limit_s16lsb:\n"
129 " bles upper_limit_s16lsb\n"
131 "upper_limit_s16lsb:\n"
132 " rorw #8,%%d0\n" " move %%d0,%0@+\n"
134 " subql #1,%2\n" " bhis mixloop_s16lsb\n" "stoploop_s16lsb:\n": /* no return value */
136 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
137 "d0", "d1", "d2", "d3", "cc", "memory");
140 /* vi: set ts=4 sw=4 expandtab: */