annotate src/audio/mint/SDL_mintaudio_it.S @ 4380:66aea42c3541 SDL-1.2

Adapt audio interrupts for Coldfire
author Patrice Mandin <patmandin@gmail.com>
date Sat, 07 Nov 2009 20:45:45 +0000
parents a1b03ba2fcd0
children
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
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 3867
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
644
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
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
58 /*--- Save/restore FPU context ---*/
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
59
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
60 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
61
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
62 #define SAVE_FPU_CONTEXT \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
63 lea sp@(-216),sp; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
64 fsave sp@; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
65 fmovel fpiar,sp@-; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
66 lea sp@(-64),sp; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
67 fmovemd fp0-fp7,sp@
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
68
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
69 #define RESTORE_FPU_CONTEXT \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
70 fmovemd sp@,fp0-fp7; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
71 lea sp@(64),sp; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
72 fmovel sp@+,fpiar; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
73 frestore sp@; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
74 lea sp@(216),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
75
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
76 #else
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
77
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
78 #define SAVE_FPU_CONTEXT \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
79 .chip 68k/68881; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
80 fsave sp@-; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
81 fmoveml fpcr/fpsr/fpiar,sp@-; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
82 fmovemx fp0-fp7,sp@-; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
83 .chip 68k
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
84
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
85 #define RESTORE_FPU_CONTEXT \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
86 .chip 68k/68881; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
87 fmovemx sp@+,fp0-fp7; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
88 fmoveml sp@+,fpcr/fpsr/fpiar; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
89 frestore sp@+; \
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
90 .chip 68k
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
91
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
92 #endif
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
93
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
94 /*--- 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
95
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
96 _SDL_MintAudio_XbiosInterruptMeasureClock: /* 1 mS */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
97 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
98 movel d0,sp@-
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
99
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
100 moveql #0,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
101 btst d0,0xFFFF8901:w /* state DMA sound */
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
102 #else
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
103 btst #0,0xFFFF8901:w /* state DMA sound */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
104 #endif
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
105 beqs SDL_MintAudio_EndIntMeasure
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
106 addql #1,_SDL_MintAudio_clocktics
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
107 SDL_MintAudio_EndIntMeasure:
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
108 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
109 moveql #5,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
110 bclr d0,0xFFFFFA0F:w /* Clear service bit */
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
111
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
112 movel sp@+,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
113 #else
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
114 bclr #5,0xFFFFFA0F:w /* Clear service bit */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
115 #endif
961
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
116 rte
185acc07127a Date: Fri, 29 Oct 2004 11:47:09 +0200
Patrice Mandin <patmandin@gmail.com>
parents: 704
diff changeset
117
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
118 /*--- Xbios interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
119
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
120 _SDL_MintAudio_XbiosInterrupt:
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
121 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
122 lea sp@(-60),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
123 moveml d0-d7/a0-a6,sp@
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
124 #else
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
125 moveml d0-d7/a0-a6,sp@-
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
126 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
127
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
128 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
129 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
130
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
131 /* Clear service bit, so other MFP interrupts can work */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
132 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
133 moveql #5,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
134 bclr d0,0xfffffa0f:w
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
135 #else
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
136 bclr #5,0xfffffa0f:w
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
137 #endif
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 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
140 tstw _SDL_MintAudio_mutex
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
141 bne SDL_MintAudio_XbiosEnd
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
142
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
143 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
144 movew _SDL_MintAudio_mutex,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
145 notl d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
146 movew d0,_SDL_MintAudio_mutex
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
147
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
148 movew _SDL_MintAudio_numbuf,d1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
149 eorl #1,d1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
150 movew d1,_SDL_MintAudio_numbuf
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
151 #else
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
152 notw _SDL_MintAudio_mutex
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
153
644
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
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
156 #endif
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
157
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
158 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
159 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
160 beqs SDL_MintAudio_Xbios_nofpu1
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
161 SAVE_FPU_CONTEXT
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
162 SDL_MintAudio_Xbios_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
163
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
164 /* Callback */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
165 jsr _SDL_MintAudio_Callback
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
166
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
167 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
168 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
169 beqs SDL_MintAudio_Xbios_nofpu2
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
170 RESTORE_FPU_CONTEXT
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
171 SDL_MintAudio_Xbios_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
172
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
173 /* Reserve space for registers */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
174 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
175 movel #savamt,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
176 subl d0,savptr
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
177 #else
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
178 subl #savamt,savptr
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
179 #endif
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
180
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
181 /* Set new buffer */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
182
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
183 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
184 movel _SDL_MintAudio_audiosize,d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
185
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
186 movew _SDL_MintAudio_numbuf,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
187 lsll #2,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
188 lea _SDL_MintAudio_audiobuf,a0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
189 movel a0@(d0:l),a1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
190
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
191 lea a1@(d1:l),a2
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
192
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
193 movel a2,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
194 movel a1,sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
195 clrw sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
196 movew #131,sp@-
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
197 trap #14
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
198 lea sp@(12),sp
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
199
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
200 /* Restore registers space */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
201 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
202 movel #savamt,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
203 addl d0,savptr
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
204 #else
1096
37b766becf3b Reserve space in system buffer to call XBIOS from interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 1093
diff changeset
205 addl #savamt,savptr
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
206 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
207
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
208 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
209 SDL_MintAudio_XbiosEnd:
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
210 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
211 moveml sp@,d0-d7/a0-a6
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
212 lea sp@(60),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
213 #else
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
214 moveml sp@+,d0-d7/a0-a6
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
215 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
216 rte
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 /*--- DMA 8 bits interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
219
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
220 _SDL_MintAudio_Dma8Interrupt:
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
221 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
222 lea sp@(-16),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
223 moveml d0-d1/a0-a1,sp@
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
224 #else
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
225 moveml d0-d1/a0-a1,sp@-
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
226 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
227
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
228 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
229 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
230
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
231 /* Clear service bit, so other MFP interrupts can work */
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
232 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
233 moveql #5,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
234 bclr d0,0xfffffa0f:w
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
235 #else
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
236 bclr #5,0xfffffa0f:w
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
237 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
238 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
239 tstw _SDL_MintAudio_mutex
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
240 bne SDL_MintAudio_Dma8End
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
241
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
242 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
243 movew _SDL_MintAudio_mutex,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
244 notl d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
245 movew d0,_SDL_MintAudio_mutex
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
246
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
247 movew _SDL_MintAudio_numbuf,d1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
248 eorl #1,d1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
249 movew d1,_SDL_MintAudio_numbuf
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
250 #else
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
251 notw _SDL_MintAudio_mutex
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
252
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
253 /* Swap buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
254 eorw #1,_SDL_MintAudio_numbuf
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
255 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
256
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
257 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
258 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
259 beqs SDL_MintAudio_Dma8_nofpu1
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
260 SAVE_FPU_CONTEXT
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
261 SDL_MintAudio_Dma8_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
262
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
263 /* Callback */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
264 jsr _SDL_MintAudio_Callback
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
265
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
266 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
267 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
268 beqs SDL_MintAudio_Dma8_nofpu2
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
269 RESTORE_FPU_CONTEXT
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
270 SDL_MintAudio_Dma8_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
271
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
272 /* Set new buffer */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
273
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
274 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
275
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
276 movew _SDL_MintAudio_numbuf,d0
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
277 lsll #2,d0
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
278 lea _SDL_MintAudio_audiobuf,a0
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
279 movel a0@(d0:l),d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
280
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
281 /* Modify DMA addresses */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
282 lea 0xffff8900:w,a0
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
283
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
284 movel d1,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
285
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
286 moveb d0,a0@(0x07) /* Start address */
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
287 lsrl #8,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
288 moveb d0,a0@(0x05)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
289 lsrl #8,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
290 moveb d0,a0@(0x03)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
291
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
292 addl _SDL_MintAudio_audiosize,d1
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
293
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
294 movel d1,d0
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
295
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
296 moveb d0,a0@(0x13) /* End address */
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
297 lsrl #8,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
298 moveb d0,a0@(0x11)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
299 lsrl #8,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
300 moveb d0,a0@(0x0f)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
301
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
302 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
303 SDL_MintAudio_Dma8End:
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
304 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
305 moveml sp@,d0-d1/a0-a1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
306 lea sp@(16),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
307 #else
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
308 moveml sp@+,d0-d1/a0-a1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
309 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
310 rte
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
311
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
312 /*--- STFA interrupt vector ---*/
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
313
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
314 STFA_SOUND_START = 6
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
315 STFA_SOUND_END = STFA_SOUND_START+8
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
316
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
317 _SDL_MintAudio_StfaInterrupt:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
318 /* Reenable interrupts, so other interrupts can work */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
319 movew #0x2300,sr
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
320
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
321 /* Check if we are not already running */
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
322 tstw _SDL_MintAudio_mutex
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
323
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
324 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
325 bne SDL_MintAudio_StfaEnd
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
326
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
327 lea sp@(-60),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
328 moveml d0-d7/a0-a6,sp@
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
329
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
330 movew _SDL_MintAudio_mutex,d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
331 notl d0
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
332 movew d0,_SDL_MintAudio_mutex
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
333
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
334 movew _SDL_MintAudio_numbuf,d1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
335 eorl #1,d1
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
336 movew d1,_SDL_MintAudio_numbuf
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
337 #else
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
338 bnes SDL_MintAudio_StfaEnd
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
339
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
340 moveml d0-d7/a0-a6,sp@-
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
341
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
342 notw _SDL_MintAudio_mutex
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
343
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
344 /* Swap buffers */
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
345 eorw #1,_SDL_MintAudio_numbuf
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
346 #endif
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
347
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
348 /* Save FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
349 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
350 beqs SDL_MintAudio_Stfa_nofpu1
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
351 SAVE_FPU_CONTEXT
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
352 SDL_MintAudio_Stfa_nofpu1:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
353
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
354 /* Callback */
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
355 jsr _SDL_MintAudio_Callback
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
356
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
357 /* Restore FPU if needed */
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
358 tstw _SDL_MintAudio_hasfpu
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
359 beqs SDL_MintAudio_Stfa_nofpu2
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
360 RESTORE_FPU_CONTEXT
3866
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
361 SDL_MintAudio_Stfa_nofpu2:
afbcf97a5dd9 Save/restore fpu registers if needed
Patrice Mandin <patmandin@gmail.com>
parents: 3864
diff changeset
362
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
363 /* Set new buffer */
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
364
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
365 moveq #0,d0
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
366 movel _SDL_MintAudio_stfa,a1
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
367
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
368 movew _SDL_MintAudio_numbuf,d0
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
369 lsll #2,d0
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
370 lea _SDL_MintAudio_audiobuf,a0
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
371 movel a0@(d0:l),d1
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
372
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
373 /* Modify STFA replay buffers */
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
374 movel d1,a1@(STFA_SOUND_START)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
375 addl _SDL_MintAudio_audiosize,d1
704
c4803992e09c Small bugfixes
Patrice Mandin <patmandin@gmail.com>
parents: 644
diff changeset
376 movel d1,a1@(STFA_SOUND_END)
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
377
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
378 #if defined(__mcoldfire__)
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
379 moveml sp@,d0-d7/a0-a6
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
380 lea sp@(60),sp
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
381 #else
1093
d00b4d8508ab Save all registers on interrupt
Patrice Mandin <patmandin@gmail.com>
parents: 961
diff changeset
382 moveml sp@+,d0-d7/a0-a6
4380
66aea42c3541 Adapt audio interrupts for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
383 #endif
644
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
384 clrw _SDL_MintAudio_mutex
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
385 SDL_MintAudio_StfaEnd:
594422ab8f9f Atari MiNT: added more audio drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
386 rte