annotate src/video/ataricommon/SDL_ikbdinterrupt.S @ 1287:15a89a0c52bf

Date: Tue, 15 Feb 2005 21:28:48 +0900 (JST) From: "Michael Leonhard" Subject: [SDL] resize bug on Win32 and patch This is my first post to this mailing list. In this email I will detail a bug in the behavior of resizable SDL windows on Win32. Then I will explain the solution and provide a patch. Symptoms: Under Windows, an SDL display created with the SDL_RESIZABLE flag exhibits quirky behavior when being maximized. The window is resized to the proper size, but it is shifted upwards about half the height of the title bar. Similarly, a window whose origin is above the top of the screen will spontaneously move its upper-left origin upon being resized. After two such resize-induced moves, the title bar will be entirely off the top edge of the screen. Subsequently, when the mouse is clicked and released on the window border, the window will shrink its height spontaneously. This height shrinkage occurs even if the user did not resize the border. To observe this curious situation, please invoke: SDL-1.2.8/test/testwm.exe -resize Cause: A pair of integers, SDL_windowX and SDL_windowY, are defined in video/wincommon/SDL_sysevents.c. They are used by the DirectX video driver and the DIB video driver: video/windx5/SDL_dx5video.c video/windib/SDL_dibvideo.c As I understand the source code, the primary use of these variables is to create a rectangle that represents the surface area in CLIENT SPACE. Client space refers to a coordinate system that originates at the upper left corner of a Win32 Window's drawable area. This is just inside the window border and title bar. This client space rectangle, called bounds, is subsequently converted to screen space with a call to AdjustWindowRectEx. The problem is found in SDL's handling of the WM_WINDOWPOSCHANGED message. According to MSDN, "The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function." I have confirmed that this message is indeed being sent to the SDL window when the mouse is clicked on the window border, even if the window border is not dragged. In video/wincommon/SDL_sysevents.c, on line 464, in response to the WM_WINDOWPOSCHANGED message, the (potentially) new client rectangle is obtained. This rectangle is translated into screen coordinates and THEN assigned to the SDL_windowX and Y variables. Thus screen coordinates are being assigned to client coordinate variables. Once this is understood, the solution is apparent: assign SDL_windowX and Y before translating the rectangle to screen coordinates. This is accomplished by the following patch. -Mike_L
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Jan 2006 08:50:06 +0000
parents b6fdf299a2f3
children c9b51268668f
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
297
f6ffac90895c Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents: 287
diff changeset
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 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
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
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
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
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
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Library General Public License for more details.
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 #ifdef SAVE_RCSID
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 static char rcsid =
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 "@(#) $Id$";
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #endif
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 * IKBD 6301 interrupt routine
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 * Patrice Mandin
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 */
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 .text
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 .globl _SDL_AtariIkbdInstall
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 .globl _SDL_AtariIkbdUninstall
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 .globl _SDL_AtariIkbd_keyboard
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 .globl _SDL_AtariIkbd_mouseb
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 .globl _SDL_AtariIkbd_mousex
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 .globl _SDL_AtariIkbd_mousey
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 .globl _SDL_AtariIkbd_joystick
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
45 .globl _SDL_AtariIkbd_enabled
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
46
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 /*--- Install our IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 _SDL_AtariIkbdInstall:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 moveml d0-d1/a0-a1,sp@-
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)
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
60 sne ikbd_ierb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 btst #6,a0@(0x15)
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
62 sne ikbd_imrb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 | Set our routine
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 movel 0x118:w,old_ikbd
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 movel #ikbd,0x118:w
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 bset #6,0xfffffa09:w | IERB
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 bset #6,0xfffffa15:w | IMRB
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
71 | 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
72
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 moveb #8,0xfffffc02:w
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
75 | Reenable interrupts
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
76
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 movew #0x2300,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 | Interrupts done
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
81 movew #0xffff,_SDL_AtariIkbd_enabled
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
82
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 moveml sp@+,d0-d1/a0-a1
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 rts
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 /*--- Uninstall our IKBD vector ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 _SDL_AtariIkbdUninstall:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 movel a0,sp@-
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 | Disable interrupts
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 movew #0x2700,sr
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 | Restore previous MFP registers
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 lea 0xfffffa00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 bclr #6,a0@(0x09)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 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
101 beqs ikbd_restoreierb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 bset #6,a0@(0x09)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 ikbd_restoreierb:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 bclr #6,a0@(0x15)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 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
107 beqs ikbd_restoreimrb
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 bset #6,a0@(0x15)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 ikbd_restoreimrb:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 movel old_ikbd,0x118:w
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 | Clear keyboard buffer
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 lea 0xfffffc00:w,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 ikbd_videbuffer:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 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
118 beqs ikbd_finbuffer
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 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
120 bras ikbd_videbuffer
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 ikbd_finbuffer:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
123 | Reenable interrupts
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
124
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 movew #0x2300,sr
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 movel sp@+,a0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 rts
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
130 .bss
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
131
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 .even
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
133 .comm ikbd_ierb,1
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
134 .comm ikbd_imrb,1
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 /*--- Our custom IKBD vector ---*/
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 .text
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 .even
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 .ascii "XBRA"
287
e4bd0cf95506 From: Patrice Mandin <pmandin@caramail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 281
diff changeset
141 .ascii "LSDL"
e4bd0cf95506 From: Patrice Mandin <pmandin@caramail.com>
Sam Lantinga <slouken@libsdl.org>
parents: 281
diff changeset
142 .comm old_ikbd,4*1
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 ikbd:
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
144 | Check if source is IKBD or MIDI
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
145 btst #0,0xfffffc00.w
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
146 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
147
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 moveml d0-d1/a0,sp@-
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
151 | Joystick packet ?
281
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 cmpb #0xff,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
154 beqs ikbd_yes_joystick
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
156 | Mouse packet ?
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 cmpb #0xf8,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
159 bmis ikbd_no_mouse
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 cmpb #0xfc,d0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
161 bpls ikbd_no_mouse
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
163 | 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
164
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 ikbd_yes_mouse:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 andw #3,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 movew d0,_SDL_AtariIkbd_mouseb
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 movel #ikbd_mousex,0x118:w
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
170 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
172 | 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
173
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 ikbd_yes_joystick:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 movel #ikbd_joystick,0x118:w
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
176 bras ikbd_endit_stack
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
178 | Keyboard press/release
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
179
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 ikbd_no_mouse:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 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
182 lea _SDL_AtariIkbd_keyboard,a0
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
183 andw #0x7f,d1
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
184 tas d0
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
185 spl a0@(0,d1:w)
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
186
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
187 | End of interrupt
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
189 ikbd_endit_stack:
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
190 moveml sp@+,d0-d1/a0
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 ikbd_endit:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 bclr #6,0xfffffa11:w
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 rte
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
195 | Call old MIDI interrupt
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
196
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
197 ikbd_oldmidi:
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
198 movel old_ikbd,sp@-
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
199 rts
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
200
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
201 | 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
202
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 ikbd_mousex:
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
204
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
205 | Check if source is IKBD or MIDI
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
206 btst #0,0xfffffc00.w
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
207 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
208
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
209 movew d0,sp@-
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 extw d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 addw d0,_SDL_AtariIkbd_mousex
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
215 movew sp@+,d0
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 movel #ikbd_mousey,0x118:w
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
218 bras ikbd_endit
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
220 | 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
221
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 ikbd_mousey:
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
223
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
224 | Check if source is IKBD or MIDI
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
225 btst #0,0xfffffc00.w
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
226 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
227
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
228 movew d0,sp@-
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 moveb 0xfffffc02:w,d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 extw d0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 addw d0,_SDL_AtariIkbd_mousey
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
234 movew sp@+,d0
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 movel #ikbd,0x118:w
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
237 bras ikbd_endit
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
239 | 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
240
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 ikbd_joystick:
1082
48436ffdf677 Avoid generating multiple key press/release messages for the same key
Patrice Mandin <patmandin@gmail.com>
parents: 1081
diff changeset
242
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
243 | Check if source is IKBD or MIDI
1110
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
244 btst #0,0xfffffc00.w
b6fdf299a2f3 Revert back to 1.6 revision
Patrice Mandin <patmandin@gmail.com>
parents: 1109
diff changeset
245 beqs ikbd_oldmidi
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
246
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 moveb 0xfffffc02:w,_SDL_AtariIkbd_joystick+1
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 movel #ikbd,0x118:w
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
250 bras ikbd_endit
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 .data
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 .even
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
255 _SDL_AtariIkbd_enabled:
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
256 .word 0
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
257
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
258 .bss
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
259
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
260 .even
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 .comm _SDL_AtariIkbd_keyboard,128
1081
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
262 .comm _SDL_AtariIkbd_mousex,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
263 .comm _SDL_AtariIkbd_mousey,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
264 .comm _SDL_AtariIkbd_mouseb,2
369dcdb52d70 Call old interrupt when receiving MIDI stuff
Patrice Mandin <patmandin@gmail.com>
parents: 305
diff changeset
265 .comm _SDL_AtariIkbd_joystick,2