src/video/ataricommon/SDL_xbiosinterrupt.S
author Patrice Mandin
Fri, 26 Nov 2004 16:16:50 +0000
changeset 991 12b13601a544
parent 987 d9f3b5bb7870
child 1063 0fb50bfaea7f
permissions -rw-r--r--
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
     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_Restore
    38 	.globl	_SDL_AtariXbios_MouseVector
    39 	.globl	_SDL_AtariXbios_JoystickVector
    40 
    41 	.globl	_SDL_AtariXbios_mouseb
    42 	.globl	_SDL_AtariXbios_mousex
    43 	.globl	_SDL_AtariXbios_mousey
    44 	.globl	_SDL_AtariXbios_joystick
    45 
    46 /*--- Vector installer ---*/
    47 
    48 _SDL_AtariXbios_Install:
    49 	movel	sp@(4),a0
    50 
    51 	/* Stop interrupts */
    52 
    53 	movew	#0x2700,sr
    54 
    55 	/* Save old mouse vector, set our routine */
    56 
    57 	clrl	oldmousevector
    58 	movel	sp@(8),d0
    59 	beqs	no_new_mouse_vector
    60 	movel	a0@(16),oldmousevector
    61 	movel	d0,a0@(16)
    62 no_new_mouse_vector:
    63 
    64 	/* Save old joystick vector, set our routine */
    65 
    66 	clrl	oldjoystickvector
    67 	movel	sp@(12),d0
    68 	beqs	no_new_joystick_vector
    69 	movel	a0@(24),oldjoystickvector
    70 	movel	d0,a0@(24)
    71 no_new_joystick_vector:
    72 
    73 	/* Restart interrupts */
    74 
    75 	movew	#0x2300,sr
    76 
    77 	rts
    78 
    79 /*--- Vector restorer ---*/
    80 
    81 _SDL_AtariXbios_Restore:
    82 	movel	sp@(4),a0
    83 
    84 	/* Stop interrupts */
    85 
    86 	movew	#0x2700,sr
    87 
    88 	/* Restore mouse vector */
    89 
    90 	movel	oldmousevector,d0
    91 	beqs	no_restore_mouse
    92 	movel	d0,a0@(16)
    93 no_restore_mouse:
    94 
    95 	/* Restore joystick vector */
    96 
    97 	movel	oldjoystickvector,d0
    98 	beqs	no_restore_joystick
    99 	movel	d0,a0@(24)
   100 no_restore_joystick:
   101 
   102 	/* Restart interrupts */
   103 
   104 	movew	#0x2300,sr
   105 
   106 	rts
   107 
   108 /*--- Our mouse vector ---*/
   109 
   110 	.text
   111 	.even
   112 	.ascii "XBRA"
   113 	.ascii "LSDL"
   114 	.comm	oldmousevector,4*1
   115 _SDL_AtariXbios_MouseVector:
   116 	movel	d0,sp@-
   117 
   118 	/* Mouse buttons */
   119 	moveb	(a0),d0
   120 	andw	#3,d0
   121 	movew	d0,_SDL_AtariXbios_mouseb
   122 
   123 	/* X movement */
   124 	moveb	a0@(1),d0
   125 	extw	d0
   126 	addw	d0,_SDL_AtariXbios_mousex
   127 
   128 	/* Y movement */
   129 	moveb	a0@(2),d0
   130 	extw	d0
   131 	addw	d0,_SDL_AtariXbios_mousey
   132 
   133 	/* Jump through old vector */
   134 	movel	sp@+,d0
   135 
   136 	movel	oldmousevector,sp@-
   137 	rts
   138 
   139 	.data
   140 	.even
   141 	.comm	_SDL_AtariXbios_mousex,2*1
   142 	.even
   143 	.comm	_SDL_AtariXbios_mousey,2*1
   144 	.even
   145 	.comm	_SDL_AtariXbios_mouseb,2*1
   146 
   147 /*--- Our joystick vector ---*/
   148 
   149 	.text
   150 	.even
   151 	.ascii "XBRA"
   152 	.ascii "LSDL"
   153 	.comm	oldjoystickvector,4*1
   154 _SDL_AtariXbios_JoystickVector:
   155 	movel	d0,sp@-
   156 
   157 	/* New joystick state */
   158 	moveb	a0@(1),d0
   159 	andw	#0x8f,d0
   160 	movew	d0,_SDL_AtariXbios_joystick
   161 
   162 	/* Jump through old vector */
   163 	movel	sp@+,d0
   164 
   165 	movel	oldjoystickvector,sp@-
   166 	rts
   167 
   168 	.data
   169 	.even
   170 	.comm	_SDL_AtariXbios_joystick,2*1