src/video/ataricommon/SDL_xbiosinterrupt.S
author Sam Lantinga
Thu, 16 Feb 2006 10:11:48 +0000
changeset 1361 19418e4422cb
parent 1312 c9b51268668f
child 2023 b7d426b28c18
permissions -rw-r--r--
New configure-based build system. Still work in progress, but much improved
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
slouken@305
    36
	.globl	_SDL_AtariXbios_mouseb
slouken@305
    37
	.globl	_SDL_AtariXbios_mousex
slouken@305
    38
	.globl	_SDL_AtariXbios_mousey
slouken@305
    39
	.globl	_SDL_AtariXbios_joystick
slouken@305
    40
slouken@305
    41
/*--- Vector installer ---*/
slouken@305
    42
slouken@305
    43
_SDL_AtariXbios_Install:
slouken@305
    44
	movel	sp@(4),a0
slouken@305
    45
slouken@305
    46
	/* Stop interrupts */
slouken@305
    47
slouken@305
    48
	movew	#0x2700,sr
slouken@305
    49
slouken@305
    50
	/* Save old mouse vector, set our routine */
slouken@305
    51
patmandin@820
    52
	clrl	oldmousevector
slouken@305
    53
	movel	sp@(8),d0
slouken@305
    54
	beqs	no_new_mouse_vector
slouken@305
    55
	movel	a0@(16),oldmousevector
slouken@305
    56
	movel	d0,a0@(16)
slouken@305
    57
no_new_mouse_vector:
slouken@305
    58
slouken@305
    59
	/* Save old joystick vector, set our routine */
slouken@305
    60
patmandin@820
    61
	clrl	oldjoystickvector
slouken@305
    62
	movel	sp@(12),d0
slouken@305
    63
	beqs	no_new_joystick_vector
slouken@305
    64
	movel	a0@(24),oldjoystickvector
slouken@305
    65
	movel	d0,a0@(24)
slouken@305
    66
no_new_joystick_vector:
slouken@305
    67
slouken@305
    68
	/* Restart interrupts */
slouken@305
    69
slouken@305
    70
	movew	#0x2300,sr
slouken@305
    71
slouken@305
    72
	rts
slouken@305
    73
patmandin@820
    74
/*--- Vector restorer ---*/
patmandin@820
    75
patmandin@820
    76
_SDL_AtariXbios_Restore:
patmandin@820
    77
	movel	sp@(4),a0
patmandin@820
    78
patmandin@820
    79
	/* Stop interrupts */
patmandin@820
    80
patmandin@820
    81
	movew	#0x2700,sr
patmandin@820
    82
patmandin@820
    83
	/* Restore mouse vector */
patmandin@820
    84
patmandin@820
    85
	movel	oldmousevector,d0
patmandin@820
    86
	beqs	no_restore_mouse
patmandin@820
    87
	movel	d0,a0@(16)
patmandin@820
    88
no_restore_mouse:
patmandin@820
    89
patmandin@820
    90
	/* Restore joystick vector */
patmandin@820
    91
patmandin@820
    92
	movel	oldjoystickvector,d0
patmandin@820
    93
	beqs	no_restore_joystick
patmandin@820
    94
	movel	d0,a0@(24)
patmandin@820
    95
no_restore_joystick:
patmandin@820
    96
patmandin@820
    97
	/* Restart interrupts */
patmandin@820
    98
patmandin@820
    99
	movew	#0x2300,sr
patmandin@820
   100
patmandin@820
   101
	rts
patmandin@820
   102
slouken@305
   103
/*--- Our mouse vector ---*/
slouken@305
   104
slouken@305
   105
	.text
slouken@305
   106
	.even
slouken@305
   107
	.ascii "XBRA"
slouken@305
   108
	.ascii "LSDL"
slouken@305
   109
	.comm	oldmousevector,4*1
slouken@305
   110
_SDL_AtariXbios_MouseVector:
patmandin@987
   111
	movel	d0,sp@-
slouken@305
   112
slouken@305
   113
	/* Mouse buttons */
slouken@305
   114
	moveb	(a0),d0
slouken@305
   115
	andw	#3,d0
slouken@305
   116
	movew	d0,_SDL_AtariXbios_mouseb
slouken@305
   117
slouken@305
   118
	/* X movement */
slouken@305
   119
	moveb	a0@(1),d0
slouken@305
   120
	extw	d0
slouken@305
   121
	addw	d0,_SDL_AtariXbios_mousex
slouken@305
   122
slouken@305
   123
	/* Y movement */
slouken@305
   124
	moveb	a0@(2),d0
slouken@305
   125
	extw	d0
slouken@305
   126
	addw	d0,_SDL_AtariXbios_mousey
slouken@305
   127
slouken@305
   128
	/* Jump through old vector */
patmandin@987
   129
	movel	sp@+,d0
slouken@305
   130
patmandin@987
   131
	movel	oldmousevector,sp@-
slouken@305
   132
	rts
slouken@305
   133
slouken@305
   134
	.data
slouken@305
   135
	.even
slouken@305
   136
	.comm	_SDL_AtariXbios_mousex,2*1
slouken@305
   137
	.even
slouken@305
   138
	.comm	_SDL_AtariXbios_mousey,2*1
slouken@305
   139
	.even
slouken@305
   140
	.comm	_SDL_AtariXbios_mouseb,2*1
slouken@305
   141
slouken@305
   142
/*--- Our joystick vector ---*/
slouken@305
   143
slouken@305
   144
	.text
slouken@305
   145
	.even
slouken@305
   146
	.ascii "XBRA"
slouken@305
   147
	.ascii "LSDL"
slouken@305
   148
	.comm	oldjoystickvector,4*1
slouken@305
   149
_SDL_AtariXbios_JoystickVector:
patmandin@987
   150
	movel	d0,sp@-
slouken@305
   151
slouken@305
   152
	/* New joystick state */
patmandin@1063
   153
	moveb	a0@(2),d0
slouken@305
   154
	andw	#0x8f,d0
slouken@305
   155
	movew	d0,_SDL_AtariXbios_joystick
slouken@305
   156
slouken@305
   157
	/* Jump through old vector */
patmandin@987
   158
	movel	sp@+,d0
slouken@305
   159
patmandin@987
   160
	movel	oldjoystickvector,sp@-
slouken@305
   161
	rts
slouken@305
   162
slouken@305
   163
	.data
slouken@305
   164
	.even
slouken@305
   165
	.comm	_SDL_AtariXbios_joystick,2*1