]> git.sur5r.net Git - cc65/blob - asminc/mouse-kernel.inc
Make mouse driver loadable
[cc65] / asminc / mouse-kernel.inc
1 ;/*****************************************************************************/
2 ;/*                                                                           */
3 ;/*                            mouse-kernel.inc                               */
4 ;/*                                                                           */
5 ;/*                                Mouse API                                  */
6 ;/*                                                                           */
7 ;/*                                                                           */
8 ;/*                                                                           */
9 ;/* (C) 2003      Ullrich von Bassewitz                                       */
10 ;/*               Römerstraße 52                                              */
11 ;/*               D-70794 Filderstadt                                         */
12 ;/* EMail:        uz@cc65.org                                                 */
13 ;/*                                                                           */
14 ;/*                                                                           */
15 ;/*                                                                           */
16 ;/*                                                                           */
17 ;/* This software is provided 'as-is', without any expressed or implied       */
18 ;/* warranty.  In no event will the authors be held liable for any damages    */
19 ;/* arising from the use of this software.                                    */
20 ;/*                                                                           */
21 ;/* Permission is granted to anyone to use this software for any purpose,     */
22 ;/* including commercial applications, and to alter it and redistribute it    */
23 ;/* freely, subject to the following restrictions:                            */
24 ;/*                                                                           */
25 ;/* 1. The origin of this software must not be misrepresented; you must not   */
26 ;/*    claim that you wrote the original software. If you use this software   */
27 ;/*    in a product, an acknowledgment in the product documentation would be  */
28 ;/*    appreciated but is not required.                                       */
29 ;/* 2. Altered source versions must be plainly marked as such, and must not   */
30 ;/*    be misrepresented as being the original software.                      */
31 ;/* 3. This notice may not be removed or altered from any source              */
32 ;/*    distribution.                                                          */
33 ;/*                                                                           */
34 ;/*****************************************************************************/
35
36
37
38
39 ;------------------------------------------------------------------------------
40 ; Error codes
41
42 .enum
43         MOUSE_ERR_OK                    ; No error
44         MOUSE_ERR_NO_DRIVER             ; No driver available
45         MOUSE_ERR_CANNOT_LOAD           ; Error loading driver
46         MOUSE_ERR_INV_DRIVER            ; Invalid driver
47         MOUSE_ERR_NO_DEVICE             ; Mouse hardware not found
48 .endenum
49
50 ;------------------------------------------------------------------------------
51 ; The driver header
52
53 .struct MOUSE_HDR
54         ID      .byte   3       ; Contains 0x6D, 0x6F, 0x75 ("mou")
55         VERSION .byte   1       ; Interface version
56         JUMPTAB .struct
57             INSTALL     .addr
58             UNINSTALL   .addr
59             HIDE        .addr
60             SHOW        .addr
61             BOX         .addr
62             MOVE        .addr
63             BUTTONS     .addr
64             POS         .addr
65             INFO        .addr
66         .endstruct
67 .endstruct
68
69 ;------------------------------------------------------------------------------
70 ; The mouse API version, stored in MOUSE_HDR::VERSION
71
72 MOUSE_API_VERSION       = $00
73
74 ;------------------------------------------------------------------------------
75 ; Mouse button definitions
76
77 MOUSE_BTN_LEFT          = $10
78 MOUSE_BTN_RIGHT         = $01
79
80 ;------------------------------------------------------------------------------
81 ; Structures used to return data from the mouse driver
82
83 .struct MOUSE_POS
84         XCOORD  .word
85         YCOORD  .word
86 .endstruct
87
88 .struct MOUSE_INFO
89         POS     .tag    MOUSE_POS
90         BUTTONS .byte
91 .endstruct
92
93
94 ;------------------------------------------------------------------------------
95 ; Variables
96
97         .global _mouse_drv                      ; Pointer to driver
98
99 ;------------------------------------------------------------------------------
100 ; C callable functions
101
102         .global _mouse_set_callbacks
103         .global _mouse_load_driver
104         .global _mouse_unload
105         .global _mouse_install
106         .global _mouse_uninstall
107         .global _mouse_hide
108         .global _mouse_show
109         .global _mouse_box
110         .global _mouse_move
111         .global _mouse_buttons
112         .global _mouse_pos
113         .global _mouse_info
114
115 ;------------------------------------------------------------------------------
116 ; Driver entry points
117
118         .global mouse_install
119         .global mouse_uninstall
120         .global mouse_hide
121         .global mouse_show
122         .global mouse_box
123         .global mouse_move
124         .global mouse_buttons
125         .global mouse_pos
126         .global mouse_info
127
128