Mercurial > sdl-ios-xcode
annotate src/audio/SDL_mixer_MMX_VC.c @ 1199:2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
To: sdl@libsdl.org
Date: Sun, 11 Dec 2005 22:57:37 -0500
Subject: [SDL] exec stack in libsdl update
i posted back in September a patch to remove executable stacks:
http://www.devolution.com/pipermail/sdl/2005-September/070626.html
later in November, a similar patch was merged it seems:
http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/hermes/mmx_main.asm
however, this lacks the additional output format checks that i posted in my
patch ... this isnt a problem if the hermes asm code is only ever used to
produce ELF objects, but if this is not true, then the additional checks in
my original patch will need to be merged
-mike
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 12 Dec 2005 09:13:12 +0000 |
parents | 173c063d4f55 |
children | 450721ad5436 |
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 |
1190 | 15 #ifndef __WATCOMC__ |
574
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 #include <windows.h> |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 #include <stdio.h> |
1190 | 18 #endif |
574
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 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
|
21 { |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 __asm |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 { |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 push edi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 push esi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 push ebx |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 mov edi, dst // edi = dst |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 mov esi, src // esi = src |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 mov eax, volume // eax = volume |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 mov ebx, nSize // ebx = size |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 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
|
34 jz endS16 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 pxor mm0, mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 movd mm0, eax //%%eax,%%mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 movq mm1, mm0 //%%mm0,%%mm1 |
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 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 psllq mm0, 16 //$16,%%mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 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
|
45 |
1190 | 46 #ifndef __WATCOMC__ |
1049
b4117292e587
Mixer: Visual C MMX asm code now aligns loops to 16 bytes.
Ryan C. Gordon <icculus@icculus.org>
parents:
746
diff
changeset
|
47 align 16 |
1190 | 48 #endif |
574
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 mixloopS16: |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 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
|
51 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
|
52 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
|
53 // 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
|
54 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
|
55 // multiplier par le volume |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 // 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
|
68 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
|
69 // diviser par 128 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 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
|
74 // 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
|
75 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
|
76 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
|
77 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
|
78 // 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 dec ebx //%%ebx\n" |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 jnz mixloopS16 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 ends16: |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 emms |
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 pop ebx |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 pop esi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 pop edi |
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 |
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 //////////////////////////////////////////////// |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 // 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
|
99 //////////////////////////////////////////////// |
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 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
|
102 { |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 _asm |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 { |
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 push edi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 push esi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 push ebx |
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 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
|
111 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
|
112 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
|
113 |
1149
ef03e8789d59
Same inline asm bug in S8 mixer, fixed last night, is also in the MSVC version.
Ryan C. Gordon <icculus@icculus.org>
parents:
1049
diff
changeset
|
114 movd mm0, eax //%%eax,%%mm0 |
574
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 movq mm1, mm0 //%%mm0,%%mm1 |
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 psllq mm0, 16 //$16,%%mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 por mm0, mm1 //%%mm1,%%mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 psllq mm0, 16 //$16,%%mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 por mm0, mm1 //%%mm1,%%mm0 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 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
|
124 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
|
125 cmp ebx, 0 //$0,%%ebx |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 je endS8 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 |
1190 | 128 #ifndef __WATCOMC__ |
1049
b4117292e587
Mixer: Visual C MMX asm code now aligns loops to 16 bytes.
Ryan C. Gordon <icculus@icculus.org>
parents:
746
diff
changeset
|
129 align 16 |
1190 | 130 #endif |
574
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 mixloopS8: |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 // 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 add esi, 8 //$8,%%esi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 add edi, 8 //$8,%%edi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 dec ebx //%%ebx |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 jnz mixloopS8 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 endS8: |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 emms |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 pop ebx |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 pop esi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 pop edi |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 } |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 } |
64fe373be3dc
Cth converted the MMX audio mixing routines to VC++ syntax
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 |
746
72ef7ce609ef
Greatly simplified the SDL CPU info code
Sam Lantinga <slouken@libsdl.org>
parents:
574
diff
changeset
|
161 #endif /* USE_ASM_MIXER_VC */ |