2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #define _vbl_queue 0x456
34 .globl _SDL_AtariVblInstall
35 .globl _SDL_AtariVblUninstall
37 .globl _SDL_MintAudio_hasfpu
39 /*--- Save/restore FPU context ---*/
41 #if defined(__mcoldfire__)
43 #define SAVE_FPU_CONTEXT \
50 #define RESTORE_FPU_CONTEXT \
51 fmovemd sp@,fp0-fp7; \
59 #define SAVE_FPU_CONTEXT \
62 fmoveml fpcr/fpsr/fpiar,sp@-; \
63 fmovemx fp0-fp7,sp@-; \
66 #define RESTORE_FPU_CONTEXT \
68 fmovemx sp@+,fp0-fp7; \
69 fmoveml sp@+,fpcr/fpsr/fpiar; \
75 /*--- Vector installer ---*/
78 #if defined(__mcoldfire__)
82 movel sp@(4),my_vector
88 #if defined(__mcoldfire__)
90 movel d0, _SDL_Atari_hz200
92 movel _hz_200.w, _SDL_Atari_hz200
99 /* Read vbl_queue pointer */
100 movel _vbl_queue.w,a1
102 /* Search a free place */
108 #if defined(__mcoldfire__)
110 bpls bcl_search_place
112 dbra d0,bcl_search_place
119 /* Then install ourselves */
125 /* Restart interrupts */
130 /*--- Vector uninstaller ---*/
132 _SDL_AtariVblUninstall:
139 /* Stop interrupts */
143 /* Read vbl_queue pointer */
144 movel _vbl_queue.w,a1
146 /* Search where we are */
155 #if defined(__mcoldfire__)
157 bpls bcl_search_place
159 dbra d1,bcl2_search_place
162 /* Restart interrupts */
170 #if defined(__mcoldfire__)
172 moveml d0-d7/a0-a6,sp@
174 moveml d0-d7/a0-a6,sp@-
178 #if defined(__mcoldfire__)
180 movel d0, _SDL_Atari_hz200
182 movel _hz_200.w, _SDL_Atari_hz200
185 /* Verify if this is not already running */
189 #if defined(__mcoldfire__)
197 /* Save FPU if needed */
198 tstw _SDL_MintAudio_hasfpu
199 beqs SDL_AtariVbl_nofpu1
206 /* Restore FPU if needed */
207 tstw _SDL_MintAudio_hasfpu
208 beqs SDL_AtariVbl_Xbios_nofpu2
210 SDL_AtariVbl_Xbios_nofpu2:
214 #if defined(__mcoldfire__)
215 moveml sp@,d0-d7/a0-a6
218 moveml sp@+,d0-d7/a0-a6
224 .comm _SDL_Atari_hz200,4*1