comparison src/audio/SDL_mixer_m68k.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
27 Patrice Mandin 27 Patrice Mandin
28 */ 28 */
29 29
30 #if defined(__M68000__) && defined(__GNUC__) 30 #if defined(__M68000__) && defined(__GNUC__)
31 void 31 void
32 SDL_MixAudio_m68k_U8 (char *dst, char *src, long len, long volume, char *mix8) 32 SDL_MixAudio_m68k_U8(char *dst, char *src, long len, long volume, char *mix8)
33 { 33 {
34 __asm__ __volatile__ ("tstl %2\n" " beqs stoploop_u8\n" "mixloop_u8:\n" 34 __asm__ __volatile__("tstl %2\n" " beqs stoploop_u8\n" "mixloop_u8:\n"
35 /* Mix a sample */ 35 /* Mix a sample */
36 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */ 36 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */
37 " sub #128,%%d0\n" /* d0 -= 128 */ 37 " sub #128,%%d0\n" /* d0 -= 128 */
38 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 38 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
39 " moveb %0@,%%d1\n" /* d1 = *dst */ 39 " moveb %0@,%%d1\n" /* d1 = *dst */
40 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 40 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
41 " add #128,%%d0\n" /* d0 += 128 */ 41 " add #128,%%d0\n" /* d0 += 128 */
42 " add %%d1,%%d0\n" 42 " add %%d1,%%d0\n"
43 " moveb %4@(%%d0:w),%0@+\n" 43 " moveb %4@(%%d0:w),%0@+\n"
44 /* Loop till done */ 44 /* Loop till done */
45 " subql #1,%2\n" " bhis mixloop_u8\n" "stoploop_u8:\n": /* no return value */ 45 " subql #1,%2\n" " bhis mixloop_u8\n" "stoploop_u8:\n": /* no return value */
46 : /* input */ 46 : /* input */
47 "a" (dst), "a" (src), "d" (len), "d" (volume), "a" (mix8): /* clobbered registers */ 47 "a"(dst), "a"(src), "d"(len), "d"(volume), "a"(mix8): /* clobbered registers */
48 "d0", "d1", "cc", "memory"); 48 "d0", "d1", "cc", "memory");
49 } 49 }
50 50
51 void 51 void
52 SDL_MixAudio_m68k_S8 (char *dst, char *src, long len, long volume) 52 SDL_MixAudio_m68k_S8(char *dst, char *src, long len, long volume)
53 { 53 {
54 __asm__ __volatile__ ("tstl %2\n" 54 __asm__ __volatile__("tstl %2\n"
55 " beqs stoploop_s8\n" 55 " beqs stoploop_s8\n"
56 " moveq #-128,%%d2\n" 56 " moveq #-128,%%d2\n"
57 " moveq #127,%%d3\n" "mixloop_s8:\n" 57 " moveq #127,%%d3\n" "mixloop_s8:\n"
58 /* Mix a sample */ 58 /* Mix a sample */
59 " moveq #0,%%d0\n" " moveq #0,%%d1\n" " moveb %1@+,%%d0\n" /* d0 = *src++ */ 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) */ 60 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
61 " moveb %0@,%%d1\n" /* d1 = *dst */ 61 " moveb %0@,%%d1\n" /* d1 = *dst */
62 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 62 " asr #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
63 " add %%d1,%%d0\n" 63 " add %%d1,%%d0\n"
64 " cmp %%d2,%%d0\n" 64 " cmp %%d2,%%d0\n"
65 " bges lower_limit_s8\n" 65 " bges lower_limit_s8\n"
66 " move %%d2,%%d0\n" 66 " move %%d2,%%d0\n"
67 "lower_limit_s8:\n" 67 "lower_limit_s8:\n"
68 " cmp %%d3,%%d0\n" 68 " cmp %%d3,%%d0\n"
69 " bles upper_limit_s8\n" 69 " bles upper_limit_s8\n"
70 " move %%d3,%%d0\n" 70 " move %%d3,%%d0\n"
71 "upper_limit_s8:\n" " moveb %%d0,%0@+\n" 71 "upper_limit_s8:\n" " moveb %%d0,%0@+\n"
72 /* Loop till done */ 72 /* Loop till done */
73 " subql #1,%2\n" " bhis mixloop_s8\n" "stoploop_s8:\n": /* no return value */ 73 " subql #1,%2\n" " bhis mixloop_s8\n" "stoploop_s8:\n": /* no return value */
74 : /* input */ 74 : /* input */
75 "a" (dst), "a" (src), "d" (len), "d" (volume): /* clobbered registers */ 75 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
76 "d0", "d1", "d2", "d3", "cc", "memory"); 76 "d0", "d1", "d2", "d3", "cc", "memory");
77 } 77 }
78 78
79 void 79 void
80 SDL_MixAudio_m68k_S16MSB (short *dst, short *src, long len, long volume) 80 SDL_MixAudio_m68k_S16MSB(short *dst, short *src, long len, long volume)
81 { 81 {
82 __asm__ __volatile__ ("tstl %2\n" 82 __asm__ __volatile__("tstl %2\n"
83 " beqs stoploop_s16msb\n" 83 " beqs stoploop_s16msb\n"
84 " movel #-32768,%%d2\n" 84 " movel #-32768,%%d2\n"
85 " movel #32767,%%d3\n" 85 " movel #32767,%%d3\n"
86 " lsrl #1,%2\n" "mixloop_s16msb:\n" 86 " lsrl #1,%2\n" "mixloop_s16msb:\n"
87 /* Mix a sample */ 87 /* Mix a sample */
88 " move %1@+,%%d0\n" /* d0 = *src++ */ 88 " move %1@+,%%d0\n" /* d0 = *src++ */
89 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 89 " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
90 " move %0@,%%d1\n" /* d1 = *dst */ 90 " move %0@,%%d1\n" /* d1 = *dst */
91 " extl %%d1\n" /* extend d1 to 32 bits */ 91 " extl %%d1\n" /* extend d1 to 32 bits */
92 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 92 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
93 " addl %%d1,%%d0\n" 93 " addl %%d1,%%d0\n"
94 " cmpl %%d2,%%d0\n" 94 " cmpl %%d2,%%d0\n"
95 " bges lower_limit_s16msb\n" 95 " bges lower_limit_s16msb\n"
96 " move %%d2,%%d0\n" 96 " move %%d2,%%d0\n"
97 "lower_limit_s16msb:\n" 97 "lower_limit_s16msb:\n"
98 " cmpl %%d3,%%d0\n" 98 " cmpl %%d3,%%d0\n"
99 " bles upper_limit_s16msb\n" 99 " bles upper_limit_s16msb\n"
100 " move %%d3,%%d0\n" 100 " move %%d3,%%d0\n"
101 "upper_limit_s16msb:\n" " move %%d0,%0@+\n" 101 "upper_limit_s16msb:\n" " move %%d0,%0@+\n"
102 /* Loop till done */ 102 /* Loop till done */
103 " subql #1,%2\n" " bhis mixloop_s16msb\n" "stoploop_s16msb:\n": /* no return value */ 103 " subql #1,%2\n" " bhis mixloop_s16msb\n" "stoploop_s16msb:\n": /* no return value */
104 : /* input */ 104 : /* input */
105 "a" (dst), "a" (src), "d" (len), "d" (volume): /* clobbered registers */ 105 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
106 "d0", "d1", "d2", "d3", "cc", "memory"); 106 "d0", "d1", "d2", "d3", "cc", "memory");
107 } 107 }
108 108
109 void 109 void
110 SDL_MixAudio_m68k_S16LSB (short *dst, short *src, long len, long volume) 110 SDL_MixAudio_m68k_S16LSB(short *dst, short *src, long len, long volume)
111 { 111 {
112 __asm__ __volatile__ ("tstl %2\n" 112 __asm__ __volatile__("tstl %2\n"
113 " beqs stoploop_s16lsb\n" 113 " beqs stoploop_s16lsb\n"
114 " movel #-32768,%%d2\n" 114 " movel #-32768,%%d2\n"
115 " movel #32767,%%d3\n" 115 " movel #32767,%%d3\n"
116 " lsrl #1,%2\n" "mixloop_s16lsb:\n" 116 " lsrl #1,%2\n" "mixloop_s16lsb:\n"
117 /* Mix a sample */ 117 /* Mix a sample */
118 " move %1@+,%%d0\n" /* d0 = *src++ */ 118 " move %1@+,%%d0\n" /* d0 = *src++ */
119 " rorw #8,%%d0\n" " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */ 119 " rorw #8,%%d0\n" " muls %3,%%d0\n" /* d0 *= volume (0<=volume<=128) */
120 " move %0@,%%d1\n" /* d1 = *dst */ 120 " move %0@,%%d1\n" /* d1 = *dst */
121 " rorw #8,%%d1\n" " extl %%d1\n" /* extend d1 to 32 bits */ 121 " rorw #8,%%d1\n" " extl %%d1\n" /* extend d1 to 32 bits */
122 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */ 122 " asrl #7,%%d0\n" /* d0 /= 128 (SDL_MIX_MAXVOLUME) */
123 " addl %%d1,%%d0\n" 123 " addl %%d1,%%d0\n"
124 " cmpl %%d2,%%d0\n" 124 " cmpl %%d2,%%d0\n"
125 " bges lower_limit_s16lsb\n" 125 " bges lower_limit_s16lsb\n"
126 " move %%d2,%%d0\n" 126 " move %%d2,%%d0\n"
127 "lower_limit_s16lsb:\n" 127 "lower_limit_s16lsb:\n"
128 " cmpl %%d3,%%d0\n" 128 " cmpl %%d3,%%d0\n"
129 " bles upper_limit_s16lsb\n" 129 " bles upper_limit_s16lsb\n"
130 " move %%d3,%%d0\n" 130 " move %%d3,%%d0\n"
131 "upper_limit_s16lsb:\n" 131 "upper_limit_s16lsb:\n"
132 " rorw #8,%%d0\n" " move %%d0,%0@+\n" 132 " rorw #8,%%d0\n" " move %%d0,%0@+\n"
133 /* Loop till done */ 133 /* Loop till done */
134 " subql #1,%2\n" " bhis mixloop_s16lsb\n" "stoploop_s16lsb:\n": /* no return value */ 134 " subql #1,%2\n" " bhis mixloop_s16lsb\n" "stoploop_s16lsb:\n": /* no return value */
135 : /* input */ 135 : /* input */
136 "a" (dst), "a" (src), "d" (len), "d" (volume): /* clobbered registers */ 136 "a"(dst), "a"(src), "d"(len), "d"(volume): /* clobbered registers */
137 "d0", "d1", "d2", "d3", "cc", "memory"); 137 "d0", "d1", "d2", "d3", "cc", "memory");
138 } 138 }
139 #endif 139 #endif
140 /* vi: set ts=4 sw=4 expandtab: */ 140 /* vi: set ts=4 sw=4 expandtab: */