annotate 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
rev   line source
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1110
diff changeset
6 modify it under the terms of the GNU Lesser General Public
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1110
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1110
diff changeset
13 Lesser General Public License for more details.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1110
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1110
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1110
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 * IKBD 6301 interrupt routine
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 *
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 * Patrice Mandin
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 .text
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 .globl _SDL_AtariIkbdInstall
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 .globl _SDL_AtariIkbdUninstall
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 .globl _SDL_AtariIkbd_keyboard
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 .globl _SDL_AtariIkbd_mouseb
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 .globl _SDL_AtariIkbd_mousex
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 .globl _SDL_AtariIkbd_mousey
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 .globl _SDL_AtariIkbd_joystick
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
40 .globl _SDL_AtariIkbd_enabled
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
41
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 /*--- Install our IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 _SDL_AtariIkbdInstall:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
45 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
46 lea sp@(-16),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
47 moveml d0-d1/a0-a1,sp@
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
48 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 moveml d0-d1/a0-a1,sp@-
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
50 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
52 | Disable interrupts
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 movew #0x2700,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 | Save MFP registers used for keyboard
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 lea 0xfffffa00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 btst #6,a0@(0x09)
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
60 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
61 sne d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
62 move.b d0,ikbd_ierb
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
63 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
64 sne ikbd_ierb
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
65 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 btst #6,a0@(0x15)
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
67 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
68 sne d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
69 move.b d0,ikbd_imrb
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
70 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
71 sne ikbd_imrb
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
72 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 | Set our routine
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
76 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
77 movel 0x118:w,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
78 movel d0,old_ikbd
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
79 lea ikbd,a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
80 movel a0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
81 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 movel 0x118:w,old_ikbd
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 movel #ikbd,0x118:w
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 bset #6,0xfffffa09:w | IERB
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 bset #6,0xfffffa15:w | IMRB
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
86 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
88 | Set mouse relative mode
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
89
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
90 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
91 moveql #8,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
92 moveb d0,0xfffffc02:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
93 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 moveb #8,0xfffffc02:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
95 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
97 | Reenable interrupts
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
98
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 movew #0x2300,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 | Interrupts done
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
103 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
104 movel #0xffff,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
105 movew d0,_SDL_AtariIkbd_enabled
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
106
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
107 moveml sp@,d0-d1/a0-a1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
108 lea sp@(16),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
109 #else
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
110 movew #0xffff,_SDL_AtariIkbd_enabled
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
111
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 moveml sp@+,d0-d1/a0-a1
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
113 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 rts
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 /*--- Uninstall our IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 _SDL_AtariIkbdUninstall:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 movel a0,sp@-
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
121 | Disable interrupts
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 movew #0x2700,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 | Restore previous MFP registers
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 lea 0xfffffa00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 bclr #6,a0@(0x09)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 tstb ikbd_ierb
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
131 beqs ikbd_restoreierb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 bset #6,a0@(0x09)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 ikbd_restoreierb:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 bclr #6,a0@(0x15)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 tstb ikbd_imrb
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
137 beqs ikbd_restoreimrb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 bset #6,a0@(0x15)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 ikbd_restoreimrb:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
141 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
142 movel old_ikbd,a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
143 movel a0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
144 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 movel old_ikbd,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
146 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 | Clear keyboard buffer
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 lea 0xfffffc00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 ikbd_videbuffer:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 btst #0,a0@
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
153 beqs ikbd_finbuffer
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 tstb a0@(0x02)
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
155 bras ikbd_videbuffer
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 ikbd_finbuffer:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
158 | Reenable interrupts
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
159
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 movew #0x2300,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 movel sp@+,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 rts
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
165 .bss
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
166
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 .even
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
168 .comm ikbd_ierb,1
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
169 .comm ikbd_imrb,1
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 /*--- Our custom IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 .text
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 .even
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 .ascii "XBRA"
287
e4bd0cf95506 From: Patrice Mandin <pmandin@caramail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 281
diff changeset
176 .ascii "LSDL"
e4bd0cf95506 From: Patrice Mandin <pmandin@caramail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 281
diff changeset
177 .comm old_ikbd,4*1
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 ikbd:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
179 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
180 lea sp@(-12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
181 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
182 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
183 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
184 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
185
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
186 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
187 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
188 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
189 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
190 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
191 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
192 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
193 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
194
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
197 | Joystick packet ?
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 cmpb #0xff,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
200 beqs ikbd_yes_joystick
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
202 | Mouse packet ?
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 cmpb #0xf8,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
205 bmis ikbd_no_mouse
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 cmpb #0xfc,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
207 bpls ikbd_no_mouse
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
209 | Mouse packet, byte #1
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
210
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 ikbd_yes_mouse:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
212 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
213 andl #3,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
214 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 andw #3,d0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
216 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 movew d0,_SDL_AtariIkbd_mouseb
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
219 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
220 movel #ikbd_mousex,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
221 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
222 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 movel #ikbd_mousex,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
224 #endif
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
225 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
227 | Joystick packet, byte #1
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
228
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229 ikbd_yes_joystick:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
230 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
231 movel #ikbd_joystick,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
232 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
233 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 movel #ikbd_joystick,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
235 #endif
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
236 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
238 | Keyboard press/release
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
239
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 ikbd_no_mouse:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 moveb d0,d1
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
242 lea _SDL_AtariIkbd_keyboard,a0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
243 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
244 andl #0x7f,d1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
245 btst #7,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
246 spl d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
247 moveb d0,a0@(0,d1:l)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
248 #else
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
249 andw #0x7f,d1
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
250 tas d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
251 spl a0@(0,d1:w)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
252 #endif
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
253
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
254 | End of interrupt
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
256 ikbd_endit_stack:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
257 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
258 moveql #6,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
259 bclr d0,0xfffffa11:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
260
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
261 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
262 lea sp@(12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
263 #else
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
264 moveml sp@+,d0-d1/a0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
265
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 bclr #6,0xfffffa11:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
267 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 rte
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
270 | Call old MIDI interrupt
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
271
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
272 ikbd_oldmidi:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
273 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
274 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
275 lea sp@(12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
276 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
277 moveml sp@+,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
278 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
279
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
280 movel old_ikbd,sp@-
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
281 rts
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
282
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
283 | Mouse packet, byte #2
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
284
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 ikbd_mousex:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
286 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
287 lea sp@(-12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
288 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
289 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
290 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
291 #endif
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
292
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
293 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
294 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
295 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
296 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
297 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
298 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
299 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
300 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
301
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 extw d0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
304 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
305 movew _SDL_AtariIkbd_mousex,d1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
306 addl d1,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
307 movew d0,_SDL_AtariIkbd_mousex
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
308
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
309 movel #ikbd_mousey,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
310 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
311 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 addw d0,_SDL_AtariIkbd_mousex
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 movel #ikbd_mousey,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
315 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
316 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
318 | Mouse packet, byte #3
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
319
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 ikbd_mousey:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
321 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
322 lea sp@(-12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
323 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
324 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
325 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
326 #endif
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
327
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
328 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
329 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
330 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
331 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
332 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
333 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
334 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
335 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
336
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 extw d0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
339 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
340 movew _SDL_AtariIkbd_mousey,d1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
341 addl d1,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
342 movew d0,_SDL_AtariIkbd_mousey
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
343
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
344 movel #ikbd,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
345 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
346 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 addw d0,_SDL_AtariIkbd_mousey
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349 movel #ikbd,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
350 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
351 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
353 | Joystick packet, byte #2
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
354
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 ikbd_joystick:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
356 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
357 lea sp@(-12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
358 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
359 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
360 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
361 #endif
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
362
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
363 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
364 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
365 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
366 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
367 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
368 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
369 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
370 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
371
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
372 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
373 moveb 0xfffffc02:w,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
374 moveb d0,_SDL_AtariIkbd_joystick+1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
375
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
376 movel #ikbd,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
377 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
378
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
379 bra ikbd_endit_stack
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
380 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 movel #ikbd,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
384
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
385 bras ikbd_endit_stack
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
386 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 .data
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 .even
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
391 _SDL_AtariIkbd_enabled:
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
392 .word 0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
393
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
394 .bss
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
395
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
396 .even
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 .comm _SDL_AtariIkbd_keyboard,128
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
398 .comm _SDL_AtariIkbd_mousex,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
399 .comm _SDL_AtariIkbd_mousey,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
400 .comm _SDL_AtariIkbd_mouseb,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
401 .comm _SDL_AtariIkbd_joystick,2