diff --git a/libsrc/mouse/Makefile b/libsrc/mouse/Makefile index 71fb86e50..4e0b3077e 100644 --- a/libsrc/mouse/Makefile +++ b/libsrc/mouse/Makefile @@ -19,7 +19,11 @@ C_OBJS = mouse_load.o -S_OBJS = mouse-kernel.o +S_OBJS = mouse-kernel.o \ + mouse_info.o \ + mouse_ioctl.o \ + mouse_pos.o + #-------------------------------------------------------------------------- diff --git a/libsrc/mouse/mouse-kernel.s b/libsrc/mouse/mouse-kernel.s index e727d866f..48bfc07a8 100644 --- a/libsrc/mouse/mouse-kernel.s +++ b/libsrc/mouse/mouse-kernel.s @@ -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 index 000000000..fb49c5609 --- /dev/null +++ b/libsrc/mouse/mouse_info.s @@ -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 index 000000000..31a8ba791 --- /dev/null +++ b/libsrc/mouse/mouse_ioctl.s @@ -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 index 000000000..484dc612b --- /dev/null +++ b/libsrc/mouse/mouse_pos.s @@ -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 + + + + +