annotate src/audio/SDL_mixer_MMX_VC.c @ 1133:609c060fd2a2

The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails: To: SDL Developers <sdl@libsdl.org> From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se> Date: Mon, 30 May 2005 23:29:04 +0200 Subject: [SDL] Mac OS X Video Drivers [patch] I've updated/added the Carbon and X11 video drivers to the Mac OS X port of SDL 1.2 (the CVS version), and made the Cocoa driver and runtime *optional*. The default is still Cocoa, and the "Quartz" driver. But you can now also use "toolbox" for Carbon, and "x11" for running with Apple's (or other) X11 server: export SDL_VIDEODRIVER=x11 export SDL_VIDEO_GL_DRIVER=/usr/X11R6/lib/libGL.dylib It also checks if the frameworks are available, by a: #include <Carbon/Carbon.h> or #import <Cocoa/Cocoa.h> (this should make it configure on plain Darwin as well?) Here are the new configure targets: --enable-video-cocoa use Cocoa/Quartz video driver default=yes --enable-video-carbon use Carbon/QuickDraw video driver default=yes --enable-video-x11 use X11 video driver default=no ./configure --enable-video-cocoa --enable-video-carbon --enable-video-x11 \ --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib The Carbon version is just an updated version of the old SDL driver for Mac OS 9, and could probably be improved... (but it does work, including the Carbon version of SDLmain) If you disable cocoa, you can run with -framework Carbon only, and the C version of SDL_main.c. And if you disable carbon too, you can still use the X11 version which doesn't require SDLmain. I updated the DrawSprocket version, but did not include it. (no blitters or VRAM GWorlds etc. available on OS X anyway) Besides for Mac OS 9, I don't think there's any use for it ? And note that any performance on Mac OS X equals OpenGL anyway... You can get "fair" software SDL results on captured CG displays, but for decent frame rates you need to be using GL for rendering. Finally, here is the patch itself: http://www.algonet.se/~afb/SDL-12CVS-macvideo.patch --anders PS. It says "video", but as usual it applies to mouse/keyboard too. ------ To: A list for developers using the SDL library <sdl@libsdl.org> From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se> Date: Sun, 4 Sep 2005 10:02:15 +0200 Subject: [SDL] Updated Mac patch Updated the previous Mac patch to disable Carbon by default. Also "fixed" the SDL.spec again, so that it builds on Darwin. http://www.algonet.se/~afb/SDL-1.2.9-mac.patch Also applied fine to SDL12 CVS, when I tried it.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 08 Sep 2005 06:16:14 +0000
parents b4117292e587
children ef03e8789d59
rev   line source
746
72ef7ce609ef Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 574
diff changeset
1 #if defined(USE_ASM_MIXER_VC)
574
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 // MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 // Converted to Intel ASM notation by Cth
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 // This code is licensed under the LGPL (see COPYING for details)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 //
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 // Assumes buffer size in bytes is a multiple of 16
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 // Assumes SDL_MIX_MAXVOLUME = 128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 ////////////////////////////////////////////////
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 // Mixing for 16 bit signed buffers
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 ////////////////////////////////////////////////
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 #include <windows.h>
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 #include <stdio.h>
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 void SDL_MixAudio_MMX_S16_VC(char* dst,char* src,unsigned int nSize,int volume)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 {
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 __asm
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 {
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 push edi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 push esi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 push ebx
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 mov edi, dst // edi = dst
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 mov esi, src // esi = src
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 mov eax, volume // eax = volume
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 mov ebx, nSize // ebx = size
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 shr ebx, 4 // process 16 bytes per iteration = 8 samples
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 jz endS16
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 pxor mm0, mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 movd mm0, eax //%%eax,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 movq mm1, mm0 //%%mm0,%%mm1
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 psllq mm0, 16 //$16,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 por mm0, mm1 //%%mm1,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 psllq mm0, 16 //$16,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 por mm0, mm1 //%%mm1,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 psllq mm0, 16 //$16,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 por mm0, mm1 //%%mm1,%%mm0 // mm0 = vol|vol|vol|vol
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
1049
b4117292e587 Mixer: Visual C MMX asm code now aligns loops to 16 bytes.
Ryan C. Gordon <icculus@icculus.org>
parents: 746
diff changeset
44 align 16
574
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 mixloopS16:
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 movq mm1, [esi] //(%%esi),%%mm1\n" // mm1 = a|b|c|d
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 movq mm2, mm1 //%%mm1,%%mm2\n" // mm2 = a|b|c|d
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 movq mm4, [esi + 8] //8(%%esi),%%mm4\n" // mm4 = e|f|g|h
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 // pre charger le buffer dst dans mm7
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 movq mm7, [edi] //(%%edi),%%mm7\n" // mm7 = dst[0]"
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 // multiplier par le volume
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 pmullw mm1, mm0 //%%mm0,%%mm1\n" // mm1 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 pmulhw mm2, mm0 //%%mm0,%%mm2\n" // mm2 = h(a*v)|h(b*v)|h(c*v)|h(d*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 movq mm5, mm4 //%%mm4,%%mm5\n" // mm5 = e|f|g|h
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 pmullw mm4, mm0 //%%mm0,%%mm4\n" // mm4 = l(e*v)|l(f*v)|l(g*v)|l(h*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 pmulhw mm5, mm0 //%%mm0,%%mm5\n" // mm5 = h(e*v)|h(f*v)|h(g*v)|h(h*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 movq mm3, mm1 //%%mm1,%%mm3\n" // mm3 = l(a*v)|l(b*v)|l(c*v)|l(d*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 punpckhwd mm1, mm2 //%%mm2,%%mm1\n" // mm1 = a*v|b*v
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 movq mm6, mm4 //%%mm4,%%mm6\n" // mm6 = l(e*v)|l(f*v)|l(g*v)|l(h*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 punpcklwd mm3, mm2 //%%mm2,%%mm3\n" // mm3 = c*v|d*v
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 punpckhwd mm4, mm5 //%%mm5,%%mm4\n" // mm4 = e*f|f*v
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 punpcklwd mm6, mm5 //%%mm5,%%mm6\n" // mm6 = g*v|h*v
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 // pre charger le buffer dst dans mm5
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 movq mm5, [edi + 8] //8(%%edi),%%mm5\n" // mm5 = dst[1]
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 // diviser par 128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 psrad mm1, 7 //$7,%%mm1\n" // mm1 = a*v/128|b*v/128 , 128 = SDL_MIX_MAXVOLUME
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 add esi, 16 //$16,%%esi\n"
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 psrad mm3, 7 //$7,%%mm3\n" // mm3 = c*v/128|d*v/128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 psrad mm4, 7 //$7,%%mm4\n" // mm4 = e*v/128|f*v/128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 // mm1 = le sample avec le volume modifie
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 packssdw mm3, mm1 //%%mm1,%%mm3\n" // mm3 = s(a*v|b*v|c*v|d*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 psrad mm6, 7 //$7,%%mm6\n" // mm6= g*v/128|h*v/128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 paddsw mm3, mm7 //%%mm7,%%mm3\n" // mm3 = adjust_volume(src)+dst
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 // mm4 = le sample avec le volume modifie
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 packssdw mm6, mm4 //%%mm4,%%mm6\n" // mm6 = s(e*v|f*v|g*v|h*v)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 movq [edi], mm3 //%%mm3,(%%edi)\n"
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 paddsw mm6, mm5 //%%mm5,%%mm6\n" // mm6 = adjust_volume(src)+dst
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 movq [edi + 8], mm6 //%%mm6,8(%%edi)\n"
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 add edi, 16 //$16,%%edi\n"
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 dec ebx //%%ebx\n"
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 jnz mixloopS16
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 ends16:
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 emms
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 pop ebx
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 pop esi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 pop edi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 }
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 }
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 ////////////////////////////////////////////////
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 // Mixing for 8 bit signed buffers
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 ////////////////////////////////////////////////
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 void SDL_MixAudio_MMX_S8_VC(char* dst,char* src,unsigned int nSize,int volume)
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 {
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 _asm
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 {
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 push edi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 push esi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 push ebx
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 mov edi, dst //movl %0,%%edi // edi = dst
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 mov esi, src //%1,%%esi // esi = src
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 mov eax, volume //%3,%%eax // eax = volume
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 movd mm0, ebx //%%ebx,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 movq mm1, mm0 //%%mm0,%%mm1
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 psllq mm0, 16 //$16,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 por mm0, mm1 //%%mm1,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 psllq mm0, 16 //$16,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 por mm0, mm1 //%%mm1,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 psllq mm0, 16 //$16,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 por mm0, mm1 //%%mm1,%%mm0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 mov ebx, nSize //%2,%%ebx // ebx = size
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 shr ebx, 3 //$3,%%ebx // process 8 bytes per iteration = 8 samples
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 cmp ebx, 0 //$0,%%ebx
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 je endS8
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
1049
b4117292e587 Mixer: Visual C MMX asm code now aligns loops to 16 bytes.
Ryan C. Gordon <icculus@icculus.org>
parents: 746
diff changeset
124 align 16
574
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 mixloopS8:
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 pxor mm2, mm2 //%%mm2,%%mm2 // mm2 = 0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 movq mm1, [esi] //(%%esi),%%mm1 // mm1 = a|b|c|d|e|f|g|h
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 movq mm3, mm1 //%%mm1,%%mm3 // mm3 = a|b|c|d|e|f|g|h
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 // on va faire le "sign extension" en faisant un cmp avec 0 qui retourne 1 si <0, 0 si >0
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 pcmpgtb mm2, mm1 //%%mm1,%%mm2 // mm2 = 11111111|00000000|00000000....
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 punpckhbw mm1, mm2 //%%mm2,%%mm1 // mm1 = 0|a|0|b|0|c|0|d
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 punpcklbw mm3, mm2 //%%mm2,%%mm3 // mm3 = 0|e|0|f|0|g|0|h
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 movq mm2, [edi] //(%%edi),%%mm2 // mm2 = destination
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 pmullw mm1, mm0 //%%mm0,%%mm1 // mm1 = v*a|v*b|v*c|v*d
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 add esi, 8 //$8,%%esi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 pmullw mm3, mm0 //%%mm0,%%mm3 // mm3 = v*e|v*f|v*g|v*h
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 psraw mm1, 7 //$7,%%mm1 // mm1 = v*a/128|v*b/128|v*c/128|v*d/128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 psraw mm3, 7 //$7,%%mm3 // mm3 = v*e/128|v*f/128|v*g/128|v*h/128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 packsswb mm3, mm1 //%%mm1,%%mm3 // mm1 = v*a/128|v*b/128|v*c/128|v*d/128|v*e/128|v*f/128|v*g/128|v*h/128
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 paddsb mm3, mm2 //%%mm2,%%mm3 // add to destination buffer
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 movq [edi], mm3 //%%mm3,(%%edi) // store back to ram
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 add edi, 8 //$8,%%edi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 dec ebx //%%ebx
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 jnz mixloopS8
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 endS8:
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 emms
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 pop ebx
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 pop esi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 pop edi
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 }
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 }
64fe373be3dc Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154
746
72ef7ce609ef Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents: 574
diff changeset
155 #endif /* USE_ASM_MIXER_VC */