src/video/ataricommon/SDL_xbiosinterrupt.S
author Edgar Simo <bobbens@gmail.com>
Sun, 06 Jul 2008 17:06:37 +0000
branchgsoc2008_force_feedback
changeset 2498 ab567bd667bf
parent 2023 b7d426b28c18
child 2859 99210400e8b9
permissions -rw-r--r--
Fixed various mistakes in the doxygen.
slouken@305
     1
/*
slouken@305
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@305
     4
slouken@305
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@305
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@305
     9
slouken@305
    10
    This library is distributed in the hope that it will be useful,
slouken@305
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@305
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@305
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@305
    18
slouken@305
    19
    Sam Lantinga
slouken@305
    20
    slouken@libsdl.org
slouken@305
    21
*/
slouken@305
    22
slouken@305
    23
/*
slouken@305
    24
 *	XBIOS mouse & joystick vectors
slouken@305
    25
 *
slouken@305
    26
 *	Patrice Mandin
slouken@305
    27
 */
slouken@305
    28
slouken@305
    29
	.text
slouken@305
    30
slouken@305
    31
	.globl	_SDL_AtariXbios_Install
patmandin@820
    32
	.globl	_SDL_AtariXbios_Restore
slouken@305
    33
	.globl	_SDL_AtariXbios_MouseVector
slouken@305
    34
	.globl	_SDL_AtariXbios_JoystickVector
slouken@305
    35
patmandin@2023
    36
	.globl	_SDL_AtariXbios_mouselock
slouken@305
    37
	.globl	_SDL_AtariXbios_mouseb
slouken@305
    38
	.globl	_SDL_AtariXbios_mousex
slouken@305
    39
	.globl	_SDL_AtariXbios_mousey
slouken@305
    40
	.globl	_SDL_AtariXbios_joystick
slouken@305
    41
slouken@305
    42
/*--- Vector installer ---*/
slouken@305
    43
slouken@305
    44
_SDL_AtariXbios_Install:
slouken@305
    45
	movel	sp@(4),a0
slouken@305
    46
slouken@305
    47
	/* Stop interrupts */
slouken@305
    48
slouken@305
    49
	movew	#0x2700,sr
slouken@305
    50
slouken@305
    51
	/* Save old mouse vector, set our routine */
slouken@305
    52
patmandin@820
    53
	clrl	oldmousevector
slouken@305
    54
	movel	sp@(8),d0
slouken@305
    55
	beqs	no_new_mouse_vector
slouken@305
    56
	movel	a0@(16),oldmousevector
slouken@305
    57
	movel	d0,a0@(16)
slouken@305
    58
no_new_mouse_vector:
slouken@305
    59
slouken@305
    60
	/* Save old joystick vector, set our routine */
slouken@305
    61
patmandin@820
    62
	clrl	oldjoystickvector
slouken@305
    63
	movel	sp@(12),d0
slouken@305
    64
	beqs	no_new_joystick_vector
slouken@305
    65
	movel	a0@(24),oldjoystickvector
slouken@305
    66
	movel	d0,a0@(24)
slouken@305
    67
no_new_joystick_vector:
slouken@305
    68
slouken@305
    69
	/* Restart interrupts */
slouken@305
    70
slouken@305
    71
	movew	#0x2300,sr
slouken@305
    72
slouken@305
    73
	rts
slouken@305
    74
patmandin@820
    75
/*--- Vector restorer ---*/
patmandin@820
    76
patmandin@820
    77
_SDL_AtariXbios_Restore:
patmandin@820
    78
	movel	sp@(4),a0
patmandin@820
    79
patmandin@820
    80
	/* Stop interrupts */
patmandin@820
    81
patmandin@820
    82
	movew	#0x2700,sr
patmandin@820
    83
patmandin@820
    84
	/* Restore mouse vector */
patmandin@820
    85
patmandin@820
    86
	movel	oldmousevector,d0
patmandin@820
    87
	beqs	no_restore_mouse
patmandin@820
    88
	movel	d0,a0@(16)
patmandin@820
    89
no_restore_mouse:
patmandin@820
    90
patmandin@820
    91
	/* Restore joystick vector */
patmandin@820
    92
patmandin@820
    93
	movel	oldjoystickvector,d0
patmandin@820
    94
	beqs	no_restore_joystick
patmandin@820
    95
	movel	d0,a0@(24)
patmandin@820
    96
no_restore_joystick:
patmandin@820
    97
patmandin@820
    98
	/* Restart interrupts */
patmandin@820
    99
patmandin@820
   100
	movew	#0x2300,sr
patmandin@820
   101
patmandin@820
   102
	rts
patmandin@820
   103
slouken@305
   104
/*--- Our mouse vector ---*/
slouken@305
   105
slouken@305
   106
	.text
slouken@305
   107
	.even
slouken@305
   108
	.ascii "XBRA"
slouken@305
   109
	.ascii "LSDL"
slouken@305
   110
	.comm	oldmousevector,4*1
slouken@305
   111
_SDL_AtariXbios_MouseVector:
patmandin@987
   112
	movel	d0,sp@-
slouken@305
   113
slouken@305
   114
	/* Mouse buttons */
slouken@305
   115
	moveb	(a0),d0
slouken@305
   116
	andw	#3,d0
slouken@305
   117
	movew	d0,_SDL_AtariXbios_mouseb
slouken@305
   118
slouken@305
   119
	/* X movement */
slouken@305
   120
	moveb	a0@(1),d0
slouken@305
   121
	extw	d0
slouken@305
   122
	addw	d0,_SDL_AtariXbios_mousex
slouken@305
   123
slouken@305
   124
	/* Y movement */
slouken@305
   125
	moveb	a0@(2),d0
slouken@305
   126
	extw	d0
slouken@305
   127
	addw	d0,_SDL_AtariXbios_mousey
slouken@305
   128
patmandin@2023
   129
	/* Lock mouse position ? */
patmandin@2023
   130
	tstw	_SDL_AtariXbios_mouselock
patmandin@2023
   131
	beq.s	no_mouse_lock
patmandin@2023
   132
	clrb	a0@(1)
patmandin@2023
   133
	clrb	a0@(2)
patmandin@2023
   134
no_mouse_lock:
patmandin@2023
   135
slouken@305
   136
	/* Jump through old vector */
patmandin@987
   137
	movel	sp@+,d0
slouken@305
   138
patmandin@987
   139
	movel	oldmousevector,sp@-
slouken@305
   140
	rts
slouken@305
   141
slouken@305
   142
	.data
slouken@305
   143
	.even
patmandin@2023
   144
	.comm	_SDL_AtariXbios_mouselock,2*1
slouken@305
   145
	.comm	_SDL_AtariXbios_mousex,2*1
slouken@305
   146
	.comm	_SDL_AtariXbios_mousey,2*1
slouken@305
   147
	.comm	_SDL_AtariXbios_mouseb,2*1
slouken@305
   148
slouken@305
   149
/*--- Our joystick vector ---*/
slouken@305
   150
slouken@305
   151
	.text
slouken@305
   152
	.even
slouken@305
   153
	.ascii "XBRA"
slouken@305
   154
	.ascii "LSDL"
slouken@305
   155
	.comm	oldjoystickvector,4*1
slouken@305
   156
_SDL_AtariXbios_JoystickVector:
patmandin@987
   157
	movel	d0,sp@-
slouken@305
   158
slouken@305
   159
	/* New joystick state */
patmandin@1063
   160
	moveb	a0@(2),d0
slouken@305
   161
	andw	#0x8f,d0
slouken@305
   162
	movew	d0,_SDL_AtariXbios_joystick
slouken@305
   163
slouken@305
   164
	/* Jump through old vector */
patmandin@987
   165
	movel	sp@+,d0
slouken@305
   166
patmandin@987
   167
	movel	oldjoystickvector,sp@-
slouken@305
   168
	rts
slouken@305
   169
slouken@305
   170
	.data
slouken@305
   171
	.even
slouken@305
   172
	.comm	_SDL_AtariXbios_joystick,2*1