src/video/ataricommon/SDL_xbiosinterrupt.S
author Ryan C. Gordon <icculus@icculus.org>
Fri, 06 Jan 2006 13:20:10 +0000
changeset 1234 73676c1f56ee
parent 1063 0fb50bfaea7f
child 1312 c9b51268668f
permissions -rw-r--r--
For sanity's sake, removed the '&' when passing copy_row array to asm.
slouken@305
     1
/*
slouken@305
     2
    SDL - Simple DirectMedia Layer
slouken@305
     3
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
slouken@305
     4
slouken@305
     5
    This library is free software; you can redistribute it and/or
slouken@305
     6
    modify it under the terms of the GNU Library General Public
slouken@305
     7
    License as published by the Free Software Foundation; either
slouken@305
     8
    version 2 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@305
    13
    Library General Public License for more details.
slouken@305
    14
slouken@305
    15
    You should have received a copy of the GNU Library General Public
slouken@305
    16
    License along with this library; if not, write to the Free
slouken@305
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@305
    18
slouken@305
    19
    Sam Lantinga
slouken@305
    20
    slouken@libsdl.org
slouken@305
    21
*/
slouken@305
    22
slouken@305
    23
#ifdef SAVE_RCSID
slouken@305
    24
static char rcsid =
slouken@305
    25
 "@(#) $Id$";
slouken@305
    26
#endif
slouken@305
    27
slouken@305
    28
/*
slouken@305
    29
 *	XBIOS mouse & joystick vectors
slouken@305
    30
 *
slouken@305
    31
 *	Patrice Mandin
slouken@305
    32
 */
slouken@305
    33
slouken@305
    34
	.text
slouken@305
    35
slouken@305
    36
	.globl	_SDL_AtariXbios_Install
patmandin@820
    37
	.globl	_SDL_AtariXbios_Restore
slouken@305
    38
	.globl	_SDL_AtariXbios_MouseVector
slouken@305
    39
	.globl	_SDL_AtariXbios_JoystickVector
slouken@305
    40
slouken@305
    41
	.globl	_SDL_AtariXbios_mouseb
slouken@305
    42
	.globl	_SDL_AtariXbios_mousex
slouken@305
    43
	.globl	_SDL_AtariXbios_mousey
slouken@305
    44
	.globl	_SDL_AtariXbios_joystick
slouken@305
    45
slouken@305
    46
/*--- Vector installer ---*/
slouken@305
    47
slouken@305
    48
_SDL_AtariXbios_Install:
slouken@305
    49
	movel	sp@(4),a0
slouken@305
    50
slouken@305
    51
	/* Stop interrupts */
slouken@305
    52
slouken@305
    53
	movew	#0x2700,sr
slouken@305
    54
slouken@305
    55
	/* Save old mouse vector, set our routine */
slouken@305
    56
patmandin@820
    57
	clrl	oldmousevector
slouken@305
    58
	movel	sp@(8),d0
slouken@305
    59
	beqs	no_new_mouse_vector
slouken@305
    60
	movel	a0@(16),oldmousevector
slouken@305
    61
	movel	d0,a0@(16)
slouken@305
    62
no_new_mouse_vector:
slouken@305
    63
slouken@305
    64
	/* Save old joystick vector, set our routine */
slouken@305
    65
patmandin@820
    66
	clrl	oldjoystickvector
slouken@305
    67
	movel	sp@(12),d0
slouken@305
    68
	beqs	no_new_joystick_vector
slouken@305
    69
	movel	a0@(24),oldjoystickvector
slouken@305
    70
	movel	d0,a0@(24)
slouken@305
    71
no_new_joystick_vector:
slouken@305
    72
slouken@305
    73
	/* Restart interrupts */
slouken@305
    74
slouken@305
    75
	movew	#0x2300,sr
slouken@305
    76
slouken@305
    77
	rts
slouken@305
    78
patmandin@820
    79
/*--- Vector restorer ---*/
patmandin@820
    80
patmandin@820
    81
_SDL_AtariXbios_Restore:
patmandin@820
    82
	movel	sp@(4),a0
patmandin@820
    83
patmandin@820
    84
	/* Stop interrupts */
patmandin@820
    85
patmandin@820
    86
	movew	#0x2700,sr
patmandin@820
    87
patmandin@820
    88
	/* Restore mouse vector */
patmandin@820
    89
patmandin@820
    90
	movel	oldmousevector,d0
patmandin@820
    91
	beqs	no_restore_mouse
patmandin@820
    92
	movel	d0,a0@(16)
patmandin@820
    93
no_restore_mouse:
patmandin@820
    94
patmandin@820
    95
	/* Restore joystick vector */
patmandin@820
    96
patmandin@820
    97
	movel	oldjoystickvector,d0
patmandin@820
    98
	beqs	no_restore_joystick
patmandin@820
    99
	movel	d0,a0@(24)
patmandin@820
   100
no_restore_joystick:
patmandin@820
   101
patmandin@820
   102
	/* Restart interrupts */
patmandin@820
   103
patmandin@820
   104
	movew	#0x2300,sr
patmandin@820
   105
patmandin@820
   106
	rts
patmandin@820
   107
slouken@305
   108
/*--- Our mouse vector ---*/
slouken@305
   109
slouken@305
   110
	.text
slouken@305
   111
	.even
slouken@305
   112
	.ascii "XBRA"
slouken@305
   113
	.ascii "LSDL"
slouken@305
   114
	.comm	oldmousevector,4*1
slouken@305
   115
_SDL_AtariXbios_MouseVector:
patmandin@987
   116
	movel	d0,sp@-
slouken@305
   117
slouken@305
   118
	/* Mouse buttons */
slouken@305
   119
	moveb	(a0),d0
slouken@305
   120
	andw	#3,d0
slouken@305
   121
	movew	d0,_SDL_AtariXbios_mouseb
slouken@305
   122
slouken@305
   123
	/* X movement */
slouken@305
   124
	moveb	a0@(1),d0
slouken@305
   125
	extw	d0
slouken@305
   126
	addw	d0,_SDL_AtariXbios_mousex
slouken@305
   127
slouken@305
   128
	/* Y movement */
slouken@305
   129
	moveb	a0@(2),d0
slouken@305
   130
	extw	d0
slouken@305
   131
	addw	d0,_SDL_AtariXbios_mousey
slouken@305
   132
slouken@305
   133
	/* Jump through old vector */
patmandin@987
   134
	movel	sp@+,d0
slouken@305
   135
patmandin@987
   136
	movel	oldmousevector,sp@-
slouken@305
   137
	rts
slouken@305
   138
slouken@305
   139
	.data
slouken@305
   140
	.even
slouken@305
   141
	.comm	_SDL_AtariXbios_mousex,2*1
slouken@305
   142
	.even
slouken@305
   143
	.comm	_SDL_AtariXbios_mousey,2*1
slouken@305
   144
	.even
slouken@305
   145
	.comm	_SDL_AtariXbios_mouseb,2*1
slouken@305
   146
slouken@305
   147
/*--- Our joystick vector ---*/
slouken@305
   148
slouken@305
   149
	.text
slouken@305
   150
	.even
slouken@305
   151
	.ascii "XBRA"
slouken@305
   152
	.ascii "LSDL"
slouken@305
   153
	.comm	oldjoystickvector,4*1
slouken@305
   154
_SDL_AtariXbios_JoystickVector:
patmandin@987
   155
	movel	d0,sp@-
slouken@305
   156
slouken@305
   157
	/* New joystick state */
patmandin@1063
   158
	moveb	a0@(2),d0
slouken@305
   159
	andw	#0x8f,d0
slouken@305
   160
	movew	d0,_SDL_AtariXbios_joystick
slouken@305
   161
slouken@305
   162
	/* Jump through old vector */
patmandin@987
   163
	movel	sp@+,d0
slouken@305
   164
patmandin@987
   165
	movel	oldjoystickvector,sp@-
slouken@305
   166
	rts
slouken@305
   167
slouken@305
   168
	.data
slouken@305
   169
	.even
slouken@305
   170
	.comm	_SDL_AtariXbios_joystick,2*1