.global _mouse_info
.global _mouse_ioctl
+ .global _mouse_clear_ptr
+
;------------------------------------------------------------------------------
-; Driver entry points
+; Driver entry points (asm callable)
.global mouse_install
.global mouse_uninstall
/* */
/* */
/* */
-/* (C) 2003 Ullrich von Bassewitz */
-/* Römerstraße 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2003-2006, Ullrich von Bassewitz */
+/* Römerstraße 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
+/*****************************************************************************/
+/* Code */
+/*****************************************************************************/
+
+
+
+void mouse_clear_ptr (void);
+/* Clear the mouse_drv pointer */
+
+
+
/* End of mouse-kernel.h */
#endif
jsr uninstall_irq ; Disable driver interrupts
jsr mouse_uninstall ; Call driver routine
-mouse_clear_ptr: ; External entry point
+_mouse_clear_ptr: ; External entry point
lda #0
sta _mouse_drv
sta _mouse_drv+1 ; Clear the driver pointer
tax
rts ; Return zero
+
if (Res == MLOAD_OK) {
/* Check the driver signature, install the driver */
- return mouse_install (c, ctrl.module);
-
+ Res = mouse_install (c, ctrl.module);
+
+ /* If the driver did not install correctly, remove it from
+ * memory again.
+ */
+ if (Res != MLOAD_OK) {
+ /* Do not call mouse_uninstall here, since the driver is not
+ * correctly installed.
+ */
+ mod_free (mouse_drv);
+ mouse_clear_ptr ();
+ }
}
+
+ /* Return the error code */
+ return Res;
}
/* Error loading the driver */