More mouse stuff

git-svn-id: svn://svn.cc65.org/cc65/trunk@2856 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-12-30 08:08:07 +00:00
parent 0f06fe63b7
commit 904780547c
5 changed files with 90 additions and 1 deletions

View File

@ -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
#--------------------------------------------------------------------------

View 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

23
libsrc/mouse/mouse_info.s Normal file
View File

@ -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

View File

@ -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

23
libsrc/mouse/mouse_pos.s Normal file
View File

@ -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