src/video/ataricommon/SDL_xbiosinterrupt.S
author Sam Lantinga <slouken@libsdl.org>
Sun, 10 Mar 2002 03:33:59 +0000
changeset 305 9c6613983e85
child 820 0b9b4bf3c1e7
permissions -rw-r--r--
Atari port cleanups from Patrice
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Library General Public
     7     License as published by the Free Software Foundation; either
     8     version 2 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Library General Public License for more details.
    14 
    15     You should have received a copy of the GNU Library General Public
    16     License along with this library; if not, write to the Free
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 #ifdef SAVE_RCSID
    24 static char rcsid =
    25  "@(#) $Id$";
    26 #endif
    27 
    28 /*
    29  *	XBIOS mouse & joystick vectors
    30  *
    31  *	Patrice Mandin
    32  */
    33 
    34 	.text
    35 
    36 	.globl	_SDL_AtariXbios_Install
    37 	.globl	_SDL_AtariXbios_MouseVector
    38 	.globl	_SDL_AtariXbios_JoystickVector
    39 
    40 	.globl	_SDL_AtariXbios_mouseb
    41 	.globl	_SDL_AtariXbios_mousex
    42 	.globl	_SDL_AtariXbios_mousey
    43 	.globl	_SDL_AtariXbios_joystick
    44 
    45 /*--- Vector installer ---*/
    46 
    47 _SDL_AtariXbios_Install:
    48 	movel	sp@(4),a0
    49 
    50 	/* Stop interrupts */
    51 
    52 	movew	#0x2700,sr
    53 
    54 	/* Save old mouse vector, set our routine */
    55 
    56 	movel	sp@(8),d0
    57 	beqs	no_new_mouse_vector
    58 	movel	a0@(16),oldmousevector
    59 	movel	d0,a0@(16)
    60 no_new_mouse_vector:
    61 
    62 	/* Save old joystick vector, set our routine */
    63 
    64 	movel	sp@(12),d0
    65 	beqs	no_new_joystick_vector
    66 	movel	a0@(24),oldjoystickvector
    67 	movel	d0,a0@(24)
    68 no_new_joystick_vector:
    69 
    70 	/* Restart interrupts */
    71 
    72 	movew	#0x2300,sr
    73 
    74 	rts
    75 
    76 /*--- Our mouse vector ---*/
    77 
    78 	.text
    79 	.even
    80 	.ascii "XBRA"
    81 	.ascii "LSDL"
    82 	.comm	oldmousevector,4*1
    83 _SDL_AtariXbios_MouseVector:
    84 	moveml	d0/a1,sp@-
    85 
    86 	/* Mouse buttons */
    87 	moveb	(a0),d0
    88 	andw	#3,d0
    89 	movew	d0,_SDL_AtariXbios_mouseb
    90 
    91 	/* X movement */
    92 	moveb	a0@(1),d0
    93 	extw	d0
    94 	addw	d0,_SDL_AtariXbios_mousex
    95 
    96 	/* Y movement */
    97 	moveb	a0@(2),d0
    98 	extw	d0
    99 	addw	d0,_SDL_AtariXbios_mousey
   100 
   101 	/* Jump through old vector */
   102 	movel	oldmousevector,a1
   103 	jsr	(a1)
   104 
   105 	moveml	sp@+,d0/a1
   106 	rts
   107 
   108 	.data
   109 	.even
   110 	.comm	_SDL_AtariXbios_mousex,2*1
   111 	.even
   112 	.comm	_SDL_AtariXbios_mousey,2*1
   113 	.even
   114 	.comm	_SDL_AtariXbios_mouseb,2*1
   115 
   116 /*--- Our joystick vector ---*/
   117 
   118 	.text
   119 	.even
   120 	.ascii "XBRA"
   121 	.ascii "LSDL"
   122 	.comm	oldjoystickvector,4*1
   123 _SDL_AtariXbios_JoystickVector:
   124 	moveml	d0/a1,sp@-
   125 
   126 	/* New joystick state */
   127 	moveb	a0@(1),d0
   128 	andw	#0x8f,d0
   129 	movew	d0,_SDL_AtariXbios_joystick
   130 
   131 	/* Jump through old vector */
   132 	movel	oldjoystickvector,a1
   133 	jsr	(a1)
   134 
   135 	moveml	sp@+,d0/a1
   136 	rts
   137 
   138 	.data
   139 	.even
   140 	.comm	_SDL_AtariXbios_joystick,2*1
   141