src/video/ataricommon/SDL_xbiosinterrupt.S
author Sam Lantinga <slouken@libsdl.org>
Wed, 01 Feb 2006 06:32:25 +0000
changeset 1312 c9b51268668f
parent 1063 0fb50bfaea7f
child 2023 b7d426b28c18
permissions -rw-r--r--
Updated copyright information and removed rcs id lines (problematic in branch merges)
I batch edited these files, so please let me know if I've accidentally removed anybody's
credit here.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 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     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /*
    24  *	XBIOS mouse & joystick vectors
    25  *
    26  *	Patrice Mandin
    27  */
    28 
    29 	.text
    30 
    31 	.globl	_SDL_AtariXbios_Install
    32 	.globl	_SDL_AtariXbios_Restore
    33 	.globl	_SDL_AtariXbios_MouseVector
    34 	.globl	_SDL_AtariXbios_JoystickVector
    35 
    36 	.globl	_SDL_AtariXbios_mouseb
    37 	.globl	_SDL_AtariXbios_mousex
    38 	.globl	_SDL_AtariXbios_mousey
    39 	.globl	_SDL_AtariXbios_joystick
    40 
    41 /*--- Vector installer ---*/
    42 
    43 _SDL_AtariXbios_Install:
    44 	movel	sp@(4),a0
    45 
    46 	/* Stop interrupts */
    47 
    48 	movew	#0x2700,sr
    49 
    50 	/* Save old mouse vector, set our routine */
    51 
    52 	clrl	oldmousevector
    53 	movel	sp@(8),d0
    54 	beqs	no_new_mouse_vector
    55 	movel	a0@(16),oldmousevector
    56 	movel	d0,a0@(16)
    57 no_new_mouse_vector:
    58 
    59 	/* Save old joystick vector, set our routine */
    60 
    61 	clrl	oldjoystickvector
    62 	movel	sp@(12),d0
    63 	beqs	no_new_joystick_vector
    64 	movel	a0@(24),oldjoystickvector
    65 	movel	d0,a0@(24)
    66 no_new_joystick_vector:
    67 
    68 	/* Restart interrupts */
    69 
    70 	movew	#0x2300,sr
    71 
    72 	rts
    73 
    74 /*--- Vector restorer ---*/
    75 
    76 _SDL_AtariXbios_Restore:
    77 	movel	sp@(4),a0
    78 
    79 	/* Stop interrupts */
    80 
    81 	movew	#0x2700,sr
    82 
    83 	/* Restore mouse vector */
    84 
    85 	movel	oldmousevector,d0
    86 	beqs	no_restore_mouse
    87 	movel	d0,a0@(16)
    88 no_restore_mouse:
    89 
    90 	/* Restore joystick vector */
    91 
    92 	movel	oldjoystickvector,d0
    93 	beqs	no_restore_joystick
    94 	movel	d0,a0@(24)
    95 no_restore_joystick:
    96 
    97 	/* Restart interrupts */
    98 
    99 	movew	#0x2300,sr
   100 
   101 	rts
   102 
   103 /*--- Our mouse vector ---*/
   104 
   105 	.text
   106 	.even
   107 	.ascii "XBRA"
   108 	.ascii "LSDL"
   109 	.comm	oldmousevector,4*1
   110 _SDL_AtariXbios_MouseVector:
   111 	movel	d0,sp@-
   112 
   113 	/* Mouse buttons */
   114 	moveb	(a0),d0
   115 	andw	#3,d0
   116 	movew	d0,_SDL_AtariXbios_mouseb
   117 
   118 	/* X movement */
   119 	moveb	a0@(1),d0
   120 	extw	d0
   121 	addw	d0,_SDL_AtariXbios_mousex
   122 
   123 	/* Y movement */
   124 	moveb	a0@(2),d0
   125 	extw	d0
   126 	addw	d0,_SDL_AtariXbios_mousey
   127 
   128 	/* Jump through old vector */
   129 	movel	sp@+,d0
   130 
   131 	movel	oldmousevector,sp@-
   132 	rts
   133 
   134 	.data
   135 	.even
   136 	.comm	_SDL_AtariXbios_mousex,2*1
   137 	.even
   138 	.comm	_SDL_AtariXbios_mousey,2*1
   139 	.even
   140 	.comm	_SDL_AtariXbios_mouseb,2*1
   141 
   142 /*--- Our joystick vector ---*/
   143 
   144 	.text
   145 	.even
   146 	.ascii "XBRA"
   147 	.ascii "LSDL"
   148 	.comm	oldjoystickvector,4*1
   149 _SDL_AtariXbios_JoystickVector:
   150 	movel	d0,sp@-
   151 
   152 	/* New joystick state */
   153 	moveb	a0@(2),d0
   154 	andw	#0x8f,d0
   155 	movew	d0,_SDL_AtariXbios_joystick
   156 
   157 	/* Jump through old vector */
   158 	movel	sp@+,d0
   159 
   160 	movel	oldjoystickvector,sp@-
   161 	rts
   162 
   163 	.data
   164 	.even
   165 	.comm	_SDL_AtariXbios_joystick,2*1