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 popa, 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 port,
28 ; unsigned char type);
32 jsr popa ; ignore all parameters
49 ; --------------------------------------------------------------------------
51 ; void mouse_done (void);
56 ; --------------------------------------------------------------------------
58 ; void mouse_hide (void);
61 _mouse_hide = MouseOff
63 ; --------------------------------------------------------------------------
65 ; void mouse_show (void);
70 ; --------------------------------------------------------------------------
72 ; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
84 sta mouseRight+1 ; maxx
96 sta mouseLeft+1 ; minx
98 jmp addysp1 ; Drop params, return
100 ; --------------------------------------------------------------------------
102 ; void __fastcall__ mouse_pos (struct mouse_pos* pos);
103 ; /* Return the current mouse position */
108 stx ptr1+1 ; Remember the argument pointer
110 ldy #0 ; Structure offset
113 sei ; Disable interrupts
115 lda mouseXPos ; Transfer the position
127 plp ; Reenable interrupts
130 ; --------------------------------------------------------------------------
132 ; void __fastcall__ mouse_info (struct mouse_info* info);
133 ; /* Return the state of the mouse buttons and the position of the mouse */
138 ; We're cheating here to keep the code smaller: The first fields of the
139 ; mouse_info struct are identical to the mouse_pos struct, so we will just
140 ; call _mouse_pos to initialize the struct pointer and fill the position
145 ; Fill in the button state
147 jsr _mouse_buttons ; Will not touch ptr1
153 ; --------------------------------------------------------------------------
155 ; void __fastcall__ mouse_move (int x, int y);
161 sei ; Disable interrupts
167 plp ; Enable interrupts
170 ; --------------------------------------------------------------------------
172 ; unsigned char mouse_buttons (void);