]> git.sur5r.net Git - cc65/commitdiff
More mouse stuff
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 30 Dec 2003 08:08:07 +0000 (08:08 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 30 Dec 2003 08:08:07 +0000 (08:08 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2856 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/mouse/Makefile
libsrc/mouse/mouse-kernel.s
libsrc/mouse/mouse_info.s [new file with mode: 0644]
libsrc/mouse/mouse_ioctl.s [new file with mode: 0644]
libsrc/mouse/mouse_pos.s [new file with mode: 0644]

index 71fb86e5048ecdbafa063c63d41f170f6066cb3d..4e0b3077ee919d7003f67d66e89c73059ccf0398 100644 (file)
 
 C_OBJS =        mouse_load.o
 
-S_OBJS =        mouse-kernel.o  
+S_OBJS =        mouse-kernel.o  \
+                mouse_info.o    \
+                mouse_ioctl.o   \
+                mouse_pos.o
+
 
 
 #--------------------------------------------------------------------------
index e727d866f1fbd4c35aa526a08c70845d26402340..48bfc07a88c1d32464dca31c1ae590184705cee7 100644 (file)
@@ -6,6 +6,7 @@
 
         .import         return0
         .importzp       ptr1
+               .condes         mouse_irq, 2            ; Export as IRQ handler
 
         .include        "mouse-kernel.inc"
 
@@ -30,6 +31,8 @@ mouse_move:     jmp     return0
 mouse_buttons:  jmp     return0
 mouse_pos:      jmp     return0
 mouse_info:     jmp     return0
+mouse_ioctl:    jmp     return0
+mouse_irq:     .byte   $60, $00, $00   ; RTS plus two dummy bytes
 
 ; Driver header signature
 .rodata
@@ -69,6 +72,12 @@ _mouse_install:
 
         jmp     mouse_install           ; Call driver install routine
 
+        ldy     mouse_irq+2             ; Check high byte of IRQ vector
+        beq     @L2                     ; Jump if vector invalid
+       ldy     #$4C                    ; Jump opcode
+               sty     mouse_irq               ; Activate IRQ routine
+@L2:    rts
+
 ; Driver signature invalid
 
 inv_drv:
@@ -91,6 +100,9 @@ copy:   lda     (ptr1),y
 _mouse_uninstall:
         jsr     mouse_uninstall         ; Call driver routine
 
+       lda     #$60                    ; RTS opcode
+       sta     mouse_irq               ; Disable IRQ entry point
+
 mouse_clear_ptr:                        ; External entry point
         lda     #0
         sta     _mouse_drv
diff --git a/libsrc/mouse/mouse_info.s b/libsrc/mouse/mouse_info.s
new file mode 100644 (file)
index 0000000..fb49c56
--- /dev/null
@@ -0,0 +1,23 @@
+;
+; Ullrich von Bassewitz, 2003-12-30
+;
+; void __fastcall__ mouse_info (struct mouse_info* info);
+; /* Return the state of the mouse buttons and the position of the mouse */
+;
+
+        .import         ptr1: zp
+
+        .include        "mouse-kernel.inc"
+
+.proc   _mouse_info
+
+        sta     ptr1
+        stx     ptr1+1                  ; Store info into ptr1
+        jmp     mouse_info              ; Call the driver
+
+.endproc
+
+
+
+
+
diff --git a/libsrc/mouse/mouse_ioctl.s b/libsrc/mouse/mouse_ioctl.s
new file mode 100644 (file)
index 0000000..31a8ba7
--- /dev/null
@@ -0,0 +1,27 @@
+;
+; Ullrich von Bassewitz, 2003-12-30
+;
+; unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);
+; /* Call the driver specific ioctl function. NON PORTABLE! Returns an error
+;  * code.
+;  */
+;
+
+        .import         popa
+        .import         ptr1: zp
+
+        .include        "mouse-kernel.inc"
+
+.proc   _mouse_ioctl
+
+        sta     ptr1
+        stx     ptr1+1                  ; Store data into ptr1
+        jsr     popa                    ; Get code from stack
+        jmp     mouse_ioctl             ; Call the driver
+
+.endproc
+
+
+
+
+
diff --git a/libsrc/mouse/mouse_pos.s b/libsrc/mouse/mouse_pos.s
new file mode 100644 (file)
index 0000000..484dc61
--- /dev/null
@@ -0,0 +1,23 @@
+;
+; Ullrich von Bassewitz, 2003-12-30
+;
+; void __fastcall__ mouse_pos (struct mouse_pos* pos);
+; /* Return the current mouse position */
+;
+
+        .import         ptr1: zp
+
+        .include        "mouse-kernel.inc"
+
+.proc   _mouse_pos
+
+        sta     ptr1
+        stx     ptr1+1                  ; Store pos into ptr1
+        jmp     mouse_pos               ; Call the driver
+
+.endproc
+
+
+
+
+