comparison src/video/ataricommon/SDL_ikbdinterrupt.S @ 281:c5010ab8ba35

Added initial support for Atari (thanks Patrice!)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 17 Feb 2002 19:54:28 +0000
parents
children e4bd0cf95506
comparison
equal deleted inserted replaced
280:0ddcea45d829 281:c5010ab8ba35
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22
23 #ifdef SAVE_RCSID
24 static char rcsid =
25 "@(#) $Id$";
26 #endif
27
28 /*
29 * IKBD 6301 interrupt routine
30 *
31 * Patrice Mandin
32 */
33
34 .text
35
36 .globl _SDL_AtariIkbdInstall
37 .globl _SDL_AtariIkbdUninstall
38
39 .globl _SDL_AtariIkbd_keyboard
40 .globl _SDL_AtariIkbd_mouseb
41 .globl _SDL_AtariIkbd_mousex
42 .globl _SDL_AtariIkbd_mousey
43 .globl _SDL_AtariIkbd_joystick
44
45 /*--- Install our IKBD vector ---*/
46
47 _SDL_AtariIkbdInstall:
48 moveml d0-d1/a0-a1,sp@-
49
50 | Init interrupts
51
52 movew #0x2700,sr
53
54 | Save MFP registers used for keyboard
55
56 lea 0xfffffa00:w,a0
57 btst #6,a0@(0x09)
58 sne ikbd_ierb
59 btst #6,a0@(0x15)
60 sne ikbd_imrb
61
62 | Set our routine
63
64 movel 0x118:w,old_ikbd
65 movel #ikbd,0x118:w
66 bset #6,0xfffffa09:w | IERB
67 bset #6,0xfffffa15:w | IMRB
68
69 moveb #8,0xfffffc02:w
70
71 movew #0x2300,sr
72
73 | Interrupts done
74
75 moveml sp@+,d0-d1/a0-a1
76 rts
77
78 /*--- Uninstall our IKBD vector ---*/
79
80 _SDL_AtariIkbdUninstall:
81 movel a0,sp@-
82
83 | Stop interrupt
84
85 movew #0x2700,sr
86
87 | Restore previous MFP registers
88
89 lea 0xfffffa00:w,a0
90
91 bclr #6,a0@(0x09)
92 tstb ikbd_ierb
93 beq ikbd_restoreierb
94 bset #6,a0@(0x09)
95 ikbd_restoreierb:
96
97 bclr #6,a0@(0x15)
98 tstb ikbd_imrb
99 beq ikbd_restoreimrb
100 bset #6,a0@(0x15)
101 ikbd_restoreimrb:
102
103 movel old_ikbd,0x118:w
104
105 | Clear keyboard buffer
106
107 lea 0xfffffc00:w,a0
108 ikbd_videbuffer:
109 btst #0,a0@
110 beq ikbd_finbuffer
111 tstb a0@(0x02)
112 bra ikbd_videbuffer
113 ikbd_finbuffer:
114
115 movew #0x2300,sr
116
117 movel sp@+,a0
118 rts
119
120 .data
121 .even
122 .comm old_ikbd,4*1
123 .even
124 .comm ikbd_ierb,4*1
125 .even
126 .comm ikbd_imrb,4*1
127
128 /*--- Our custom IKBD vector ---*/
129
130 .text
131 .even
132 .ascii "XBRA"
133 .ascii "_SDL"
134 ikbd:
135 moveml d0-d1/a0,sp@-
136 moveb 0xfffffc02:w,d0
137
138 | paquet joystick ?
139
140 cmpb #0xff,d0
141 beq ikbd_yes_joystick
142
143 | paquet souris ?
144
145 cmpb #0xf8,d0
146 bmi ikbd_no_mouse
147 cmpb #0xfc,d0
148 bpl ikbd_no_mouse
149
150 ikbd_yes_mouse:
151 andw #3,d0
152 movew d0,_SDL_AtariIkbd_mouseb
153
154 movel #ikbd_mousex,0x118:w
155 bra ikbd_endit
156
157 ikbd_yes_joystick:
158 movel #ikbd_joystick,0x118:w
159 bra ikbd_endit
160
161 ikbd_no_mouse:
162 moveb d0,d1
163 lea _SDL_AtariIkbd_keyboard,a0
164 andl #0x7f,d1
165 tas d0
166 spl a0@(0,d1:w)
167 ikbd_fin:
168
169 | Fin interruption
170
171 ikbd_endit:
172 moveml sp@+,d0-d1/a0
173 bclr #6,0xfffffa11:w
174 rte
175
176 ikbd_mousex:
177 movel d0,sp@-
178
179 moveb 0xfffffc02:w,d0
180 extw d0
181 addw d0,_SDL_AtariIkbd_mousex
182
183 movel sp@+,d0
184
185 movel #ikbd_mousey,0x118:w
186 bclr #6,0xfffffa11:w
187 rte
188
189 ikbd_mousey:
190 movel d0,sp@-
191
192 moveb 0xfffffc02:w,d0
193 extw d0
194 addw d0,_SDL_AtariIkbd_mousey
195
196 movel sp@+,d0
197
198 movel #ikbd,0x118:w
199 bclr #6,0xfffffa11:w
200 rte
201
202 ikbd_joystick:
203 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1
204
205 movel #ikbd,0x118:w
206 bclr #6,0xfffffa11:w
207 rte
208
209 .data
210
211 .even
212 .comm _SDL_AtariIkbd_keyboard,128
213 .even
214 .comm _SDL_AtariIkbd_mousex,2*1
215 .even
216 .comm _SDL_AtariIkbd_mousey,2*1
217 .even
218 .comm _SDL_AtariIkbd_mouseb,2*1
219 .even
220 .comm _SDL_AtariIkbd_joystick,2*1