]> git.sur5r.net Git - cc65/blob - asminc/mouse-kernel.inc
Working...
[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         MOUSE_ERR_INV_IOCTL             ; Invalid ioctl code
49 .endenum
50
51 ;------------------------------------------------------------------------------
52 ; The driver header
53
54 .struct MOUSE_HDR
55         ID              .byte   3       ; Contains 0x6D, 0x6F, 0x75 ("mou")
56         VERSION         .byte   1       ; Interface version
57         JUMPTAB         .struct
58             INSTALL     .addr
59             UNINSTALL   .addr
60             HIDE        .addr
61             SHOW        .addr
62             BOX         .addr
63             MOVE        .addr
64             BUTTONS     .addr
65             POS         .addr
66             INFO        .addr
67             IOCTL       .addr
68             IRQ         .addr
69         .endstruct
70         XPOS            .word           ; Mouse X position
71         YPOS            .word           ; Mouse Y position
72         CALLBACKS .struct               ; Jump instructions
73                         .byte           ; JMP opcode
74             CHIDE       .addr           ; Jump address
75                         .byte
76             CSHOW       .addr
77                         .byte
78             CMOVE       .addr
79         .endstruct
80 .endstruct
81
82 ;------------------------------------------------------------------------------
83 ; The mouse API version, stored in MOUSE_HDR::VERSION
84
85 MOUSE_API_VERSION       = $00
86
87 ;------------------------------------------------------------------------------
88 ; Mouse button definitions
89
90 MOUSE_BTN_LEFT          = $10
91 MOUSE_BTN_RIGHT         = $01
92
93 ;------------------------------------------------------------------------------
94 ; Structures used to return data from the mouse driver
95
96 .struct MOUSE_POS
97         XCOORD  .word
98         YCOORD  .word
99 .endstruct
100
101 .struct MOUSE_INFO
102         POS     .tag    MOUSE_POS
103         BUTTONS .byte
104 .endstruct
105
106
107 ;------------------------------------------------------------------------------
108 ; Variables
109
110         .global _mouse_drv              ; Pointer to driver
111         .global _mouse_hidden           ; Counter, 0 = mouse is visible
112
113 ;------------------------------------------------------------------------------
114 ; C callable functions
115
116         .global _mouse_set_callbacks
117         .global _mouse_load_driver
118         .global _mouse_unload
119         .global _mouse_install
120         .global _mouse_uninstall
121         .global _mouse_hide
122         .global _mouse_show
123         .global _mouse_box
124         .global _mouse_move
125         .global _mouse_buttons
126         .global _mouse_pos
127         .global _mouse_info
128         .global _mouse_ioctl
129
130 ;------------------------------------------------------------------------------
131 ; Driver entry points
132
133         .global mouse_install
134         .global mouse_uninstall
135         .global mouse_hide
136         .global mouse_show
137         .global mouse_box
138         .global mouse_move
139         .global mouse_buttons
140         .global mouse_pos
141         .global mouse_info
142         .global mouse_ioctl
143
144