annotate src/video/ataricommon/SDL_ikbdinterrupt.S @ 4392:2b8c1aea633b SDL-1.2

Fixed bug #898 Jeremiah Morris 2009-12-09 16:07:17 PST No-op GlobalToLocal translations in fullscreen mode On my MacBook Pro running 10.6, I noticed a small upward bias on mouse movement in a fullscreen SDL application. The app uses WarpCursor and GetMouseState in a loop to measure relative movement. I tracked it down to NSWindow's convertBaseToScreen: routine, which added a 2-pixel offset on the Y coordinate instead of the expected (+0,+0) translation. In fullscreen mode, QZ_PrivateWarpCursor() does not translate the desired position through QZ_PrivateGlobalToLocal() before passing it to the Core Graphics system. However, QZ_GetMouseLocation() does call the reverse QZ_PrivateLocalToGlobal() even in fullscreen mode. This asymmetry caused problems each time the mouse was moved.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 11 Dec 2009 15:31:37 +0000
parents dae8891fae2d
children
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
4377
c92927bd421a Oops. Forgot a change for Coldfire.
Patrice Mandin <patmandin@gmail.com>
parents: 4376
diff changeset
81 moveql #6,d0
c92927bd421a Oops. Forgot a change for Coldfire.
Patrice Mandin <patmandin@gmail.com>
parents: 4376
diff changeset
82 bset d0,0xfffffa09:w | IERB
c92927bd421a Oops. Forgot a change for Coldfire.
Patrice Mandin <patmandin@gmail.com>
parents: 4376
diff changeset
83 bset d0,0xfffffa15:w | IMRB
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
84 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 movel 0x118:w,old_ikbd
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 movel #ikbd,0x118:w
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 bset #6,0xfffffa09:w | IERB
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 bset #6,0xfffffa15:w | IMRB
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
89 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
91 | 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
92
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
93 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
94 moveql #8,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
95 moveb d0,0xfffffc02:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
96 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 moveb #8,0xfffffc02:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
98 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
100 | Reenable interrupts
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
101
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 movew #0x2300,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 | Interrupts done
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
106 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
107 movel #0xffff,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
108 movew d0,_SDL_AtariIkbd_enabled
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
109
4377
c92927bd421a Oops. Forgot a change for Coldfire.
Patrice Mandin <patmandin@gmail.com>
parents: 4376
diff changeset
110 moveml sp@,d0-d1/a0-a1
c92927bd421a Oops. Forgot a change for Coldfire.
Patrice Mandin <patmandin@gmail.com>
parents: 4376
diff changeset
111 lea sp@(16),sp
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
112 #else
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
113 movew #0xffff,_SDL_AtariIkbd_enabled
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
114
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 moveml sp@+,d0-d1/a0-a1
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
116 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 rts
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 /*--- Uninstall our IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 _SDL_AtariIkbdUninstall:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 movel a0,sp@-
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
124 | Disable interrupts
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 movew #0x2700,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 | Restore previous MFP registers
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 lea 0xfffffa00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 bclr #6,a0@(0x09)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 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
134 beqs ikbd_restoreierb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 bset #6,a0@(0x09)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 ikbd_restoreierb:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 bclr #6,a0@(0x15)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 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
140 beqs ikbd_restoreimrb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 bset #6,a0@(0x15)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 ikbd_restoreimrb:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
144 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
145 movel old_ikbd,a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
146 movel a0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
147 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 movel old_ikbd,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
149 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 | Clear keyboard buffer
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 lea 0xfffffc00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 ikbd_videbuffer:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 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
156 beqs ikbd_finbuffer
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 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
158 bras ikbd_videbuffer
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 ikbd_finbuffer:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
161 | Reenable interrupts
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
162
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 movew #0x2300,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 movel sp@+,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 rts
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
168 .bss
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
169
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 .even
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
171 .comm ikbd_ierb,1
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
172 .comm ikbd_imrb,1
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 /*--- Our custom IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 .text
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 .even
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 .ascii "XBRA"
287
e4bd0cf95506 From: Patrice Mandin <pmandin@caramail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 281
diff changeset
179 .ascii "LSDL"
e4bd0cf95506 From: Patrice Mandin <pmandin@caramail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 281
diff changeset
180 .comm old_ikbd,4*1
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 ikbd:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
182 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
183 lea sp@(-12),sp
4378
dae8891fae2d Damn. Need to be more careful with stack stuff.
Patrice Mandin <patmandin@gmail.com>
parents: 4377
diff changeset
184 moveml d0-d1/a0,sp@
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
185 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
186 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
187 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
188
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
189 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
190 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
191 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
192 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
193 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
194 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
195 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
196 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
197
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
200 | Joystick packet ?
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 cmpb #0xff,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
203 beqs ikbd_yes_joystick
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
205 | Mouse packet ?
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 cmpb #0xf8,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
208 bmis ikbd_no_mouse
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 cmpb #0xfc,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
210 bpls ikbd_no_mouse
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
212 | 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
213
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 ikbd_yes_mouse:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
215 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
216 andl #3,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
217 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 andw #3,d0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
219 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 movew d0,_SDL_AtariIkbd_mouseb
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
222 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
223 movel #ikbd_mousex,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
224 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
225 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 movel #ikbd_mousex,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
227 #endif
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
228 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
230 | 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
231
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 ikbd_yes_joystick:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
233 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
234 movel #ikbd_joystick,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
235 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
236 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 movel #ikbd_joystick,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
238 #endif
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
239 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
241 | Keyboard press/release
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
242
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 ikbd_no_mouse:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 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
245 lea _SDL_AtariIkbd_keyboard,a0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
246 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
247 andl #0x7f,d1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
248 btst #7,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
249 spl d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
250 moveb d0,a0@(0,d1:l)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
251 #else
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
252 andw #0x7f,d1
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
253 tas d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
254 spl a0@(0,d1:w)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
255 #endif
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
256
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
257 | End of interrupt
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
259 ikbd_endit_stack:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
260 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
261 moveql #6,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
262 bclr d0,0xfffffa11:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
263
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
264 moveml sp@,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
265 lea sp@(12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
266 #else
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
267 moveml sp@+,d0-d1/a0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
268
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 bclr #6,0xfffffa11:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
270 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 rte
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
273 | Call old MIDI interrupt
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
274
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
275 ikbd_oldmidi:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
276 #if defined(__mcoldfire__)
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 lea sp@(12),sp
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
279 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
280 moveml sp@+,d0-d1/a0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
281 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
282
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
283 movel old_ikbd,sp@-
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
284 rts
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
285
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
286 | 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
287
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 ikbd_mousex:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
289 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
290 lea sp@(-12),sp
4378
dae8891fae2d Damn. Need to be more careful with stack stuff.
Patrice Mandin <patmandin@gmail.com>
parents: 4377
diff changeset
291 moveml d0-d1/a0,sp@
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
292 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
293 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
294 #endif
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
295
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
296 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
297 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
298 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
299 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
300 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
301 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
302 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
303 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
304
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 extw d0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
307 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
308 movew _SDL_AtariIkbd_mousex,d1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
309 addl d1,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
310 movew d0,_SDL_AtariIkbd_mousex
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
311
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
312 movel #ikbd_mousey,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
313 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
314 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 addw d0,_SDL_AtariIkbd_mousex
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317 movel #ikbd_mousey,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
318 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
319 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
321 | 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
322
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 ikbd_mousey:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
324 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
325 lea sp@(-12),sp
4378
dae8891fae2d Damn. Need to be more careful with stack stuff.
Patrice Mandin <patmandin@gmail.com>
parents: 4377
diff changeset
326 moveml d0-d1/a0,sp@
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
327 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
328 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
329 #endif
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
330
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
331 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
332 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
333 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
334 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
335 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
336 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
337 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
338 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
339
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 extw d0
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
342 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
343 movew _SDL_AtariIkbd_mousey,d1
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
344 addl d1,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
345 movew d0,_SDL_AtariIkbd_mousey
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
346
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
347 movel #ikbd,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
348 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
349 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350 addw d0,_SDL_AtariIkbd_mousey
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 movel #ikbd,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
353 #endif
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
354 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
356 | 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
357
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 ikbd_joystick:
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
359 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
360 lea sp@(-12),sp
4378
dae8891fae2d Damn. Need to be more careful with stack stuff.
Patrice Mandin <patmandin@gmail.com>
parents: 4377
diff changeset
361 moveml d0-d1/a0,sp@
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
362 #else
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
363 moveml d0-d1/a0,sp@-
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
364 #endif
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
365
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
366 | Check if source is IKBD or MIDI
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
367 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
368 moveql #0,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
369 btst d0,0xfffffc00.w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
370 #else
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
371 btst #0,0xfffffc00.w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
372 #endif
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
373 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
374
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
375 #if defined(__mcoldfire__)
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
376 moveb 0xfffffc02:w,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
377 moveb d0,_SDL_AtariIkbd_joystick+1
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 movel #ikbd,d0
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
380 movel d0,0x118:w
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
381
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
382 bra ikbd_endit_stack
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
383 #else
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386 movel #ikbd,0x118:w
4376
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
387
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
388 bras ikbd_endit_stack
40e4536ad0c3 Adapt IKBD asm routine for Coldfire
Patrice Mandin <patmandin@gmail.com>
parents: 4159
diff changeset
389 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 .data
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 .even
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
394 _SDL_AtariIkbd_enabled:
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
395 .word 0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
396
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
397 .bss
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
398
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
399 .even
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 .comm _SDL_AtariIkbd_keyboard,128
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
401 .comm _SDL_AtariIkbd_mousex,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
402 .comm _SDL_AtariIkbd_mousey,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
403 .comm _SDL_AtariIkbd_mouseb,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
404 .comm _SDL_AtariIkbd_joystick,2