Atari port cleanups from Patrice
authorSam Lantinga <slouken@libsdl.org>
Sun, 10 Mar 2002 03:33:59 +0000
changeset 3059c6613983e85
parent 304 ec53caed9fb2
child 306 3879bed3395c
Atari port cleanups from Patrice
README.MiNT
src/joystick/mint/SDL_sysjoystick.c
src/video/ataricommon/Makefile.am
src/video/ataricommon/SDL_biosevents.c
src/video/ataricommon/SDL_gemdosevents.c
src/video/ataricommon/SDL_ikbdinterrupt.S
src/video/ataricommon/SDL_ikbdinterrupt_s.h
src/video/ataricommon/SDL_xbiosevents.c
src/video/ataricommon/SDL_xbiosevents_c.h
src/video/ataricommon/SDL_xbiosinterrupt.S
src/video/ataricommon/SDL_xbiosinterrupt_s.h
src/video/ataricommon/SDL_xbiosmouseevents.c
src/video/ataricommon/SDL_xbiosmouseevents_c.h
src/video/ataricommon/SDL_xbiosmouseinterrupt.S
src/video/ataricommon/SDL_xbiosmouseinterrupt_s.h
src/video/gem/SDL_gemvideo.c
     1.1 --- a/README.MiNT	Sun Mar 10 03:25:47 2002 +0000
     1.2 +++ b/README.MiNT	Sun Mar 10 03:33:59 2002 +0000
     1.3 @@ -59,9 +59,9 @@
     1.4  - Driver combinations:
     1.5  Video	Kbd	Mouse	Timer	Jstick	Joypads
     1.6  xbios	ikbd	ikbd	vbl	ikbd	hardware
     1.7 -xbios	gemdos	xbios	vbl	-	hardware
     1.8 -xbios	bios	xbios	vbl	-	hardware
     1.9 -gem	gem	gem	vbl	-	hardware
    1.10 +xbios	gemdos	xbios	vbl	xbios	hardware
    1.11 +xbios	bios	xbios	vbl	xbios	hardware
    1.12 +gem	gem	gem	vbl	xbios	hardware
    1.13  
    1.14  ==============================================================================
    1.15  V.  Environment variables:
    1.16 @@ -79,7 +79,8 @@
    1.17  	Use any of these strings in the environment variable to enable or
    1.18  	disable a joystick:
    1.19  
    1.20 -	'ikbd-joy1-[on|off]' for IKBD joystick on port 1
    1.21 +	'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access)
    1.22 +	'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access)
    1.23  	'porta-pad-[on|off]' for joypad on port A
    1.24  	'porta-joy0-[on|off]' for joystick 0 on port A
    1.25  	'porta-joy1-[on|off]' for joystick 1 on port A
    1.26 @@ -92,6 +93,7 @@
    1.27  
    1.28  	Default configuration is:
    1.29  		'ikbd-joy1-on' (if IKBD events driver enabled)
    1.30 +		'xbios-joy1-on' (if gemdos/bios/gem events driver enabled)
    1.31  		'porta-pad-on portb-pad-on' (if available on the machine)
    1.32  
    1.33  	port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
    1.34 @@ -99,7 +101,6 @@
    1.35  	a lightpen OR an analog paddle. You must disable joypad before
    1.36  	setting another controller.
    1.37  
    1.38 -	IKBD joystick only available when the IKBD events driver is enabled.
    1.39  	The second joystick port on IKBD is used by the mouse, so not usable.
    1.40  
    1.41  	Joypads are multibuttons controller (Atari Jaguar console-like).
     2.1 --- a/src/joystick/mint/SDL_sysjoystick.c	Sun Mar 10 03:25:47 2002 +0000
     2.2 +++ b/src/joystick/mint/SDL_sysjoystick.c	Sun Mar 10 03:33:59 2002 +0000
     2.3 @@ -31,6 +31,7 @@
     2.4   *	Patrice Mandin
     2.5   */
     2.6  
     2.7 +#include <stdio.h>
     2.8  #include <stdlib.h>
     2.9  #include <string.h>
    2.10  
    2.11 @@ -43,12 +44,15 @@
    2.12  #include "SDL_sysjoystick.h"
    2.13  #include "SDL_joystick_c.h"
    2.14  
    2.15 -#include "../video/ataricommon/SDL_ikbdinterrupt_s.h"
    2.16 +#include "SDL_ikbdinterrupt_s.h"
    2.17 +#include "SDL_xbiosevents_c.h"
    2.18 +#include "SDL_xbiosinterrupt_s.h"
    2.19  
    2.20  /*--- Const ---*/
    2.21  
    2.22  /* We can have:
    2.23 -	1 joystick on IKBD port 1 (port 0 is used by mouse)
    2.24 +	1 joystick on IKBD port 1, read via hardware I/O
    2.25 +      or same joystick on IKBD port 1, read via xbios
    2.26  	2 joypads on ports A,B
    2.27  	  or 4 joysticks on joypads ports A,B
    2.28  	  or 1 lightpen on joypad port A
    2.29 @@ -58,6 +62,7 @@
    2.30  
    2.31  enum {
    2.32  	IKBD_JOY1=0,
    2.33 +	XBIOS_JOY1,
    2.34  	PORTA_PAD,
    2.35  	PORTB_PAD,
    2.36  	PORTA_JOY0,
    2.37 @@ -116,6 +121,7 @@
    2.38  
    2.39  static atarijoy_t atarijoysticks[MAX_JOYSTICKS]={
    2.40  	{SDL_FALSE,"IKBD joystick port 1",0},
    2.41 +	{SDL_FALSE,"Xbios joystick port 1",0},
    2.42  	{SDL_FALSE,"Joypad port A",0},
    2.43  	{SDL_FALSE,"Joypad port B",0},
    2.44  	{SDL_FALSE,"Joystick 0 port A",0},
    2.45 @@ -132,11 +138,11 @@
    2.46  };
    2.47  
    2.48  static const int jp_buttons[JP_NUM_BUTTONS]={
    2.49 -	JP_KPMULT,	JP_KP7,		JP_KP4,		JP_KP1,
    2.50 -	JP_KP0,		JP_KP8,		JP_KP5,		JP_KP2,
    2.51 -	JP_KPNUM,	JP_KP9,		JP_KP6,		JP_KP3,
    2.52 -	JP_PAUSE,	JP_FIRE0,	JP_FIRE1,	JP_FIRE2,
    2.53 -	JP_OPTION
    2.54 +	JP_FIRE0,	JP_FIRE1,	JP_FIRE2,	JP_PAUSE,
    2.55 +	JP_OPTION,	JP_KPMULT,	JP_KPNUM,	JP_KP0,
    2.56 +	JP_KP1,		JP_KP2,		JP_KP3,		JP_KP4,
    2.57 +	JP_KP5,		JP_KP6,		JP_KP7,		JP_KP8,
    2.58 +	JP_KP9
    2.59  };
    2.60  
    2.61  static SDL_bool joypad_ports_enabled=SDL_FALSE;
    2.62 @@ -160,8 +166,6 @@
    2.63  	int i;
    2.64  	unsigned long cookie_mch;
    2.65  	const char *envr=getenv("SDL_JOYSTICK_ATARI");
    2.66 -	const char *env_evt=getenv("SDL_ATARI_EVENTSDRIVER");
    2.67 -	SDL_bool ikbd_enabled=SDL_FALSE;
    2.68  	
    2.69  #define TEST_JOY_ENABLED(env,idstring,num) \
    2.70  	if (strstr(env,idstring"-off")) { \
    2.71 @@ -179,28 +183,23 @@
    2.72  	/* Enable some default joysticks */
    2.73  	if ((cookie_mch == MCH_ST<<16) || ((cookie_mch>>16) == MCH_STE) ||
    2.74  		(cookie_mch == MCH_TT<<16) || (cookie_mch == MCH_F30<<16)) {
    2.75 -		ikbd_enabled=SDL_TRUE;
    2.76 -		if (env_evt) {
    2.77 -			if (!strcmp(env_evt,"ikbd")) {
    2.78 -				ikbd_enabled=SDL_FALSE;
    2.79 -			}
    2.80 -		}
    2.81 -		atarijoysticks[IKBD_JOY1].enabled=ikbd_enabled;
    2.82 +		atarijoysticks[IKBD_JOY1].enabled=(SDL_AtariIkbd_enabled!=0);
    2.83  	}
    2.84  	if ((cookie_mch == MCH_STE<<16) || (cookie_mch == MCH_F30<<16)) {
    2.85  		atarijoysticks[PORTA_PAD].enabled=SDL_TRUE;
    2.86  		atarijoysticks[PORTB_PAD].enabled=SDL_TRUE;
    2.87  	}
    2.88 +	if (!atarijoysticks[IKBD_JOY1].enabled) {
    2.89 +		atarijoysticks[XBIOS_JOY1].enabled=(SDL_AtariXbios_enabled!=0);
    2.90 +	}
    2.91  
    2.92  	/* Read environment for joysticks to enable */
    2.93  	if (envr) {
    2.94  		/* IKBD on any Atari, maybe clones */
    2.95  		if ((cookie_mch == MCH_ST<<16) || ((cookie_mch>>16) == MCH_STE) ||
    2.96  			(cookie_mch == MCH_TT<<16) || (cookie_mch == MCH_F30<<16)) {
    2.97 -			if (env_evt) {
    2.98 -				if (strcmp(env_evt,"ikbd")) {
    2.99 -					TEST_JOY_ENABLED(envr, "ikbd-joy1", IKBD_JOY1);
   2.100 -				}
   2.101 +			if (SDL_AtariIkbd_enabled!=0) {
   2.102 +				TEST_JOY_ENABLED(envr, "ikbd-joy1", IKBD_JOY1);
   2.103  			}
   2.104  		}
   2.105  		/* Joypads ports only on STE and Falcon */
   2.106 @@ -226,6 +225,12 @@
   2.107  				}
   2.108  			}
   2.109  		}
   2.110 +
   2.111 +		if (!atarijoysticks[IKBD_JOY1].enabled) {
   2.112 +			if (SDL_AtariXbios_enabled!=0) {
   2.113 +				TEST_JOY_ENABLED(envr, "xbios-joy1", XBIOS_JOY1);
   2.114 +			}
   2.115 +		}
   2.116  #if 0
   2.117  		/* Parallel port on any Atari, maybe clones */
   2.118  		if ((cookie_mch == MCH_ST<<16) || ((cookie_mch>>16) == MCH_STE) ||
   2.119 @@ -262,13 +267,15 @@
   2.120  	/* Return the nth'index' enabled atari joystick */
   2.121  	j=0;
   2.122  	for (i=0;i<MAX_JOYSTICKS;i++) {
   2.123 -		if (atarijoysticks[i].enabled) {
   2.124 -			if (j==index) {
   2.125 -				break;
   2.126 -			} else {
   2.127 -				j++;
   2.128 -			}
   2.129 +		if (!atarijoysticks[i].enabled) {
   2.130 +			continue;
   2.131  		}
   2.132 +
   2.133 +		if (j==index) {
   2.134 +			break;
   2.135 +		}
   2.136 +
   2.137 +		++j;
   2.138  	}
   2.139  	if (i==MAX_JOYSTICKS)
   2.140  		return -1;
   2.141 @@ -328,8 +335,17 @@
   2.142  
   2.143  	switch (numjoystick) {
   2.144  		case IKBD_JOY1:
   2.145 +		case XBIOS_JOY1:
   2.146  			{
   2.147 -				curstate = SDL_AtariIkbd_joystick & 0xff;
   2.148 +				curstate = 0;
   2.149 +
   2.150 +				if (numjoystick==IKBD_JOY1) {
   2.151 +					curstate = SDL_AtariIkbd_joystick & 0xff;
   2.152 +				}
   2.153 +				if (numjoystick==XBIOS_JOY1) {
   2.154 +					curstate = SDL_AtariXbios_joystick & 0xff;
   2.155 +				}
   2.156 +
   2.157  				if (curstate != prevstate) {
   2.158  					/* X axis */
   2.159  					if ((curstate & (IKBD_JOY_LEFT|IKBD_JOY_RIGHT)) != (prevstate & (IKBD_JOY_LEFT|IKBD_JOY_RIGHT))) {
   2.160 @@ -359,7 +375,7 @@
   2.161  						SDL_PrivateJoystickButton(joystick,0,SDL_RELEASED);
   2.162  					}
   2.163  				}
   2.164 -				atarijoysticks[IKBD_JOY1].prevstate = curstate;
   2.165 +				atarijoysticks[numjoystick].prevstate = curstate;
   2.166  			}
   2.167  			break;
   2.168  		case PORTA_PAD:
     3.1 --- a/src/video/ataricommon/Makefile.am	Sun Mar 10 03:25:47 2002 +0000
     3.2 +++ b/src/video/ataricommon/Makefile.am	Sun Mar 10 03:33:59 2002 +0000
     3.3 @@ -25,7 +25,7 @@
     3.4  	SDL_ikbdevents_c.h \
     3.5  	SDL_ikbdinterrupt.S	\
     3.6  	SDL_ikbdinterrupt_s.h \
     3.7 -	SDL_xbiosmouseevents.c \
     3.8 -	SDL_xbiosmouseevents_c.h \
     3.9 -	SDL_xbiosmouseinterrupt.S \
    3.10 -	SDL_xbiosmouseinterrupt_s.h
    3.11 +	SDL_xbiosevents.c \
    3.12 +	SDL_xbiosevents_c.h \
    3.13 +	SDL_xbiosinterrupt.S \
    3.14 +	SDL_xbiosinterrupt_s.h
     4.1 --- a/src/video/ataricommon/SDL_biosevents.c	Sun Mar 10 03:25:47 2002 +0000
     4.2 +++ b/src/video/ataricommon/SDL_biosevents.c	Sun Mar 10 03:33:59 2002 +0000
     4.3 @@ -41,7 +41,7 @@
     4.4  #include "SDL_events_c.h"
     4.5  
     4.6  #include "SDL_atarikeys.h"
     4.7 -#include "SDL_xbiosmouseevents_c.h"
     4.8 +#include "SDL_xbiosevents_c.h"
     4.9  
    4.10  /* To save state of keyboard */
    4.11  #define ATARIBIOS_MAXKEYS 128
    4.12 @@ -104,7 +104,7 @@
    4.13  	keymap[SCANCODE_LEFTALT] = SDLK_LALT;
    4.14  	keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
    4.15  
    4.16 -	AtariXbios_InstallMouseVector();
    4.17 +	SDL_AtariXbios_InstallVectors(ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS);
    4.18  }
    4.19  
    4.20  void AtariBios_PumpEvents(_THIS)
    4.21 @@ -142,7 +142,7 @@
    4.22  			SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, bios_currentascii[i], &keysym));
    4.23  	}
    4.24  
    4.25 -	AtariXbios_PostMouseEvents(this);
    4.26 +	SDL_AtariXbios_PostMouseEvents(this);
    4.27  
    4.28  	/* Will be previous table */
    4.29  	memcpy(bios_previouskeyboard, bios_currentkeyboard, ATARIBIOS_MAXKEYS);
    4.30 @@ -183,5 +183,5 @@
    4.31  
    4.32  void AtariBios_ShutdownEvents(void)
    4.33  {
    4.34 -	AtariXbios_RestoreMouseVector();
    4.35 +	SDL_AtariXbios_RestoreVectors();
    4.36  }
     5.1 --- a/src/video/ataricommon/SDL_gemdosevents.c	Sun Mar 10 03:25:47 2002 +0000
     5.2 +++ b/src/video/ataricommon/SDL_gemdosevents.c	Sun Mar 10 03:33:59 2002 +0000
     5.3 @@ -41,7 +41,7 @@
     5.4  #include "SDL_events_c.h"
     5.5  
     5.6  #include "SDL_atarikeys.h"
     5.7 -#include "SDL_xbiosmouseevents_c.h"
     5.8 +#include "SDL_xbiosevents_c.h"
     5.9  
    5.10  /* To save state of keyboard */
    5.11  #define ATARIBIOS_MAXKEYS 128
    5.12 @@ -109,7 +109,7 @@
    5.13  	keymap[SCANCODE_LEFTALT] = SDLK_LALT;
    5.14  	keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
    5.15  
    5.16 -	AtariXbios_InstallMouseVector();
    5.17 +	SDL_AtariXbios_InstallVectors(ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS);
    5.18  }
    5.19  
    5.20  void AtariGemdos_PumpEvents(_THIS)
    5.21 @@ -147,7 +147,7 @@
    5.22  			SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gemdos_currentascii[i], &keysym));
    5.23  	}
    5.24  
    5.25 -	AtariXbios_PostMouseEvents(this);
    5.26 +	SDL_AtariXbios_PostMouseEvents(this);
    5.27  
    5.28  	/* Will be previous table */
    5.29  	memcpy(gemdos_previouskeyboard, gemdos_currentkeyboard, ATARIBIOS_MAXKEYS);
    5.30 @@ -188,5 +188,5 @@
    5.31  
    5.32  void AtariGemdos_ShutdownEvents(void)
    5.33  {
    5.34 -	AtariXbios_RestoreMouseVector();
    5.35 +	SDL_AtariXbios_RestoreVectors();
    5.36  }
     6.1 --- a/src/video/ataricommon/SDL_ikbdinterrupt.S	Sun Mar 10 03:25:47 2002 +0000
     6.2 +++ b/src/video/ataricommon/SDL_ikbdinterrupt.S	Sun Mar 10 03:33:59 2002 +0000
     6.3 @@ -42,6 +42,8 @@
     6.4  	.globl	_SDL_AtariIkbd_mousey
     6.5  	.globl	_SDL_AtariIkbd_joystick
     6.6  
     6.7 +	.globl	_SDL_AtariIkbd_enabled
     6.8 +
     6.9  /*--- Install our IKBD vector ---*/
    6.10  
    6.11  _SDL_AtariIkbdInstall:
    6.12 @@ -72,6 +74,8 @@
    6.13  
    6.14  	| Interrupts done
    6.15  
    6.16 +	movew	#0xffff,_SDL_AtariIkbd_enabled
    6.17 +
    6.18  	moveml	sp@+,d0-d1/a0-a1
    6.19  	rts
    6.20  
    6.21 @@ -208,6 +212,9 @@
    6.22  	.data
    6.23  	
    6.24  	.even
    6.25 +_SDL_AtariIkbd_enabled:
    6.26 +	.word	0
    6.27 +	.even
    6.28  	.comm	_SDL_AtariIkbd_keyboard,128
    6.29  	.even
    6.30  	.comm	_SDL_AtariIkbd_mousex,2*1
     7.1 --- a/src/video/ataricommon/SDL_ikbdinterrupt_s.h	Sun Mar 10 03:25:47 2002 +0000
     7.2 +++ b/src/video/ataricommon/SDL_ikbdinterrupt_s.h	Sun Mar 10 03:33:59 2002 +0000
     7.3 @@ -38,13 +38,25 @@
     7.4  
     7.5  #include "SDL_types.h"
     7.6  
     7.7 +/* Const */
     7.8 +
     7.9 +#define IKBD_JOY_UP		(1<<0)
    7.10 +#define IKBD_JOY_DOWN	(1<<1)
    7.11 +#define IKBD_JOY_LEFT	(1<<2)
    7.12 +#define IKBD_JOY_RIGHT	(1<<3)
    7.13 +#define IKBD_JOY_FIRE	(1<<7)
    7.14 +
    7.15  /* Variables */
    7.16  
    7.17  extern Uint8  SDL_AtariIkbd_keyboard[128];	/* Keyboard table */
    7.18 -extern Uint16 SDL_AtariIkbd_mouseb;	/* buttons */
    7.19 -extern Sint16 SDL_AtariIkbd_mousex;	/* X relative motion */
    7.20 -extern Sint16 SDL_AtariIkbd_mousey;	/* Y relative motion */
    7.21 +extern Uint16 SDL_AtariIkbd_mouseb;	/* Mouse on port 0, buttons */
    7.22 +extern Sint16 SDL_AtariIkbd_mousex;	/* Mouse X relative motion */
    7.23 +extern Sint16 SDL_AtariIkbd_mousey;	/* Mouse Y relative motion */
    7.24 +extern Uint16 SDL_AtariIkbd_joystick;	/* Joystick on port 1 */
    7.25  
    7.26 +extern Uint16 SDL_AtariIkbd_enabled;	/* For joystick driver to know
    7.27 +											if this is usable */
    7.28 +										
    7.29  /* Functions */ 
    7.30  
    7.31  extern void SDL_AtariIkbdInstall(void);
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/video/ataricommon/SDL_xbiosevents.c	Sun Mar 10 03:33:59 2002 +0000
     8.3 @@ -0,0 +1,138 @@
     8.4 +/*
     8.5 +    SDL - Simple DirectMedia Layer
     8.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     8.7 +
     8.8 +    This library is free software; you can redistribute it and/or
     8.9 +    modify it under the terms of the GNU Library General Public
    8.10 +    License as published by the Free Software Foundation; either
    8.11 +    version 2 of the License, or (at your option) any later version.
    8.12 +
    8.13 +    This library is distributed in the hope that it will be useful,
    8.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 +    Library General Public License for more details.
    8.17 +
    8.18 +    You should have received a copy of the GNU Library General Public
    8.19 +    License along with this library; if not, write to the Free
    8.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    8.21 +
    8.22 +    Sam Lantinga
    8.23 +    slouken@libsdl.org
    8.24 +*/
    8.25 +
    8.26 +#ifdef SAVE_RCSID
    8.27 +static char rcsid =
    8.28 + "@(#) $Id$";
    8.29 +#endif
    8.30 +
    8.31 +/*
    8.32 + *	XBIOS mouse & joystick vectors
    8.33 + *
    8.34 + *	Patrice Mandin
    8.35 + */
    8.36 +
    8.37 +#include <stdlib.h>
    8.38 +#include <string.h>
    8.39 +#include <mint/osbind.h>
    8.40 +
    8.41 +#include "SDL_events_c.h"
    8.42 +#include "SDL_xbiosevents_c.h"
    8.43 +#include "SDL_xbiosinterrupt_s.h"
    8.44 +
    8.45 +/* Variables */
    8.46 +
    8.47 +int SDL_AtariXbios_enabled=0;
    8.48 +
    8.49 +static _KBDVECS *kbdvecs;		/* Pointer to access vectors */
    8.50 +static _KBDVECS sys_kbdvecs;	/* Backup of system vectors */
    8.51 +static Uint16 atari_prevmouseb;	/* buttons */
    8.52 +
    8.53 +void SDL_AtariXbios_InstallVectors(int vectors_mask)
    8.54 +{
    8.55 +	void *oldpile;
    8.56 +
    8.57 +	/* Clear variables */
    8.58 +	SDL_AtariXbios_mouseb =
    8.59 +		SDL_AtariXbios_mousex =
    8.60 +		SDL_AtariXbios_mousey =
    8.61 +		SDL_AtariXbios_joystick =
    8.62 +		atari_prevmouseb = 0;
    8.63 +
    8.64 +	/* Read IKBD vectors base */
    8.65 +	kbdvecs=Kbdvbase();
    8.66 +
    8.67 +	/* Go to supervisor mode */
    8.68 +	oldpile=(void *)Super(0);
    8.69 +
    8.70 +	/* Backup system vectors */
    8.71 +	memcpy(&sys_kbdvecs, kbdvecs, sizeof(_KBDVECS));
    8.72 +
    8.73 +	/* Install our vector */
    8.74 +	SDL_AtariXbios_Install(
    8.75 +		kbdvecs,
    8.76 +		(vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL,
    8.77 +		(vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ? SDL_AtariXbios_JoystickVector : NULL
    8.78 +	);
    8.79 +
    8.80 +	/* Back to user mode */
    8.81 +	Super(oldpile);
    8.82 +
    8.83 +	SDL_AtariXbios_enabled=1;
    8.84 +}
    8.85 +
    8.86 +void SDL_AtariXbios_RestoreVectors(void)
    8.87 +{
    8.88 +	void *oldpile;
    8.89 +
    8.90 +	/* Go to supervisor mode */
    8.91 +	oldpile=(void *)Super(NULL);
    8.92 +
    8.93 +	/* Reinstall system vector */
    8.94 +	SDL_AtariXbios_Install(kbdvecs,sys_kbdvecs.mousevec,sys_kbdvecs.joyvec);
    8.95 +
    8.96 +	/* Back to user mode */
    8.97 +	Super(oldpile);
    8.98 +}
    8.99 +
   8.100 +static int atari_GetButton(int button)
   8.101 +{
   8.102 +	switch(button)
   8.103 +	{
   8.104 +		case 0:
   8.105 +			return SDL_BUTTON_RIGHT;
   8.106 +			break;
   8.107 +		case 1:
   8.108 +		default:
   8.109 +			return SDL_BUTTON_LEFT;
   8.110 +			break;
   8.111 +	}
   8.112 +}
   8.113 +
   8.114 +void SDL_AtariXbios_PostMouseEvents(_THIS)
   8.115 +{
   8.116 +	/* Mouse motion ? */
   8.117 +	if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
   8.118 +		SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
   8.119 +		SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
   8.120 +	}
   8.121 +	
   8.122 +	/* Mouse button ? */
   8.123 +	if (SDL_AtariXbios_mouseb != atari_prevmouseb) {
   8.124 +		int i;
   8.125 +
   8.126 +		for (i=0;i<2;i++) {
   8.127 +			int curbutton, prevbutton;
   8.128 +
   8.129 +			curbutton = SDL_AtariXbios_mouseb & (1<<i);
   8.130 +			prevbutton = atari_prevmouseb & (1<<i);
   8.131 +
   8.132 +			if (curbutton & !prevbutton) {
   8.133 +				SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
   8.134 +			}
   8.135 +			if (!curbutton & prevbutton) {
   8.136 +				SDL_PrivateMouseButton(SDL_RELEASED, atari_GetButton(i), 0, 0);
   8.137 +			}
   8.138 +		}
   8.139 +		atari_prevmouseb = SDL_AtariXbios_mouseb;
   8.140 +	}
   8.141 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/video/ataricommon/SDL_xbiosevents_c.h	Sun Mar 10 03:33:59 2002 +0000
     9.3 @@ -0,0 +1,51 @@
     9.4 +/*
     9.5 +    SDL - Simple DirectMedia Layer
     9.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     9.7 +
     9.8 +    This library is free software; you can redistribute it and/or
     9.9 +    modify it under the terms of the GNU Library General Public
    9.10 +    License as published by the Free Software Foundation; either
    9.11 +    version 2 of the License, or (at your option) any later version.
    9.12 +
    9.13 +    This library is distributed in the hope that it will be useful,
    9.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 +    Library General Public License for more details.
    9.17 +
    9.18 +    You should have received a copy of the GNU Library General Public
    9.19 +    License along with this library; if not, write to the Free
    9.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    9.21 +
    9.22 +    Sam Lantinga
    9.23 +    slouken@libsdl.org
    9.24 +*/
    9.25 +
    9.26 +#ifdef SAVE_RCSID
    9.27 +static char rcsid =
    9.28 + "@(#) $Id$";
    9.29 +#endif
    9.30 +
    9.31 +/*
    9.32 + *	Xbios mouse & joystick vectors
    9.33 + *
    9.34 + *	Patrice Mandin
    9.35 + */
    9.36 +
    9.37 +#ifndef _SDL_ATARI_XBIOSEVENTS_H_
    9.38 +#define _SDL_ATARI_XBIOSEVENTS_H_
    9.39 +
    9.40 +#include "SDL_sysvideo.h"
    9.41 +
    9.42 +/* Hidden "this" pointer for the video functions */
    9.43 +#define _THIS	SDL_VideoDevice *this
    9.44 +
    9.45 +#define ATARI_XBIOS_MOUSEEVENTS (1<<0)
    9.46 +#define ATARI_XBIOS_JOYSTICKEVENTS (1<<1)
    9.47 +
    9.48 +extern int SDL_AtariXbios_enabled;
    9.49 +
    9.50 +extern void SDL_AtariXbios_InstallVectors(int vectors_mask);
    9.51 +extern void SDL_AtariXbios_RestoreVectors(void);
    9.52 +extern void SDL_AtariXbios_PostMouseEvents(_THIS);
    9.53 +
    9.54 +#endif /* _SDL_XBIOSEVENTS_H_ */
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/video/ataricommon/SDL_xbiosinterrupt.S	Sun Mar 10 03:33:59 2002 +0000
    10.3 @@ -0,0 +1,141 @@
    10.4 +/*
    10.5 +    SDL - Simple DirectMedia Layer
    10.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
    10.7 +
    10.8 +    This library is free software; you can redistribute it and/or
    10.9 +    modify it under the terms of the GNU Library General Public
   10.10 +    License as published by the Free Software Foundation; either
   10.11 +    version 2 of the License, or (at your option) any later version.
   10.12 +
   10.13 +    This library is distributed in the hope that it will be useful,
   10.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 +    Library General Public License for more details.
   10.17 +
   10.18 +    You should have received a copy of the GNU Library General Public
   10.19 +    License along with this library; if not, write to the Free
   10.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   10.21 +
   10.22 +    Sam Lantinga
   10.23 +    slouken@libsdl.org
   10.24 +*/
   10.25 +
   10.26 +#ifdef SAVE_RCSID
   10.27 +static char rcsid =
   10.28 + "@(#) $Id$";
   10.29 +#endif
   10.30 +
   10.31 +/*
   10.32 + *	XBIOS mouse & joystick vectors
   10.33 + *
   10.34 + *	Patrice Mandin
   10.35 + */
   10.36 +
   10.37 +	.text
   10.38 +
   10.39 +	.globl	_SDL_AtariXbios_Install
   10.40 +	.globl	_SDL_AtariXbios_MouseVector
   10.41 +	.globl	_SDL_AtariXbios_JoystickVector
   10.42 +
   10.43 +	.globl	_SDL_AtariXbios_mouseb
   10.44 +	.globl	_SDL_AtariXbios_mousex
   10.45 +	.globl	_SDL_AtariXbios_mousey
   10.46 +	.globl	_SDL_AtariXbios_joystick
   10.47 +
   10.48 +/*--- Vector installer ---*/
   10.49 +
   10.50 +_SDL_AtariXbios_Install:
   10.51 +	movel	sp@(4),a0
   10.52 +
   10.53 +	/* Stop interrupts */
   10.54 +
   10.55 +	movew	#0x2700,sr
   10.56 +
   10.57 +	/* Save old mouse vector, set our routine */
   10.58 +
   10.59 +	movel	sp@(8),d0
   10.60 +	beqs	no_new_mouse_vector
   10.61 +	movel	a0@(16),oldmousevector
   10.62 +	movel	d0,a0@(16)
   10.63 +no_new_mouse_vector:
   10.64 +
   10.65 +	/* Save old joystick vector, set our routine */
   10.66 +
   10.67 +	movel	sp@(12),d0
   10.68 +	beqs	no_new_joystick_vector
   10.69 +	movel	a0@(24),oldjoystickvector
   10.70 +	movel	d0,a0@(24)
   10.71 +no_new_joystick_vector:
   10.72 +
   10.73 +	/* Restart interrupts */
   10.74 +
   10.75 +	movew	#0x2300,sr
   10.76 +
   10.77 +	rts
   10.78 +
   10.79 +/*--- Our mouse vector ---*/
   10.80 +
   10.81 +	.text
   10.82 +	.even
   10.83 +	.ascii "XBRA"
   10.84 +	.ascii "LSDL"
   10.85 +	.comm	oldmousevector,4*1
   10.86 +_SDL_AtariXbios_MouseVector:
   10.87 +	moveml	d0/a1,sp@-
   10.88 +
   10.89 +	/* Mouse buttons */
   10.90 +	moveb	(a0),d0
   10.91 +	andw	#3,d0
   10.92 +	movew	d0,_SDL_AtariXbios_mouseb
   10.93 +
   10.94 +	/* X movement */
   10.95 +	moveb	a0@(1),d0
   10.96 +	extw	d0
   10.97 +	addw	d0,_SDL_AtariXbios_mousex
   10.98 +
   10.99 +	/* Y movement */
  10.100 +	moveb	a0@(2),d0
  10.101 +	extw	d0
  10.102 +	addw	d0,_SDL_AtariXbios_mousey
  10.103 +
  10.104 +	/* Jump through old vector */
  10.105 +	movel	oldmousevector,a1
  10.106 +	jsr	(a1)
  10.107 +
  10.108 +	moveml	sp@+,d0/a1
  10.109 +	rts
  10.110 +
  10.111 +	.data
  10.112 +	.even
  10.113 +	.comm	_SDL_AtariXbios_mousex,2*1
  10.114 +	.even
  10.115 +	.comm	_SDL_AtariXbios_mousey,2*1
  10.116 +	.even
  10.117 +	.comm	_SDL_AtariXbios_mouseb,2*1
  10.118 +
  10.119 +/*--- Our joystick vector ---*/
  10.120 +
  10.121 +	.text
  10.122 +	.even
  10.123 +	.ascii "XBRA"
  10.124 +	.ascii "LSDL"
  10.125 +	.comm	oldjoystickvector,4*1
  10.126 +_SDL_AtariXbios_JoystickVector:
  10.127 +	moveml	d0/a1,sp@-
  10.128 +
  10.129 +	/* New joystick state */
  10.130 +	moveb	a0@(1),d0
  10.131 +	andw	#0x8f,d0
  10.132 +	movew	d0,_SDL_AtariXbios_joystick
  10.133 +
  10.134 +	/* Jump through old vector */
  10.135 +	movel	oldjoystickvector,a1
  10.136 +	jsr	(a1)
  10.137 +
  10.138 +	moveml	sp@+,d0/a1
  10.139 +	rts
  10.140 +
  10.141 +	.data
  10.142 +	.even
  10.143 +	.comm	_SDL_AtariXbios_joystick,2*1
  10.144 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/video/ataricommon/SDL_xbiosinterrupt_s.h	Sun Mar 10 03:33:59 2002 +0000
    11.3 @@ -0,0 +1,54 @@
    11.4 +/*
    11.5 +    SDL - Simple DirectMedia Layer
    11.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
    11.7 +
    11.8 +    This library is free software; you can redistribute it and/or
    11.9 +    modify it under the terms of the GNU Library General Public
   11.10 +    License as published by the Free Software Foundation; either
   11.11 +    version 2 of the License, or (at your option) any later version.
   11.12 +
   11.13 +    This library is distributed in the hope that it will be useful,
   11.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.16 +    Library General Public License for more details.
   11.17 +
   11.18 +    You should have received a copy of the GNU Library General Public
   11.19 +    License along with this library; if not, write to the Free
   11.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.21 +
   11.22 +    Sam Lantinga
   11.23 +    slouken@libsdl.org
   11.24 +*/
   11.25 +
   11.26 +#ifdef SAVE_RCSID
   11.27 +static char rcsid =
   11.28 + "@(#) $Id$";
   11.29 +#endif
   11.30 +
   11.31 +/*
   11.32 + *	Mouse vector
   11.33 + *
   11.34 + *	Patrice Mandin
   11.35 + */
   11.36 +
   11.37 +#ifndef _SDL_XBIOSINTERRUPT_S_H_
   11.38 +#define _SDL_XBIOSINTERRUPT_S_H_
   11.39 +
   11.40 +#include <mint/osbind.h>
   11.41 +
   11.42 +#include "SDL_types.h"
   11.43 +
   11.44 +/* Variables */
   11.45 +
   11.46 +extern Uint16 SDL_AtariXbios_mouseb;	/* buttons */
   11.47 +extern Sint16 SDL_AtariXbios_mousex;	/* X relative motion */
   11.48 +extern Sint16 SDL_AtariXbios_mousey;	/* Y relative motion */
   11.49 +extern Uint16 SDL_AtariXbios_joystick;	/* Joystick */
   11.50 +
   11.51 +/* Functions */ 
   11.52 +
   11.53 +extern void SDL_AtariXbios_Install(_KBDVECS *kbdvecs,void *newmousevector,void *newjoystickvector);
   11.54 +extern void SDL_AtariXbios_MouseVector(void *buf);
   11.55 +extern void SDL_AtariXbios_JoystickVector(void *buf);
   11.56 +
   11.57 +#endif /* _SDL_XBIOSINTERRUPT_S_H_ */
    12.1 --- a/src/video/ataricommon/SDL_xbiosmouseevents.c	Sun Mar 10 03:25:47 2002 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,127 +0,0 @@
    12.4 -/*
    12.5 -    SDL - Simple DirectMedia Layer
    12.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
    12.7 -
    12.8 -    This library is free software; you can redistribute it and/or
    12.9 -    modify it under the terms of the GNU Library General Public
   12.10 -    License as published by the Free Software Foundation; either
   12.11 -    version 2 of the License, or (at your option) any later version.
   12.12 -
   12.13 -    This library is distributed in the hope that it will be useful,
   12.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 -    Library General Public License for more details.
   12.17 -
   12.18 -    You should have received a copy of the GNU Library General Public
   12.19 -    License along with this library; if not, write to the Free
   12.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   12.21 -
   12.22 -    Sam Lantinga
   12.23 -    slouken@libsdl.org
   12.24 -*/
   12.25 -
   12.26 -#ifdef SAVE_RCSID
   12.27 -static char rcsid =
   12.28 - "@(#) $Id$";
   12.29 -#endif
   12.30 -
   12.31 -/*
   12.32 - *	IKBD 6301 mouse vector
   12.33 - *
   12.34 - *	Patrice Mandin
   12.35 - */
   12.36 -
   12.37 -#include <stdlib.h>
   12.38 -#include <string.h>
   12.39 -#include <mint/osbind.h>
   12.40 -
   12.41 -#include "SDL_events_c.h"
   12.42 -#include "SDL_xbiosmouseinterrupt_s.h"
   12.43 -
   12.44 -static _KBDVECS *kbdvecs;		/* Pointer to access vectors */
   12.45 -static _KBDVECS sys_kbdvecs;	/* Backup of system vectors */
   12.46 -
   12.47 -/* Variables */
   12.48 -
   12.49 -static Uint16 atari_prevmouseb;	/* buttons */
   12.50 -
   12.51 -void AtariXbios_InstallMouseVector(void)
   12.52 -{
   12.53 -	void *oldpile;
   12.54 -
   12.55 -	/* Read IKBD vectors base */
   12.56 -	kbdvecs=Kbdvbase();
   12.57 -
   12.58 -	/* Go to supervisor mode */
   12.59 -	oldpile=(void *)Super(0);
   12.60 -
   12.61 -	/* Backup system vectors */
   12.62 -	memcpy(&sys_kbdvecs, kbdvecs, sizeof(_KBDVECS));
   12.63 -
   12.64 -	/* Install our vector */
   12.65 -	SDL_AtariXbiosMouseInstall(kbdvecs,SDL_AtariXbiosMouseVector);
   12.66 -
   12.67 -	/* Back to user mode */
   12.68 -	Super(oldpile);
   12.69 -
   12.70 -	/* Clear variables */
   12.71 -	SDL_AtariXbios_mouseb = SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
   12.72 -	atari_prevmouseb = 0;
   12.73 -}
   12.74 -
   12.75 -void AtariXbios_RestoreMouseVector(void)
   12.76 -{
   12.77 -	void *oldpile;
   12.78 -
   12.79 -	/* Go to supervisor mode */
   12.80 -	oldpile=(void *)Super(NULL);
   12.81 -
   12.82 -	/* Reinstall system vector */
   12.83 -	SDL_AtariXbiosMouseInstall(kbdvecs,sys_kbdvecs.mousevec);
   12.84 -
   12.85 -	/* Back to user mode */
   12.86 -	Super(oldpile);
   12.87 -}
   12.88 -
   12.89 -static int atari_GetButton(int button)
   12.90 -{
   12.91 -	switch(button)
   12.92 -	{
   12.93 -		case 0:
   12.94 -			return SDL_BUTTON_RIGHT;
   12.95 -			break;
   12.96 -		case 1:
   12.97 -		default:
   12.98 -			return SDL_BUTTON_LEFT;
   12.99 -			break;
  12.100 -	}
  12.101 -}
  12.102 -
  12.103 -void AtariXbios_PostMouseEvents(_THIS)
  12.104 -{
  12.105 -	/* Mouse motion ? */
  12.106 -	if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
  12.107 -		SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
  12.108 -		SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
  12.109 -	}
  12.110 -	
  12.111 -	/* Mouse button ? */
  12.112 -	if (SDL_AtariXbios_mouseb != atari_prevmouseb) {
  12.113 -		int i;
  12.114 -
  12.115 -		for (i=0;i<2;i++) {
  12.116 -			int curbutton, prevbutton;
  12.117 -
  12.118 -			curbutton = SDL_AtariXbios_mouseb & (1<<i);
  12.119 -			prevbutton = atari_prevmouseb & (1<<i);
  12.120 -
  12.121 -			if (curbutton & !prevbutton) {
  12.122 -				SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
  12.123 -			}
  12.124 -			if (!curbutton & prevbutton) {
  12.125 -				SDL_PrivateMouseButton(SDL_RELEASED, atari_GetButton(i), 0, 0);
  12.126 -			}
  12.127 -		}
  12.128 -		atari_prevmouseb = SDL_AtariXbios_mouseb;
  12.129 -	}
  12.130 -}
    13.1 --- a/src/video/ataricommon/SDL_xbiosmouseevents_c.h	Sun Mar 10 03:25:47 2002 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,46 +0,0 @@
    13.4 -/*
    13.5 -    SDL - Simple DirectMedia Layer
    13.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
    13.7 -
    13.8 -    This library is free software; you can redistribute it and/or
    13.9 -    modify it under the terms of the GNU Library General Public
   13.10 -    License as published by the Free Software Foundation; either
   13.11 -    version 2 of the License, or (at your option) any later version.
   13.12 -
   13.13 -    This library is distributed in the hope that it will be useful,
   13.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 -    Library General Public License for more details.
   13.17 -
   13.18 -    You should have received a copy of the GNU Library General Public
   13.19 -    License along with this library; if not, write to the Free
   13.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   13.21 -
   13.22 -    Sam Lantinga
   13.23 -    slouken@libsdl.org
   13.24 -*/
   13.25 -
   13.26 -#ifdef SAVE_RCSID
   13.27 -static char rcsid =
   13.28 - "@(#) $Id$";
   13.29 -#endif
   13.30 -
   13.31 -/*
   13.32 - *	IKBD 6301 mouse vector
   13.33 - *
   13.34 - *	Patrice Mandin
   13.35 - */
   13.36 -
   13.37 -#ifndef _SDL_XBIOSMOUSEEVENTS_H_
   13.38 -#define _SDL_XBIOSMOUSEEVENTS_H_
   13.39 -
   13.40 -#include "SDL_sysvideo.h"
   13.41 -
   13.42 -/* Hidden "this" pointer for the video functions */
   13.43 -#define _THIS	SDL_VideoDevice *this
   13.44 -
   13.45 -extern void AtariXbios_InstallMouseVector(void);
   13.46 -extern void AtariXbios_RestoreMouseVector(void);
   13.47 -extern void AtariXbios_PostMouseEvents(_THIS);
   13.48 -
   13.49 -#endif /* _SDL_XBIOSMOUSEEVENTS_H_ */
    14.1 --- a/src/video/ataricommon/SDL_xbiosmouseinterrupt.S	Sun Mar 10 03:25:47 2002 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,106 +0,0 @@
    14.4 -/*
    14.5 -    SDL - Simple DirectMedia Layer
    14.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
    14.7 -
    14.8 -    This library is free software; you can redistribute it and/or
    14.9 -    modify it under the terms of the GNU Library General Public
   14.10 -    License as published by the Free Software Foundation; either
   14.11 -    version 2 of the License, or (at your option) any later version.
   14.12 -
   14.13 -    This library is distributed in the hope that it will be useful,
   14.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14.16 -    Library General Public License for more details.
   14.17 -
   14.18 -    You should have received a copy of the GNU Library General Public
   14.19 -    License along with this library; if not, write to the Free
   14.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   14.21 -
   14.22 -    Sam Lantinga
   14.23 -    slouken@libsdl.org
   14.24 -*/
   14.25 -
   14.26 -#ifdef SAVE_RCSID
   14.27 -static char rcsid =
   14.28 - "@(#) $Id$";
   14.29 -#endif
   14.30 -
   14.31 -/*
   14.32 - *	IKBD 6301 mouse vector
   14.33 - *
   14.34 - *	Patrice Mandin
   14.35 - */
   14.36 -
   14.37 -	.text
   14.38 -
   14.39 -	.globl	_SDL_AtariXbiosMouseInstall
   14.40 -	.globl	_SDL_AtariXbiosMouseVector
   14.41 -
   14.42 -	.globl	_SDL_AtariXbios_mouseb
   14.43 -	.globl	_SDL_AtariXbios_mousex
   14.44 -	.globl	_SDL_AtariXbios_mousey
   14.45 -
   14.46 -/*--- Vector installer ---*/
   14.47 -
   14.48 -_SDL_AtariXbiosMouseInstall:
   14.49 -	movel	sp@(4),a0
   14.50 -	movel	sp@(8),a1
   14.51 -
   14.52 -	/* Stop interrupts */
   14.53 -
   14.54 -	movew	#0x2700,sr
   14.55 -
   14.56 -	/* Save old vector */
   14.57 -
   14.58 -	movel	a0@(16),oldvector
   14.59 -
   14.60 -	/* Set our routine */
   14.61 -
   14.62 -	movel	a1,a0@(16)
   14.63 -
   14.64 -	/* Restart interrupts */
   14.65 -
   14.66 -	movew	#0x2300,sr
   14.67 -
   14.68 -	rts
   14.69 -
   14.70 -/*--- Our mouse vector ---*/
   14.71 -
   14.72 -	.text
   14.73 -	.even
   14.74 -	.ascii "XBRA"
   14.75 -	.ascii "LSDL"
   14.76 -	.comm	oldvector,4*1
   14.77 -_SDL_AtariXbiosMouseVector:
   14.78 -	moveml	d0/a1,sp@-
   14.79 -
   14.80 -	/* Mouse buttons */
   14.81 -	moveb	(a0),d0
   14.82 -	andw	#3,d0
   14.83 -	movew	d0,_SDL_AtariXbios_mouseb
   14.84 -
   14.85 -	/* X movement */
   14.86 -	moveb	a0@(1),d0
   14.87 -	extw	d0
   14.88 -	addw	d0,_SDL_AtariXbios_mousex
   14.89 -
   14.90 -	/* Y movement */
   14.91 -	moveb	a0@(2),d0
   14.92 -	extw	d0
   14.93 -	addw	d0,_SDL_AtariXbios_mousey
   14.94 -
   14.95 -	/* Jump through old vector */
   14.96 -	movel	oldvector,a1
   14.97 -	jsr	(a1)
   14.98 -
   14.99 -	moveml	sp@+,d0/a1
  14.100 -	rts
  14.101 -
  14.102 -	.data
  14.103 -	.even
  14.104 -	.comm	_SDL_AtariXbios_mousex,2*1
  14.105 -	.even
  14.106 -	.comm	_SDL_AtariXbios_mousey,2*1
  14.107 -	.even
  14.108 -	.comm	_SDL_AtariXbios_mouseb,2*1
  14.109 -
    15.1 --- a/src/video/ataricommon/SDL_xbiosmouseinterrupt_s.h	Sun Mar 10 03:25:47 2002 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,52 +0,0 @@
    15.4 -/*
    15.5 -    SDL - Simple DirectMedia Layer
    15.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
    15.7 -
    15.8 -    This library is free software; you can redistribute it and/or
    15.9 -    modify it under the terms of the GNU Library General Public
   15.10 -    License as published by the Free Software Foundation; either
   15.11 -    version 2 of the License, or (at your option) any later version.
   15.12 -
   15.13 -    This library is distributed in the hope that it will be useful,
   15.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15.16 -    Library General Public License for more details.
   15.17 -
   15.18 -    You should have received a copy of the GNU Library General Public
   15.19 -    License along with this library; if not, write to the Free
   15.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   15.21 -
   15.22 -    Sam Lantinga
   15.23 -    slouken@libsdl.org
   15.24 -*/
   15.25 -
   15.26 -#ifdef SAVE_RCSID
   15.27 -static char rcsid =
   15.28 - "@(#) $Id$";
   15.29 -#endif
   15.30 -
   15.31 -/*
   15.32 - *	Mouse vector
   15.33 - *
   15.34 - *	Patrice Mandin
   15.35 - */
   15.36 -
   15.37 -#ifndef _SDL_XBIOSMOUSEEVENTS_S_H_
   15.38 -#define _SDL_XBIOSMOUSEEVENTS_S_H_
   15.39 -
   15.40 -#include <mint/osbind.h>
   15.41 -
   15.42 -#include "SDL_types.h"
   15.43 -
   15.44 -/* Variables */
   15.45 -
   15.46 -extern Uint16 SDL_AtariXbios_mouseb;	/* buttons */
   15.47 -extern Sint16 SDL_AtariXbios_mousex;	/* X relative motion */
   15.48 -extern Sint16 SDL_AtariXbios_mousey;	/* Y relative motion */
   15.49 -
   15.50 -/* Functions */ 
   15.51 -
   15.52 -extern void SDL_AtariXbiosMouseInstall(_KBDVECS *kbdvecs,void *newvector);
   15.53 -extern void SDL_AtariXbiosMouseVector(void *buf);
   15.54 -
   15.55 -#endif /* _SDL_XBIOSMOUSEEVENTS_S_H_ */
    16.1 --- a/src/video/gem/SDL_gemvideo.c	Sun Mar 10 03:25:47 2002 +0000
    16.2 +++ b/src/video/gem/SDL_gemvideo.c	Sun Mar 10 03:33:59 2002 +0000
    16.3 @@ -60,6 +60,7 @@
    16.4  #include "SDL_gemevents_c.h"
    16.5  #include "SDL_gemmouse_c.h"
    16.6  #include "SDL_gemwm_c.h"
    16.7 +#include "SDL_xbiosevents_c.h"
    16.8  
    16.9  /* Defines */
   16.10  
   16.11 @@ -176,6 +177,9 @@
   16.12  	device->WarpWMCursor = GEM_WarpWMCursor;
   16.13  	device->CheckMouseMode = GEM_CheckMouseMode;
   16.14  
   16.15 +	/* Joystick */
   16.16 +	SDL_AtariXbios_InstallVectors(ATARI_XBIOS_JOYSTICKEVENTS);
   16.17 +
   16.18  	device->free = GEM_DeleteDevice;
   16.19  
   16.20  	return device;
   16.21 @@ -937,6 +941,8 @@
   16.22  */
   16.23  void GEM_VideoQuit(_THIS)
   16.24  {
   16.25 +	SDL_AtariXbios_RestoreVectors();
   16.26 +
   16.27  	GEM_FreeBuffers(this);
   16.28  
   16.29  	if (GEM_locked) {