2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 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
24 * IKBD 6301 interrupt routine
31 .globl _SDL_AtariIkbdInstall
32 .globl _SDL_AtariIkbdUninstall
34 .globl _SDL_AtariIkbd_keyboard
35 .globl _SDL_AtariIkbd_mouseb
36 .globl _SDL_AtariIkbd_mousex
37 .globl _SDL_AtariIkbd_mousey
38 .globl _SDL_AtariIkbd_joystick
40 .globl _SDL_AtariIkbd_enabled
42 /*--- Install our IKBD vector ---*/
44 _SDL_AtariIkbdInstall:
45 moveml d0-d1/a0-a1,sp@-
51 | Save MFP registers used for keyboard
61 movel 0x118:w,old_ikbd
63 bset #6,0xfffffa09:w | IERB
64 bset #6,0xfffffa15:w | IMRB
66 | Set mouse relative mode
76 movew #0xffff,_SDL_AtariIkbd_enabled
78 moveml sp@+,d0-d1/a0-a1
81 /*--- Uninstall our IKBD vector ---*/
83 _SDL_AtariIkbdUninstall:
90 | Restore previous MFP registers
102 beqs ikbd_restoreimrb
106 movel old_ikbd,0x118:w
108 | Clear keyboard buffer
118 | Reenable interrupts
131 /*--- Our custom IKBD vector ---*/
139 | Check if source is IKBD or MIDI
144 moveb 0xfffffc02:w,d0
149 beqs ikbd_yes_joystick
158 | Mouse packet, byte #1
162 movew d0,_SDL_AtariIkbd_mouseb
164 movel #ikbd_mousex,0x118:w
165 bras ikbd_endit_stack
167 | Joystick packet, byte #1
170 movel #ikbd_joystick,0x118:w
171 bras ikbd_endit_stack
173 | Keyboard press/release
177 lea _SDL_AtariIkbd_keyboard,a0
190 | Call old MIDI interrupt
196 | Mouse packet, byte #2
200 | Check if source is IKBD or MIDI
206 moveb 0xfffffc02:w,d0
208 addw d0,_SDL_AtariIkbd_mousex
212 movel #ikbd_mousey,0x118:w
215 | Mouse packet, byte #3
219 | Check if source is IKBD or MIDI
225 moveb 0xfffffc02:w,d0
227 addw d0,_SDL_AtariIkbd_mousey
234 | Joystick packet, byte #2
238 | Check if source is IKBD or MIDI
242 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1
250 _SDL_AtariIkbd_enabled:
256 .comm _SDL_AtariIkbd_keyboard,128
257 .comm _SDL_AtariIkbd_mousex,2
258 .comm _SDL_AtariIkbd_mousey,2
259 .comm _SDL_AtariIkbd_mouseb,2
260 .comm _SDL_AtariIkbd_joystick,2