annotate src/audio/SDL_mixer_m68k.c @ 4324:1496aa09e41e SDL-1.2

Steven Noonan to sdl While trying to build the SDLMain.m included with SDL 1.2.14, with #define SDL_USE_NIB_FILE 1: /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function '-[SDLMain fixMenu:withAppName:]': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:122: warning: 'sizeToFit' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenu.h:281) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function 'main': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: warning: 'poseAsClass:' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: error: 'poseAsClass:' is unavailable (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:377: warning: passing argument 2 of 'NSApplicationMain' from incompatible pointer type Eric Wing to Sam I don't have time today to look at this in detail, but the problem is definitely the poseAsClass: method. This was deprecated in Obj-C 2.0 and not retained in 64-bit. I've never used this method and it has always been limited to esoteric uses. I think this is why Apple wanted to dump it (among complicating some other things they do). I have read about others getting bit by this when migrating. Long story short, there really isn't a migration path for this method. The question that then must be asked is why are we using it (what does it accomplish), and then figure out the 'proper' way of accomplishing that. Glancing at SDLMain.m, it's not obvious to me why it is there or what it is really accomplishing. My only speculation is that NSApplicationMain hardcodes something to look for NSApplication and a subclass (SDLApplication) fails for some reason (assuming that the original coder did this for good reason). Three thoughts come to mind. 1) The Info.plist has properties to control things related to the startup class and nib. NSPrincipalClass, NSMainNibFile Maybe principle class needs to be SDLApplication and we can delete the poseAs 2) I was told that 10.6 introduced new APIs to make programatic NIB wrangling and avoidance easier. Unfortunately, I don't know the specifics. 3) Instead of subclassing NSApplication in SDLMain.m, maybe we can just add a category. It looks like the following is the only thing that is done (quick glance): @interface SDLApplication : NSApplication @end @implementation SDLApplication /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end So instead, we change this to: (warning written in mail and untested) @interface NSApplication (SDLApplication) - (void) terminate:(id)sender; @end @implementation NSApplication (SDLApplication) /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end Then everywhere SDLApplication is used, we change it to NSApplication (and remove the poseAsClass line). Perhaps you could ask the bug reporter to try this solution (#3). And if that fails, maybe try #1. -Eric Steven Noonan to Sam The suggested change (diff below) seems to work fine. - Steven
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Oct 2009 21:07:12 +0000
parents a1b03ba2fcd0
children 124629b76853
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
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
3 Copyright (C) 1997-2009 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