diff src/video/ataricommon/SDL_xbiosinterrupt.S @ 820:0b9b4bf3c1e7

Important crash fix: system vectors for mouse/joystick were not restored
author Patrice Mandin <patmandin@gmail.com>
date Sat, 14 Feb 2004 10:12:27 +0000
parents 9c6613983e85
children d9f3b5bb7870
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_xbiosinterrupt.S	Sat Feb 14 06:04:41 2004 +0000
+++ b/src/video/ataricommon/SDL_xbiosinterrupt.S	Sat Feb 14 10:12:27 2004 +0000
@@ -34,6 +34,7 @@
 	.text
 
 	.globl	_SDL_AtariXbios_Install
+	.globl	_SDL_AtariXbios_Restore
 	.globl	_SDL_AtariXbios_MouseVector
 	.globl	_SDL_AtariXbios_JoystickVector
 
@@ -53,6 +54,7 @@
 
 	/* Save old mouse vector, set our routine */
 
+	clrl	oldmousevector
 	movel	sp@(8),d0
 	beqs	no_new_mouse_vector
 	movel	a0@(16),oldmousevector
@@ -61,6 +63,7 @@
 
 	/* Save old joystick vector, set our routine */
 
+	clrl	oldjoystickvector
 	movel	sp@(12),d0
 	beqs	no_new_joystick_vector
 	movel	a0@(24),oldjoystickvector
@@ -73,6 +76,35 @@
 
 	rts
 
+/*--- Vector restorer ---*/
+
+_SDL_AtariXbios_Restore:
+	movel	sp@(4),a0
+
+	/* Stop interrupts */
+
+	movew	#0x2700,sr
+
+	/* Restore mouse vector */
+
+	movel	oldmousevector,d0
+	beqs	no_restore_mouse
+	movel	d0,a0@(16)
+no_restore_mouse:
+
+	/* Restore joystick vector */
+
+	movel	oldjoystickvector,d0
+	beqs	no_restore_joystick
+	movel	d0,a0@(24)
+no_restore_joystick:
+
+	/* Restart interrupts */
+
+	movew	#0x2300,sr
+
+	rts
+
 /*--- Our mouse vector ---*/
 
 	.text
@@ -138,4 +170,3 @@
 	.data
 	.even
 	.comm	_SDL_AtariXbios_joystick,2*1
-