]> git.sur5r.net Git - cc65/blob - asminc/mouse-kernel.inc
Fixed _textcolor definition.
[cc65] / asminc / mouse-kernel.inc
1 ;/*****************************************************************************/
2 ;/*                                                                           */
3 ;/*                            mouse-kernel.inc                               */
4 ;/*                                                                           */
5 ;/*                                Mouse API                                  */
6 ;/*                                                                           */
7 ;/*                                                                           */
8 ;/*                                                                           */
9 ;/* (C) 2003-2009, Ullrich von Bassewitz                                      */
10 ;/*                Roemerstrasse 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
50         MOUSE_ERR_COUNT                 ; Special: Number of error codes
51 .endenum
52
53 ;------------------------------------------------------------------------------
54 ; The driver header
55
56 .struct MOUSE_HDR
57         ID              .byte   3       ; Contains 0x6D, 0x6F, 0x75 ("mou")
58         VERSION         .byte   1       ; Interface version
59         LIBREF          .addr           ; Library reference
60         JUMPTAB         .struct
61             INSTALL     .addr
62             UNINSTALL   .addr
63             HIDE        .addr
64             SHOW        .addr
65             SETBOX      .addr
66             GETBOX      .addr
67             MOVE        .addr
68             BUTTONS     .addr
69             POS         .addr
70             INFO        .addr
71             IOCTL       .addr
72             IRQ         .addr
73         .endstruct
74         FLAGS           .byte           ; Mouse driver flags
75         CALLBACKS .struct               ; Jump instructions
76                         .byte           ; JMP opcode
77             CHIDE       .addr           ; Jump address
78                         .byte
79             CSHOW       .addr
80                         .byte
81             CPREP       .addr
82                         .byte
83             CDRAW       .addr
84                         .byte
85             CMOVEX      .addr
86                         .byte
87             CMOVEY      .addr
88         .endstruct
89 .endstruct
90
91 ;------------------------------------------------------------------------------
92 ; The mouse callback structure
93
94 .struct MOUSE_CALLBACKS
95         HIDE    .addr                   ; Hide the mouse cursor
96         SHOW    .addr                   ; Show the mouse cursor
97         PREP    .addr                   ; Prepare to move the mouse cursor
98         DRAW    .addr                   ; Draw the mouse cursor
99         MOVEX   .addr                   ; Move the mouse cursor to X coord
100         MOVEY   .addr                   ; Move the mouse cursor to Y coord
101 .endstruct
102
103 ;------------------------------------------------------------------------------
104 ; The mouse API version, stored in MOUSE_HDR::VERSION
105
106 MOUSE_API_VERSION       = $06
107
108 ;------------------------------------------------------------------------------
109 ; Bitmapped mouse driver flags, stored in MOUSE_HDR::FLAGS.
110 ; Note: If neither of MOUSE_FLAG_XXX_IRQ is set, no interrupts are supplied
111 ; to the driver. If one of the bits is set, the interrupt vector MUST be
112 ; valid.
113 ; Beware: Some of the bits are tested using the BIT instruction, so do not
114 ; change the values without checking the code!
115
116 MOUSE_FLAG_EARLY_IRQ    = $40           ; Enable IRQ *before* calling INSTALL
117 MOUSE_FLAG_LATE_IRQ     = $80           ; Enable IRQ *after* calling INSTALL
118
119 ;------------------------------------------------------------------------------
120 ; Mouse button definitions
121
122 MOUSE_BTN_LEFT          = $10
123 MOUSE_BTN_RIGHT         = $01
124
125 ;------------------------------------------------------------------------------
126 ; Structures used to return data from the mouse driver
127
128 .struct MOUSE_POS
129         XCOORD  .word
130         YCOORD  .word
131 .endstruct
132
133 .struct MOUSE_INFO
134         POS     .tag    MOUSE_POS
135         BUTTONS .byte
136 .endstruct
137
138 .struct MOUSE_BOX
139         MINX    .word
140         MINY    .word
141         MAXX    .word
142         MAXY    .word
143 .endstruct
144
145 ;------------------------------------------------------------------------------
146 ; Variables
147
148         .global _mouse_drv              ; Pointer to driver
149         .global _mouse_hidden           ; Counter, 0 = mouse is visible
150
151 ;------------------------------------------------------------------------------
152 ; C callable functions
153
154         .global _mouse_load_driver
155         .global _mouse_unload
156         .global _mouse_install
157         .global _mouse_uninstall
158         .global _mouse_geterrormsg
159         .global _mouse_hide
160         .global _mouse_show
161         .global _mouse_setbox
162         .global _mouse_getbox
163         .global _mouse_move
164         .global _mouse_buttons
165         .global _mouse_pos
166         .global _mouse_info
167         .global _mouse_ioctl
168
169         .global _mouse_clear_ptr
170
171 ;------------------------------------------------------------------------------
172 ; Driver entry points (asm callable)
173
174         .global mouse_install
175         .global mouse_uninstall
176         .global mouse_hide
177         .global mouse_show
178         .global mouse_setbox
179         .global mouse_getbox
180         .global mouse_move
181         .global mouse_buttons
182         .global mouse_pos
183         .global mouse_info
184         .global mouse_ioctl