Mercurial > sdl-ios-xcode
comparison src/video/ataricommon/SDL_ikbdinterrupt.S @ 4376:40e4536ad0c3 SDL-1.2
Adapt IKBD asm routine for Coldfire
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Fri, 06 Nov 2009 22:32:16 +0000 |
parents | a1b03ba2fcd0 |
children | c92927bd421a |
comparison
equal
deleted
inserted
replaced
4375:a52047c790a2 | 4376:40e4536ad0c3 |
---|---|
40 .globl _SDL_AtariIkbd_enabled | 40 .globl _SDL_AtariIkbd_enabled |
41 | 41 |
42 /*--- Install our IKBD vector ---*/ | 42 /*--- Install our IKBD vector ---*/ |
43 | 43 |
44 _SDL_AtariIkbdInstall: | 44 _SDL_AtariIkbdInstall: |
45 #if defined(__mcoldfire__) | |
46 lea sp@(-16),sp | |
47 moveml d0-d1/a0-a1,sp@ | |
48 #else | |
45 moveml d0-d1/a0-a1,sp@- | 49 moveml d0-d1/a0-a1,sp@- |
50 #endif | |
46 | 51 |
47 | Disable interrupts | 52 | Disable interrupts |
48 | 53 |
49 movew #0x2700,sr | 54 movew #0x2700,sr |
50 | 55 |
51 | Save MFP registers used for keyboard | 56 | Save MFP registers used for keyboard |
52 | 57 |
53 lea 0xfffffa00:w,a0 | 58 lea 0xfffffa00:w,a0 |
54 btst #6,a0@(0x09) | 59 btst #6,a0@(0x09) |
55 sne ikbd_ierb | 60 #if defined(__mcoldfire__) |
61 sne d0 | |
62 move.b d0,ikbd_ierb | |
63 #else | |
64 sne ikbd_ierb | |
65 #endif | |
56 btst #6,a0@(0x15) | 66 btst #6,a0@(0x15) |
57 sne ikbd_imrb | 67 #if defined(__mcoldfire__) |
68 sne d0 | |
69 move.b d0,ikbd_imrb | |
70 #else | |
71 sne ikbd_imrb | |
72 #endif | |
58 | 73 |
59 | Set our routine | 74 | Set our routine |
60 | 75 |
76 #if defined(__mcoldfire__) | |
77 movel 0x118:w,d0 | |
78 movel d0,old_ikbd | |
79 lea ikbd,a0 | |
80 movel a0,0x118:w | |
81 #else | |
61 movel 0x118:w,old_ikbd | 82 movel 0x118:w,old_ikbd |
62 movel #ikbd,0x118:w | 83 movel #ikbd,0x118:w |
63 bset #6,0xfffffa09:w | IERB | 84 bset #6,0xfffffa09:w | IERB |
64 bset #6,0xfffffa15:w | IMRB | 85 bset #6,0xfffffa15:w | IMRB |
86 #endif | |
65 | 87 |
66 | Set mouse relative mode | 88 | Set mouse relative mode |
67 | 89 |
90 #if defined(__mcoldfire__) | |
91 moveql #8,d0 | |
92 moveb d0,0xfffffc02:w | |
93 #else | |
68 moveb #8,0xfffffc02:w | 94 moveb #8,0xfffffc02:w |
95 #endif | |
69 | 96 |
70 | Reenable interrupts | 97 | Reenable interrupts |
71 | 98 |
72 movew #0x2300,sr | 99 movew #0x2300,sr |
73 | 100 |
74 | Interrupts done | 101 | Interrupts done |
75 | 102 |
103 #if defined(__mcoldfire__) | |
104 movel #0xffff,d0 | |
105 movew d0,_SDL_AtariIkbd_enabled | |
106 | |
107 moveml sp@,d0-d1/a0-a1 | |
108 lea sp@(16),sp | |
109 #else | |
76 movew #0xffff,_SDL_AtariIkbd_enabled | 110 movew #0xffff,_SDL_AtariIkbd_enabled |
77 | 111 |
78 moveml sp@+,d0-d1/a0-a1 | 112 moveml sp@+,d0-d1/a0-a1 |
113 #endif | |
79 rts | 114 rts |
80 | 115 |
81 /*--- Uninstall our IKBD vector ---*/ | 116 /*--- Uninstall our IKBD vector ---*/ |
82 | 117 |
83 _SDL_AtariIkbdUninstall: | 118 _SDL_AtariIkbdUninstall: |
101 tstb ikbd_imrb | 136 tstb ikbd_imrb |
102 beqs ikbd_restoreimrb | 137 beqs ikbd_restoreimrb |
103 bset #6,a0@(0x15) | 138 bset #6,a0@(0x15) |
104 ikbd_restoreimrb: | 139 ikbd_restoreimrb: |
105 | 140 |
141 #if defined(__mcoldfire__) | |
142 movel old_ikbd,a0 | |
143 movel a0,0x118:w | |
144 #else | |
106 movel old_ikbd,0x118:w | 145 movel old_ikbd,0x118:w |
146 #endif | |
107 | 147 |
108 | Clear keyboard buffer | 148 | Clear keyboard buffer |
109 | 149 |
110 lea 0xfffffc00:w,a0 | 150 lea 0xfffffc00:w,a0 |
111 ikbd_videbuffer: | 151 ikbd_videbuffer: |
134 .even | 174 .even |
135 .ascii "XBRA" | 175 .ascii "XBRA" |
136 .ascii "LSDL" | 176 .ascii "LSDL" |
137 .comm old_ikbd,4*1 | 177 .comm old_ikbd,4*1 |
138 ikbd: | 178 ikbd: |
179 #if defined(__mcoldfire__) | |
180 lea sp@(-12),sp | |
181 moveml sp@,d0-d1/a0 | |
182 #else | |
183 moveml d0-d1/a0,sp@- | |
184 #endif | |
185 | |
139 | Check if source is IKBD or MIDI | 186 | Check if source is IKBD or MIDI |
187 #if defined(__mcoldfire__) | |
188 moveql #0,d0 | |
189 btst d0,0xfffffc00.w | |
190 #else | |
140 btst #0,0xfffffc00.w | 191 btst #0,0xfffffc00.w |
192 #endif | |
141 beqs ikbd_oldmidi | 193 beqs ikbd_oldmidi |
142 | 194 |
143 moveml d0-d1/a0,sp@- | |
144 moveb 0xfffffc02:w,d0 | 195 moveb 0xfffffc02:w,d0 |
145 | 196 |
146 | Joystick packet ? | 197 | Joystick packet ? |
147 | 198 |
148 cmpb #0xff,d0 | 199 cmpb #0xff,d0 |
156 bpls ikbd_no_mouse | 207 bpls ikbd_no_mouse |
157 | 208 |
158 | Mouse packet, byte #1 | 209 | Mouse packet, byte #1 |
159 | 210 |
160 ikbd_yes_mouse: | 211 ikbd_yes_mouse: |
212 #if defined(__mcoldfire__) | |
213 andl #3,d0 | |
214 #else | |
161 andw #3,d0 | 215 andw #3,d0 |
216 #endif | |
162 movew d0,_SDL_AtariIkbd_mouseb | 217 movew d0,_SDL_AtariIkbd_mouseb |
163 | 218 |
219 #if defined(__mcoldfire__) | |
220 movel #ikbd_mousex,d0 | |
221 movel d0,0x118:w | |
222 #else | |
164 movel #ikbd_mousex,0x118:w | 223 movel #ikbd_mousex,0x118:w |
224 #endif | |
165 bras ikbd_endit_stack | 225 bras ikbd_endit_stack |
166 | 226 |
167 | Joystick packet, byte #1 | 227 | Joystick packet, byte #1 |
168 | 228 |
169 ikbd_yes_joystick: | 229 ikbd_yes_joystick: |
230 #if defined(__mcoldfire__) | |
231 movel #ikbd_joystick,d0 | |
232 movel d0,0x118:w | |
233 #else | |
170 movel #ikbd_joystick,0x118:w | 234 movel #ikbd_joystick,0x118:w |
235 #endif | |
171 bras ikbd_endit_stack | 236 bras ikbd_endit_stack |
172 | 237 |
173 | Keyboard press/release | 238 | Keyboard press/release |
174 | 239 |
175 ikbd_no_mouse: | 240 ikbd_no_mouse: |
176 moveb d0,d1 | 241 moveb d0,d1 |
177 lea _SDL_AtariIkbd_keyboard,a0 | 242 lea _SDL_AtariIkbd_keyboard,a0 |
243 #if defined(__mcoldfire__) | |
244 andl #0x7f,d1 | |
245 btst #7,d0 | |
246 spl d0 | |
247 moveb d0,a0@(0,d1:l) | |
248 #else | |
178 andw #0x7f,d1 | 249 andw #0x7f,d1 |
179 tas d0 | 250 tas d0 |
180 spl a0@(0,d1:w) | 251 spl a0@(0,d1:w) |
252 #endif | |
181 | 253 |
182 | End of interrupt | 254 | End of interrupt |
183 | 255 |
184 ikbd_endit_stack: | 256 ikbd_endit_stack: |
257 #if defined(__mcoldfire__) | |
258 moveql #6,d0 | |
259 bclr d0,0xfffffa11:w | |
260 | |
261 moveml sp@,d0-d1/a0 | |
262 lea sp@(12),sp | |
263 #else | |
185 moveml sp@+,d0-d1/a0 | 264 moveml sp@+,d0-d1/a0 |
186 ikbd_endit: | 265 |
187 bclr #6,0xfffffa11:w | 266 bclr #6,0xfffffa11:w |
267 #endif | |
188 rte | 268 rte |
189 | 269 |
190 | Call old MIDI interrupt | 270 | Call old MIDI interrupt |
191 | 271 |
192 ikbd_oldmidi: | 272 ikbd_oldmidi: |
273 #if defined(__mcoldfire__) | |
274 moveml sp@,d0-d1/a0 | |
275 lea sp@(12),sp | |
276 #else | |
277 moveml sp@+,d0-d1/a0 | |
278 #endif | |
279 | |
193 movel old_ikbd,sp@- | 280 movel old_ikbd,sp@- |
194 rts | 281 rts |
195 | 282 |
196 | Mouse packet, byte #2 | 283 | Mouse packet, byte #2 |
197 | 284 |
198 ikbd_mousex: | 285 ikbd_mousex: |
286 #if defined(__mcoldfire__) | |
287 lea sp@(-12),sp | |
288 moveml sp@,d0-d1/a0 | |
289 #else | |
290 moveml d0-d1/a0,sp@- | |
291 #endif | |
199 | 292 |
200 | Check if source is IKBD or MIDI | 293 | Check if source is IKBD or MIDI |
294 #if defined(__mcoldfire__) | |
295 moveql #0,d0 | |
296 btst d0,0xfffffc00.w | |
297 #else | |
201 btst #0,0xfffffc00.w | 298 btst #0,0xfffffc00.w |
299 #endif | |
202 beqs ikbd_oldmidi | 300 beqs ikbd_oldmidi |
203 | |
204 movew d0,sp@- | |
205 | 301 |
206 moveb 0xfffffc02:w,d0 | 302 moveb 0xfffffc02:w,d0 |
207 extw d0 | 303 extw d0 |
304 #if defined(__mcoldfire__) | |
305 movew _SDL_AtariIkbd_mousex,d1 | |
306 addl d1,d0 | |
307 movew d0,_SDL_AtariIkbd_mousex | |
308 | |
309 movel #ikbd_mousey,d0 | |
310 movel d0,0x118:w | |
311 #else | |
208 addw d0,_SDL_AtariIkbd_mousex | 312 addw d0,_SDL_AtariIkbd_mousex |
209 | 313 |
210 movew sp@+,d0 | |
211 | |
212 movel #ikbd_mousey,0x118:w | 314 movel #ikbd_mousey,0x118:w |
213 bras ikbd_endit | 315 #endif |
316 bras ikbd_endit_stack | |
214 | 317 |
215 | Mouse packet, byte #3 | 318 | Mouse packet, byte #3 |
216 | 319 |
217 ikbd_mousey: | 320 ikbd_mousey: |
321 #if defined(__mcoldfire__) | |
322 lea sp@(-12),sp | |
323 moveml sp@,d0-d1/a0 | |
324 #else | |
325 moveml d0-d1/a0,sp@- | |
326 #endif | |
218 | 327 |
219 | Check if source is IKBD or MIDI | 328 | Check if source is IKBD or MIDI |
329 #if defined(__mcoldfire__) | |
330 moveql #0,d0 | |
331 btst d0,0xfffffc00.w | |
332 #else | |
220 btst #0,0xfffffc00.w | 333 btst #0,0xfffffc00.w |
334 #endif | |
221 beqs ikbd_oldmidi | 335 beqs ikbd_oldmidi |
222 | |
223 movew d0,sp@- | |
224 | 336 |
225 moveb 0xfffffc02:w,d0 | 337 moveb 0xfffffc02:w,d0 |
226 extw d0 | 338 extw d0 |
339 #if defined(__mcoldfire__) | |
340 movew _SDL_AtariIkbd_mousey,d1 | |
341 addl d1,d0 | |
342 movew d0,_SDL_AtariIkbd_mousey | |
343 | |
344 movel #ikbd,d0 | |
345 movel d0,0x118:w | |
346 #else | |
227 addw d0,_SDL_AtariIkbd_mousey | 347 addw d0,_SDL_AtariIkbd_mousey |
228 | 348 |
229 movew sp@+,d0 | |
230 | |
231 movel #ikbd,0x118:w | 349 movel #ikbd,0x118:w |
232 bras ikbd_endit | 350 #endif |
351 bras ikbd_endit_stack | |
233 | 352 |
234 | Joystick packet, byte #2 | 353 | Joystick packet, byte #2 |
235 | 354 |
236 ikbd_joystick: | 355 ikbd_joystick: |
356 #if defined(__mcoldfire__) | |
357 lea sp@(-12),sp | |
358 moveml sp@,d0-d1/a0 | |
359 #else | |
360 moveml d0-d1/a0,sp@- | |
361 #endif | |
237 | 362 |
238 | Check if source is IKBD or MIDI | 363 | Check if source is IKBD or MIDI |
364 #if defined(__mcoldfire__) | |
365 moveql #0,d0 | |
366 btst d0,0xfffffc00.w | |
367 #else | |
239 btst #0,0xfffffc00.w | 368 btst #0,0xfffffc00.w |
369 #endif | |
240 beqs ikbd_oldmidi | 370 beqs ikbd_oldmidi |
241 | 371 |
372 #if defined(__mcoldfire__) | |
373 moveb 0xfffffc02:w,d0 | |
374 moveb d0,_SDL_AtariIkbd_joystick+1 | |
375 | |
376 movel #ikbd,d0 | |
377 movel d0,0x118:w | |
378 | |
379 bra ikbd_endit_stack | |
380 #else | |
242 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1 | 381 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1 |
243 | 382 |
244 movel #ikbd,0x118:w | 383 movel #ikbd,0x118:w |
245 bras ikbd_endit | 384 |
385 bras ikbd_endit_stack | |
386 #endif | |
246 | 387 |
247 .data | 388 .data |
248 | 389 |
249 .even | 390 .even |
250 _SDL_AtariIkbd_enabled: | 391 _SDL_AtariIkbd_enabled: |