comparison src/audio/mint/SDL_mintaudiointerrupt.S @ 398:d219b0e02f5f

Added Atari audio support (thanks Patrice!)
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jun 2002 20:42:53 +0000
parents
children 1338c24e30cb
comparison
equal deleted inserted replaced
397:283d348cb624 398:d219b0e02f5f
1 /*
2 * Audio interrupt routines
3 *
4 * Patrice Mandin
5 */
6
7 .text
8
9 .globl _SDL_MintAudio_Callback
10
11 .globl _SDL_MintAudio_IntDma
12 .globl _SDL_MintAudio_IntXbios
13 .globl _SDL_MintAudio_IntGsxb
14
15 .globl _SDL_MintAudio_mutex
16 .globl _SDL_MintAudio_audiobuf
17 .globl _SDL_MintAudio_numbuf
18 .globl _SDL_MintAudio_audiosize
19
20 /*
21 How it works:
22 - Audio is playing buffer #0 (resp. #1)
23 - We must calculate a sample in buffer #1 (resp. #0)
24 so we first call the callback to do it
25 - Then we swap the buffers
26 */
27
28 /*--- DMA 8 bits interrupt vector ---*/
29
30 .text
31 _SDL_MintAudio_IntDma:
32
33 /* Check if we are not already running */
34 tstw _SDL_MintAudio_mutex
35 bnes intdma_end
36 notw _SDL_MintAudio_mutex
37
38 /* Reenable interrupts */
39 movew #0x2300,sr
40
41 /* Swap buffers */
42 moveml d0-d1/a0-a1,sp@-
43
44 movel _SDL_MintAudio_numbuf,d0
45 movel _SDL_MintAudio_audiobuf,d1
46 eorl #1,d0
47 beqs intdma_buffer0
48 movel _SDL_MintAudio_audiobuf+4,d1
49 intdma_buffer0:
50 movel d0,_SDL_MintAudio_numbuf
51
52 /* Callback */
53 movel d1,sp@-
54 jsr _SDL_MintAudio_Callback
55 movel sp@+,d1
56
57 /* Modify DMA addresses */
58 lea 0xffff8900:w,a0
59
60 moveb d1,a0@(0x07) /* Start address */
61 rorl #8,d1
62 moveb d1,a0@(0x05)
63 rorl #8,d1
64 moveb d1,a0@(0x03)
65 swap d1
66
67 addl _SDL_MintAudio_audiosize,d1
68
69 moveb d1,a0@(0x13) /* End address */
70 rorl #8,d1
71 moveb d1,a0@(0x11)
72 rorl #8,d1
73 moveb d1,a0@(0x0f)
74
75 moveml sp@+,d0-d1/a0-a1
76
77 clrw _SDL_MintAudio_mutex
78 intdma_end:
79 bclr #5,0xfffffa0f:w
80 rte
81
82 /*--- Xbios interrupt vector ---*/
83
84 .text
85 _SDL_MintAudio_IntXbios:
86
87 /* Check if we are not already running */
88 tstw _SDL_MintAudio_mutex
89 bnes intxbios_end
90 notw _SDL_MintAudio_mutex
91
92 /* Reenable interrupts */
93 movew #0x2300,sr
94
95 /* Swap buffers */
96 moveml d0-d2/a0-a2,sp@-
97
98 movel _SDL_MintAudio_numbuf,d0
99 movel _SDL_MintAudio_audiobuf,a0
100 eorl #1,d0
101 beqs intxbios_buffer0
102 movel _SDL_MintAudio_audiobuf+4,a0
103 intxbios_buffer0:
104 movel d0,_SDL_MintAudio_numbuf
105
106 /* Callback */
107 moveml a0,sp@-
108 jsr _SDL_MintAudio_Callback
109 moveml sp@+,a0
110
111 /* Setbuffer xbios function */
112 movel _SDL_MintAudio_audiosize,d1
113 lea a0@(0,d1:l),a1
114
115 movel a1,sp@-
116 movel a0,sp@-
117 clrw sp@-
118 movew #131,sp@-
119 trap #14
120 lea sp@(12),sp
121
122 moveml sp@+,d0-d2/a0-a2
123
124 clrw _SDL_MintAudio_mutex
125 intxbios_end:
126 bclr #5,0xfffffa0f:w
127 rte
128
129 /*--- GSXB interrupt vector ---*/
130
131 .text
132 _SDL_MintAudio_IntGsxb:
133
134 /* Check if we are not already running */
135 tstw _SDL_MintAudio_mutex
136 bnes intgsxb_end
137 notw _SDL_MintAudio_mutex
138
139 /* Swap buffers */
140 moveml d0-d2/a0-a2,sp@-
141
142 movel _SDL_MintAudio_numbuf,d0
143 movel _SDL_MintAudio_audiobuf,a0
144 eorl #1,d0
145 beqs intgsxb_buffer0
146 movel _SDL_MintAudio_audiobuf+4,a0
147 intgsxb_buffer0:
148 movel d0,_SDL_MintAudio_numbuf
149
150 /* Callback */
151 moveml a0,sp@-
152 jsr _SDL_MintAudio_Callback
153 moveml sp@+,a0
154
155 /* Setbuffer xbios function */
156 movel _SDL_MintAudio_audiosize,d1
157 lea a0@(0,d1:l),a1
158
159 movel a1,sp@-
160 movel a0,sp@-
161 clrw sp@-
162 movew #131,sp@-
163 trap #14
164 lea sp@(12),sp
165
166 moveml sp@+,d0-d2/a0-a2
167
168 clrw _SDL_MintAudio_mutex
169 intgsxb_end:
170 rts
171
172 /*--- Common variables ---*/
173
174 .data
175 .even
176 .comm _SDL_MintAudio_mutex,4
177 .even
178 .comm _SDL_MintAudio_audiobuf,8
179 .even
180 .comm _SDL_MintAudio_numbuf,4
181 .even
182 .comm _SDL_MintAudio_audiosize,4
183