annotate src/audio/mint/SDL_mintaudio_it.S @ 3906:e3bf970d9494 SDL-1.2

Updated svn repository
author Sam Lantinga <slouken@libsdl.org>
date Tue, 23 Jan 2007 04:47:11 +0000
parents 4dae257a9cbf
children a1b03ba2fcd0
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
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
92 .chip 68060
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
93 fsave sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
94 fmoveml fpcr/fpsr/fpiar,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
95 fmovemx fp0-fp7,sp@-
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
96 .chip 68000
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
97 SDL_MintAudio_Xbios_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
98
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
99 /* Callback */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
100 jsr _SDL_MintAudio_Callback
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
101
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
102 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
103 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
104 beqs SDL_MintAudio_Xbios_nofpu2
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
105 .chip 68060
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
106 fmovemx sp@+,fp0-fp7
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
107 fmoveml sp@+,fpcr/fpsr/fpiar
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
108 frestore sp@+
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
109 .chip 68000
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
110 SDL_MintAudio_Xbios_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
111
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
112 /* Reserve space for registers */
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
113 subl #savamt,savptr
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
114
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
115 /* Set new buffer */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
116
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
117 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
118 movel _SDL_MintAudio_audiosize,d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
119
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
120 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
121 lsll #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
122 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
123 movel a0@(d0:l),a1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
124
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
125 lea a1@(d1:l),a2
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
126
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
127 movel a2,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
128 movel a1,sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
129 clrw sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
130 movew #131,sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
131 trap #14
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
132 lea sp@(12),sp
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
133
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
134 /* Restore registers space */
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
135 addl #savamt,savptr
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
136
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
137 moveml sp@+,d0-d7/a0-a6
644
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 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
140 SDL_MintAudio_XbiosEnd:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
141 rte
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 /*--- DMA 8 bits interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
144
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
145 _SDL_MintAudio_Dma8Interrupt:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
146
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
147 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
148 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
149
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
150 /* Clear service bit, so other MFP interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
151 bclr #5,0xfffffa0f:w
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
152
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
153 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
154 tstw _SDL_MintAudio_mutex
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
155 bne SDL_MintAudio_Dma8End
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
156 notw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
157
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
158 /* Swap buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
159 eorw #1,_SDL_MintAudio_numbuf
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
160
3864
ea2a327b92d7 Only saved non preserved registers
Patrice Mandin <patmandin@gmail.com>
parents: 1097
diff changeset
161 moveml d0-d1/a0-a1,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
162
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
163 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
164 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
165 beqs SDL_MintAudio_Dma8_nofpu1
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
166 .chip 68060
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
167 fsave sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
168 fmoveml fpcr/fpsr/fpiar,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
169 fmovemx fp0-fp7,sp@-
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
170 .chip 68000
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
171 SDL_MintAudio_Dma8_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
172
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
173 /* Callback */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
174 jsr _SDL_MintAudio_Callback
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
175
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
176 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
177 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
178 beqs SDL_MintAudio_Dma8_nofpu2
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
179 .chip 68060
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
180 fmovemx sp@+,fp0-fp7
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
181 fmoveml sp@+,fpcr/fpsr/fpiar
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
182 frestore sp@+
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
183 .chip 68000
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
184 SDL_MintAudio_Dma8_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
185
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
186 /* Set new buffer */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
187
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
188 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
189
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
190 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
191 lslw #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
192 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
193 movel a0@(d0:w),d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
194
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
195 /* Modify DMA addresses */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
196 lea 0xffff8900:w,a0
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
197
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
198 moveb d1,a0@(0x07) /* Start address */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
199 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
200 moveb d1,a0@(0x05)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
201 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
202 moveb d1,a0@(0x03)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
203 swap d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
204
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
205 addl _SDL_MintAudio_audiosize,d1
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 moveb d1,a0@(0x13) /* End address */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
208 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
209 moveb d1,a0@(0x11)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
210 rorl #8,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
211 moveb d1,a0@(0x0f)
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
212
3864
ea2a327b92d7 Only saved non preserved registers
Patrice Mandin <patmandin@gmail.com>
parents: 1097
diff changeset
213 moveml sp@+,d0-d1/a0-a1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
214
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
215 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
216 SDL_MintAudio_Dma8End:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
217 rte
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
218
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
219 /*--- STFA interrupt vector ---*/
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 STFA_SOUND_START = 6
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
222 STFA_SOUND_END = STFA_SOUND_START+8
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
223
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
224 _SDL_MintAudio_StfaInterrupt:
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 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
227 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
228
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
229 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
230 tstw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
231 bnes SDL_MintAudio_StfaEnd
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
232 notw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
233
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
234 /* Swap buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
235 eorw #1,_SDL_MintAudio_numbuf
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
236
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
237 moveml d0-d7/a0-a6,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
238
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
239 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
240 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
241 beqs SDL_MintAudio_Stfa_nofpu1
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
242 .chip 68060
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
243 fsave sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
244 fmoveml fpcr/fpsr/fpiar,sp@-
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
245 fmovemx fp0-fp7,sp@-
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
246 .chip 68000
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
247 SDL_MintAudio_Stfa_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
248
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
249 /* Callback */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
250 jsr _SDL_MintAudio_Callback
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
251
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
252 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
253 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
254 beqs SDL_MintAudio_Stfa_nofpu2
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
255 .chip 68060
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
256 fmovemx sp@+,fp0-fp7
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
257 fmoveml sp@+,fpcr/fpsr/fpiar
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
258 frestore sp@+
3867
4dae257a9cbf Forgot cpu boundaries
Patrice Mandin <patmandin@gmail.com>
parents: 3866
diff changeset
259 .chip 68000
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
260 SDL_MintAudio_Stfa_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
261
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
262 /* Set new buffer */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
263
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
264 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
265 movel _SDL_MintAudio_stfa,a1
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
266
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
267 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
268 lslw #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
269 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
270 movel a0@(d0:w),d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
271
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
272 /* Modify STFA replay buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
273 movel d1,a1@(STFA_SOUND_START)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
274 addl _SDL_MintAudio_audiosize,d1
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
275 movel d1,a1@(STFA_SOUND_END)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
276
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
277 moveml sp@+,d0-d7/a0-a6
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
278
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
279 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
280 SDL_MintAudio_StfaEnd:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
281 rte