2 ; Maciej 'YTM/Elysium' Witkowiak
6 ; Wrapper for GEOS standard input device interface
9 .export _mouse_init, _mouse_done
10 .export _mouse_hide, _mouse_show
12 .export _mouse_pos, _mouse_info
13 .export _mouse_move, _mouse_buttons
15 .import popsreg, addysp1
16 .importzp sp, sreg, ptr1
18 .include "../inc/const.inc"
19 .include "../inc/jumptab.inc"
20 .include "../inc/geossym.inc"
25 ; --------------------------------------------------------------------------
27 ; unsigned char __fastcall__ mouse_init (unsigned char type);
46 ; --------------------------------------------------------------------------
48 ; void mouse_done (void);
53 ; --------------------------------------------------------------------------
55 ; void mouse_hide (void);
58 _mouse_hide = MouseOff
60 ; --------------------------------------------------------------------------
62 ; void mouse_show (void);
67 ; --------------------------------------------------------------------------
69 ; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
81 sta mouseRight+1 ; maxx
93 sta mouseLeft+1 ; minx
95 jmp addysp1 ; Drop params, return
97 ; --------------------------------------------------------------------------
99 ; void __fastcall__ mouse_pos (struct mouse_pos* pos);
100 ; /* Return the current mouse position */
105 stx ptr1+1 ; Remember the argument pointer
107 ldy #0 ; Structure offset
110 sei ; Disable interrupts
112 lda mouseXPos ; Transfer the position
124 plp ; Reenable interrupts
127 ; --------------------------------------------------------------------------
129 ; void __fastcall__ mouse_info (struct mouse_info* info);
130 ; /* Return the state of the mouse buttons and the position of the mouse */
135 ; We're cheating here to keep the code smaller: The first fields of the
136 ; mouse_info struct are identical to the mouse_pos struct, so we will just
137 ; call _mouse_pos to initialize the struct pointer and fill the position
142 ; Fill in the button state
144 jsr _mouse_buttons ; Will not touch ptr1
150 ; --------------------------------------------------------------------------
152 ; void __fastcall__ mouse_move (int x, int y);
158 sei ; Disable interrupts
164 plp ; Enable interrupts
167 ; --------------------------------------------------------------------------
169 ; unsigned char mouse_buttons (void);