2 ; Ullrich von Bassewitz, 2003-12-28
4 ; Common functions of the mouse driver API.
10 .include "mouse-kernel.inc"
14 ;----------------------------------------------------------------------------
19 _mouse_drv: .res 2 ; Pointer to driver
21 ; Jump table for the driver functions.
24 mouse_install: jmp return0
25 mouse_uninstall:jmp return0
26 mouse_hide: jmp return0
27 mouse_show: jmp return0
28 mouse_box: jmp return0
29 mouse_move: jmp return0
30 mouse_buttons: jmp return0
31 mouse_pos: jmp return0
32 mouse_info: jmp return0
34 ; Driver header signature
36 mouse_sig: .byte $6d, $6f, $75, MOUSE_API_VERSION ; "mou", version
39 ;----------------------------------------------------------------------------
40 ; unsigned char __fastcall__ mouse_install (void* driver);
41 ; /* Install an already loaded driver. Returns an error code. */
51 ; Check the driver signature
53 ldy #.sizeof(mouse_sig)-1
60 ; Copy the jump vectors
62 ldy #MOUSE_HDR::JUMPTAB
64 @L1: inx ; Skip the JMP opcode
65 jsr copy ; Copy one byte
66 jsr copy ; Copy one byte
67 cpy #(MOUSE_HDR::JUMPTAB + .sizeof(MOUSE_HDR::JUMPTAB))
70 jmp mouse_install ; Call driver install routine
72 ; Driver signature invalid
75 lda #MOUSE_ERR_INV_DRIVER
79 ; Copy one byte from the jump vectors
87 ;----------------------------------------------------------------------------
88 ; unsigned char __fastcall__ mouse_uninstall (void);
89 ; /* Uninstall the currently loaded driver. Returns an error code. */
92 jsr mouse_uninstall ; Call driver routine
94 mouse_clear_ptr: ; External entry point
97 sta _mouse_drv+1 ; Clear the driver pointer