comparison src/audio/mint/SDL_mintaudio_it.S @ 3866:afbcf97a5dd9 SDL-1.2

Save/restore fpu registers if needed
author Patrice Mandin <patmandin@gmail.com>
date Sat, 16 Sep 2006 11:50:34 +0000
parents ea2a327b92d7
children 4dae257a9cbf
comparison
equal deleted inserted replaced
3865:e958a003b69b 3866:afbcf97a5dd9
38 .globl _SDL_MintAudio_mutex 38 .globl _SDL_MintAudio_mutex
39 .globl _SDL_MintAudio_audiobuf 39 .globl _SDL_MintAudio_audiobuf
40 .globl _SDL_MintAudio_numbuf 40 .globl _SDL_MintAudio_numbuf
41 .globl _SDL_MintAudio_audiosize 41 .globl _SDL_MintAudio_audiosize
42 .globl _SDL_MintAudio_clocktics 42 .globl _SDL_MintAudio_clocktics
43 .globl _SDL_MintAudio_hasfpu
43 44
44 .globl _SDL_MintAudio_stfa 45 .globl _SDL_MintAudio_stfa
45 46
46 /* 47 /*
47 How it works: 48 How it works:
75 /* Clear service bit, so other MFP interrupts can work */ 76 /* Clear service bit, so other MFP interrupts can work */
76 bclr #5,0xfffffa0f:w 77 bclr #5,0xfffffa0f:w
77 78
78 /* Check if we are not already running */ 79 /* Check if we are not already running */
79 tstw _SDL_MintAudio_mutex 80 tstw _SDL_MintAudio_mutex
80 bnes SDL_MintAudio_XbiosEnd 81 bne SDL_MintAudio_XbiosEnd
81 notw _SDL_MintAudio_mutex 82 notw _SDL_MintAudio_mutex
82 83
83 /* Swap buffers */ 84 /* Swap buffers */
84 eorw #1,_SDL_MintAudio_numbuf 85 eorw #1,_SDL_MintAudio_numbuf
85 86
86 moveml d0-d7/a0-a6,sp@- 87 moveml d0-d7/a0-a6,sp@-
87 88
89 /* Save FPU if needed */
90 tstw _SDL_MintAudio_hasfpu
91 beqs SDL_MintAudio_Xbios_nofpu1
92 fsave sp@-
93 fmoveml fpcr/fpsr/fpiar,sp@-
94 fmovemx fp0-fp7,sp@-
95 SDL_MintAudio_Xbios_nofpu1:
96
88 /* Callback */ 97 /* Callback */
89 jsr _SDL_MintAudio_Callback 98 jsr _SDL_MintAudio_Callback
99
100 /* Restore FPU if needed */
101 tstw _SDL_MintAudio_hasfpu
102 beqs SDL_MintAudio_Xbios_nofpu2
103 fmovemx sp@+,fp0-fp7
104 fmoveml sp@+,fpcr/fpsr/fpiar
105 frestore sp@+
106 SDL_MintAudio_Xbios_nofpu2:
90 107
91 /* Reserve space for registers */ 108 /* Reserve space for registers */
92 subl #savamt,savptr 109 subl #savamt,savptr
93 110
94 /* Set new buffer */ 111 /* Set new buffer */
129 /* Clear service bit, so other MFP interrupts can work */ 146 /* Clear service bit, so other MFP interrupts can work */
130 bclr #5,0xfffffa0f:w 147 bclr #5,0xfffffa0f:w
131 148
132 /* Check if we are not already running */ 149 /* Check if we are not already running */
133 tstw _SDL_MintAudio_mutex 150 tstw _SDL_MintAudio_mutex
134 bnes SDL_MintAudio_Dma8End 151 bne SDL_MintAudio_Dma8End
135 notw _SDL_MintAudio_mutex 152 notw _SDL_MintAudio_mutex
136 153
137 /* Swap buffers */ 154 /* Swap buffers */
138 eorw #1,_SDL_MintAudio_numbuf 155 eorw #1,_SDL_MintAudio_numbuf
139 156
140 moveml d0-d1/a0-a1,sp@- 157 moveml d0-d1/a0-a1,sp@-
141 158
159 /* Save FPU if needed */
160 tstw _SDL_MintAudio_hasfpu
161 beqs SDL_MintAudio_Dma8_nofpu1
162 fsave sp@-
163 fmoveml fpcr/fpsr/fpiar,sp@-
164 fmovemx fp0-fp7,sp@-
165 SDL_MintAudio_Dma8_nofpu1:
166
142 /* Callback */ 167 /* Callback */
143 jsr _SDL_MintAudio_Callback 168 jsr _SDL_MintAudio_Callback
169
170 /* Restore FPU if needed */
171 tstw _SDL_MintAudio_hasfpu
172 beqs SDL_MintAudio_Dma8_nofpu2
173 fmovemx sp@+,fp0-fp7
174 fmoveml sp@+,fpcr/fpsr/fpiar
175 frestore sp@+
176 SDL_MintAudio_Dma8_nofpu2:
144 177
145 /* Set new buffer */ 178 /* Set new buffer */
146 179
147 moveq #0,d0 180 moveq #0,d0
148 181
193 /* Swap buffers */ 226 /* Swap buffers */
194 eorw #1,_SDL_MintAudio_numbuf 227 eorw #1,_SDL_MintAudio_numbuf
195 228
196 moveml d0-d7/a0-a6,sp@- 229 moveml d0-d7/a0-a6,sp@-
197 230
231 /* Save FPU if needed */
232 tstw _SDL_MintAudio_hasfpu
233 beqs SDL_MintAudio_Stfa_nofpu1
234 fsave sp@-
235 fmoveml fpcr/fpsr/fpiar,sp@-
236 fmovemx fp0-fp7,sp@-
237 SDL_MintAudio_Stfa_nofpu1:
238
198 /* Callback */ 239 /* Callback */
199 jsr _SDL_MintAudio_Callback 240 jsr _SDL_MintAudio_Callback
241
242 /* Restore FPU if needed */
243 tstw _SDL_MintAudio_hasfpu
244 beqs SDL_MintAudio_Stfa_nofpu2
245 fmovemx sp@+,fp0-fp7
246 fmoveml sp@+,fpcr/fpsr/fpiar
247 frestore sp@+
248 SDL_MintAudio_Stfa_nofpu2:
200 249
201 /* Set new buffer */ 250 /* Set new buffer */
202 251
203 moveq #0,d0 252 moveq #0,d0
204 movel _SDL_MintAudio_stfa,a1 253 movel _SDL_MintAudio_stfa,a1