annotate 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
rev   line source
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
1 /*
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
4
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
9
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
13 Library General Public License for more details.
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
14
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
18
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
19 Sam Lantinga
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
21 */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
22
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
23 /*
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
24 Audio interrupts
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
25
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
26 Patrice Mandin, Didier Méquignon
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27 */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
28
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
29 .text
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
31 .globl _SDL_MintAudio_Callback
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
32
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
33 .globl _SDL_MintAudio_XbiosInterrupt
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
34 .globl _SDL_MintAudio_XbiosInterruptMeasureClock
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
35 .globl _SDL_MintAudio_Dma8Interrupt
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
36 .globl _SDL_MintAudio_StfaInterrupt
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
37
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
38 .globl _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
39 .globl _SDL_MintAudio_audiobuf
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
40 .globl _SDL_MintAudio_numbuf
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
41 .globl _SDL_MintAudio_audiosize
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
42 .globl _SDL_MintAudio_clocktics
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
43 .globl _SDL_MintAudio_hasfpu
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
44
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
45 .globl _SDL_MintAudio_stfa
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
46
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47 /*
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
48 How it works:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
49 - Audio is playing buffer #0 (resp. #1)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
50 - We must calculate a sample in buffer #1 (resp. #0)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
51 so we first call the callback to do it
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
52 - Then we swap the buffers
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
53 */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
54
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
55 #define savptr 0x4a2
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
56 #define savamt 0x46
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
57
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
58 /*--- Xbios interrupt vector to measure Falcon external clock ---*/
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
59
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
60 _SDL_MintAudio_XbiosInterruptMeasureClock: /* 1 mS */
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
61
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
62 btst #0,0xFFFF8901:w /* state DMA sound */
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
63 beqs SDL_MintAudio_EndIntMeasure
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
64 addql #1,_SDL_MintAudio_clocktics
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
65 SDL_MintAudio_EndIntMeasure:
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
66 bclr #5,0xFFFFFA0F:w /* Clear service bit */
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
67 rte
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
68
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
69 /*--- Xbios interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
70
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
71 _SDL_MintAudio_XbiosInterrupt:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
72
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
73 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
74 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
75
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
76 /* Clear service bit, so other MFP interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
77 bclr #5,0xfffffa0f:w
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
78
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
79 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
80 tstw _SDL_MintAudio_mutex
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
81 bne SDL_MintAudio_XbiosEnd
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
82 notw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
83
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
84 /* Swap buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
85 eorw #1,_SDL_MintAudio_numbuf
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
86
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
87 moveml d0-d7/a0-a6,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
88
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
89 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
90 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
91 beqs SDL_MintAudio_Xbios_nofpu1
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
92 fsave sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
93 fmoveml fpcr/fpsr/fpiar,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
94 fmovemx fp0-fp7,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
95 SDL_MintAudio_Xbios_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
96
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
97 /* Callback */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
98 jsr _SDL_MintAudio_Callback
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
99
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
100 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
101 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
102 beqs SDL_MintAudio_Xbios_nofpu2
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
103 fmovemx sp@+,fp0-fp7
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
104 fmoveml sp@+,fpcr/fpsr/fpiar
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
105 frestore sp@+
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
106 SDL_MintAudio_Xbios_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
107
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
108 /* Reserve space for registers */
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
109 subl #savamt,savptr
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
110
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
111 /* Set new buffer */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
112
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
113 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
114 movel _SDL_MintAudio_audiosize,d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
115
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
116 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
117 lsll #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
118 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
119 movel a0@(d0:l),a1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
120
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
121 lea a1@(d1:l),a2
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
122
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
123 movel a2,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
124 movel a1,sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
125 clrw sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
126 movew #131,sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
127 trap #14
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
128 lea sp@(12),sp
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
129
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
130 /* Restore registers space */
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
131 addl #savamt,savptr
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
132
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
133 moveml sp@+,d0-d7/a0-a6
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
134
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
135 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
136 SDL_MintAudio_XbiosEnd:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
137 rte
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
138
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
139 /*--- DMA 8 bits interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
140
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
141 _SDL_MintAudio_Dma8Interrupt:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
142
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
143 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
144 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
145
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
146 /* Clear service bit, so other MFP interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
147 bclr #5,0xfffffa0f:w
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
148
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
149 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
150 tstw _SDL_MintAudio_mutex
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
151 bne SDL_MintAudio_Dma8End
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
152 notw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
153
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
154 /* Swap buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
155 eorw #1,_SDL_MintAudio_numbuf
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
156
3864
ea2a327b92d7 Only saved non preserved registers
Patrice Mandin <patmandin@gmail.com>
parents: 1097
diff changeset
157 moveml d0-d1/a0-a1,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
158
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
159 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
160 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
161 beqs SDL_MintAudio_Dma8_nofpu1
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
162 fsave sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
163 fmoveml fpcr/fpsr/fpiar,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
164 fmovemx fp0-fp7,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
165 SDL_MintAudio_Dma8_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
166
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
167 /* Callback */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
168 jsr _SDL_MintAudio_Callback
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
169
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
170 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
171 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
172 beqs SDL_MintAudio_Dma8_nofpu2
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
173 fmovemx sp@+,fp0-fp7
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
174 fmoveml sp@+,fpcr/fpsr/fpiar
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
175 frestore sp@+
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
176 SDL_MintAudio_Dma8_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
177
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
178 /* Set new buffer */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
179
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
180 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
181
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
182 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
183 lslw #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
184 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
185 movel a0@(d0:w),d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
186
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
187 /* Modify DMA addresses */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
188 lea 0xffff8900:w,a0
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
189
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
190 moveb d1,a0@(0x07) /* Start address */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
191 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
192 moveb d1,a0@(0x05)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
193 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
194 moveb d1,a0@(0x03)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
195 swap d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
196
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
197 addl _SDL_MintAudio_audiosize,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
198
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
199 moveb d1,a0@(0x13) /* End address */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
200 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
201 moveb d1,a0@(0x11)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
202 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
203 moveb d1,a0@(0x0f)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
204
3864
ea2a327b92d7 Only saved non preserved registers
Patrice Mandin <patmandin@gmail.com>
parents: 1097
diff changeset
205 moveml sp@+,d0-d1/a0-a1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
206
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
207 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
208 SDL_MintAudio_Dma8End:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
209 rte
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
210
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
211 /*--- STFA interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
212
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
213 STFA_SOUND_START = 6
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
214 STFA_SOUND_END = STFA_SOUND_START+8
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
215
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
216 _SDL_MintAudio_StfaInterrupt:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
217
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
218 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
219 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
220
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
221 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
222 tstw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
223 bnes SDL_MintAudio_StfaEnd
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
224 notw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
225
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
226 /* Swap buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
227 eorw #1,_SDL_MintAudio_numbuf
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
228
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
229 moveml d0-d7/a0-a6,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
230
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
231 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
232 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
233 beqs SDL_MintAudio_Stfa_nofpu1
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
234 fsave sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
235 fmoveml fpcr/fpsr/fpiar,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
236 fmovemx fp0-fp7,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
237 SDL_MintAudio_Stfa_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
238
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
239 /* Callback */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
240 jsr _SDL_MintAudio_Callback
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
241
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
242 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
243 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
244 beqs SDL_MintAudio_Stfa_nofpu2
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
245 fmovemx sp@+,fp0-fp7
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
246 fmoveml sp@+,fpcr/fpsr/fpiar
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
247 frestore sp@+
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
248 SDL_MintAudio_Stfa_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
249
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
250 /* Set new buffer */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
251
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
252 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
253 movel _SDL_MintAudio_stfa,a1
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
254
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
255 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
256 lslw #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
257 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
258 movel a0@(d0:w),d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
259
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
260 /* Modify STFA replay buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
261 movel d1,a1@(STFA_SOUND_START)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
262 addl _SDL_MintAudio_audiosize,d1
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
263 movel d1,a1@(STFA_SOUND_END)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
264
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
265 moveml sp@+,d0-d7/a0-a6
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
266
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
267 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
268 SDL_MintAudio_StfaEnd:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
269 rte