]> git.sur5r.net Git - cc65/commitdiff
Make joy_install, joy_uninstall user callable functions
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 10 Feb 2003 22:11:12 +0000 (22:11 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 10 Feb 2003 22:11:12 +0000 (22:11 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1950 b7a2c559-68d2-44c3-8de9-860c34a00d81

asminc/joy-kernel.inc
include/joystick.h
include/joystick/joy-kernel.h
libsrc/joystick/joy-kernel.s
libsrc/joystick/joy_unload.s

index f108ed1fe679ce3e94dc4e1f74e4e5f700653658..4517767e2ee4ef617b08ee76e1b92ec1936bf2b3 100644 (file)
@@ -47,7 +47,7 @@ JOY_MASK_COUNT          = 8                     ; Size of the array
 
 JOY_HDR_JUMPTAB         = 12
 JOY_HDR_INSTALL         = JOY_HDR_JUMPTAB+0     ; INSTALL routine
-JOY_HDR_DEINSTALL       = JOY_HDR_JUMPTAB+2     ; DEINSTALL routine
+JOY_HDR_UNINSTALL       = JOY_HDR_JUMPTAB+2     ; UNINSTALL routine
 JOY_HDR_COUNT           = JOY_HDR_JUMPTAB+4     ; COUNT routine
 JOY_HDR_READ            = JOY_HDR_JUMPTAB+6     ; READ routine
 
@@ -62,7 +62,7 @@ JOY_HDR_JUMPCOUNT       = 4                     ; Number of jump vectors
 ; Driver entry points
 
         .global joy_install
-        .global joy_deinstall
+        .global joy_uninstall
         .global joy_count
         .global joy_read
 
@@ -70,7 +70,8 @@ JOY_HDR_JUMPCOUNT       = 4                     ; Number of jump vectors
 ; ASM functions
 
                .global _joy_install
-               .global _joy_deinstall
+               .global _joy_uninstall
                .global _joy_count
                .global _joy_read
 
+                       
index fcc7146cb00a450a9b1b5f707076256bc621b5de..df7bf5c568f03d5b8ee83b21ebbc3039099769dc 100644 (file)
@@ -84,10 +84,18 @@ extern const char joy_stddrv[];
 
 
 unsigned char __fastcall__ joy_load_driver (const char* driver);
-/* Load a joystick driver and return an error code */
+/* Load and install a joystick driver. Return an error code. */
 
 unsigned char __fastcall__ joy_unload (void);
-/* Unload the currently loaded driver. */
+/* Uninstall, then unload the currently loaded driver. */
+
+unsigned char __fastcall__ joy_install (void* driver);
+/* Install an already loaded driver. */
+
+unsigned char __fastcall__ joy_uninstall (void);
+/* Uninstall the currently loaded driver. Note: This call does not free
+ * allocated memory.
+ */
 
 unsigned char __fastcall__ joy_count (void);
 /* Return the number of joysticks supported by the driver */
index f30f7982b549068dcf28b6c04dc25bef7e216209..0a967a8f1c63f03ad0d3b4db518f234c9e15ec58 100644 (file)
@@ -58,7 +58,7 @@ typedef struct {
 
     /* Jump vectors. Note that these are not C callable */
     void*               install;        /* INSTALL routine */
-    void*               deinstall;      /* DEINSTALL routine */
+    void*               uninstall;      /* UNINSTALL routine */
     void*               count;          /* COUNT routine */
     void*               read;           /* READ routine */
 
@@ -71,21 +71,6 @@ extern joy_drv_header*       joy_drv;        /* Pointer to driver */
 
 
 
-
-/*****************************************************************************/
-/*                                Functions                                 */
-/*****************************************************************************/
-
-
-
-unsigned char __fastcall__ joy_install (void* driver);
-/* Install the driver once it is loaded, return an error code. */
-
-void __fastcall__ joy_deinstall (void);
-/* Deinstall the driver before unloading it */
-
-
-
 /* End of joy-kernel.h */
 #endif
 
index 61d35ce2bcce813b2a1e9891dd8b2b4829835a6f..fbed5ce0a581c85929e5f04ef0b42fdc044e9f6e 100644 (file)
@@ -4,8 +4,9 @@
 ; Common functions of the joystick API.
 ;
 
-        .export         _joy_install, _joy_deinstall, _joy_masks
-
+        .export         _joy_install, _joy_uninstall, _joy_masks
+        .export         joy_clear_ptr
+              
         .importzp       ptr1
 
         .include        "joy-kernel.inc"
@@ -25,7 +26,7 @@ _joy_masks:     .res    JOY_MASK_COUNT
 .data
 joy_vectors:
 joy_install:           jmp     $0000
-joy_deinstall:         jmp     $0000
+joy_uninstall:         jmp     $0000
 joy_count:      jmp     $0000
 joy_read:       jmp     $0000
 
@@ -42,9 +43,9 @@ joy_sig_len     = * - joy_sig
 
 _joy_install:
                sta     _joy_drv
-       sta     ptr1
-       stx     _joy_drv+1
-       stx     ptr1+1
+       sta     ptr1
+       stx     _joy_drv+1
+       stx     ptr1+1
 
 ; Check the driver signature
 
@@ -93,8 +94,19 @@ set:    sta     joy_vectors,x
         rts
 
 ;----------------------------------------------------------------------------
-; void __fastcall__ joy_deinstall (void);
-; /* Deinstall the driver before unloading it */
+; unsigned char __fastcall__ joy_uninstall (void);
+; /* Uninstall the currently loaded driver. Note: This call does not free
+;  * allocated memory.
+;  */
+
+_joy_uninstall:
+        jsr     joy_uninstall           ; Call the driver routine
 
-_joy_deinstall  = joy_deinstall           ; Call driver routine
+joy_clear_ptr:                          ; External entry point
+        lda     #0
+        sta     _joy_drv
+        sta     _joy_drv+1              ; Clear the driver pointer
+
+        tax                             ; Return zero
+        rts
 
index ffca49c4cf1a688039848cb5c8410f988e23c5d7..e5077703e81f4d7999662fded1b909ba7296a199 100644 (file)
@@ -5,6 +5,8 @@
 ; /* Unload the currently loaded driver. */
 
 
+        .import         joy_clear_ptr
+
         .include        "joy-kernel.inc"
         .include        "joy-error.inc"
         .include        "modload.inc"
@@ -14,22 +16,17 @@ _joy_unload:
        ora     _joy_drv+1
                beq     no_driver               ; No driver
 
-       jsr     _joy_deinstall          ; Deinstall the driver
+               jsr     joy_uninstall           ; Uninstall the driver
 
         lda     _joy_drv
         ldx     _joy_drv+1
         jsr     _mod_free               ; Free the driver
 
-        lda     #0
-        sta     _joy_drv
-        sta     _joy_drv+1               ; Clear the driver pointer
-
-        tax
-        rts                             ; Return zero
+        jmp     joy_clear_ptr           ; Clear driver pointer, return zero
 
 no_driver:
        tax                             ; X = 0
        lda     #JOY_ERR_NO_DRIVER
        rts
 
-                    
+