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 popax, 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 sprite,
29 ; unsigned char type);
33 jsr popax ; ignore all parameters
50 ; --------------------------------------------------------------------------
52 ; void mouse_done (void);
57 ; --------------------------------------------------------------------------
59 ; void mouse_hide (void);
62 _mouse_hide = MouseOff
64 ; --------------------------------------------------------------------------
66 ; void mouse_show (void);
71 ; --------------------------------------------------------------------------
73 ; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
85 sta mouseRight+1 ; maxx
97 sta mouseLeft+1 ; minx
99 jmp addysp1 ; Drop params, return
101 ; --------------------------------------------------------------------------
103 ; void __fastcall__ mouse_pos (struct mouse_pos* pos);
104 ; /* Return the current mouse position */
109 stx ptr1+1 ; Remember the argument pointer
111 ldy #0 ; Structure offset
113 sei ; Disable interrupts
115 lda mouseXPos ; Transfer the position
127 cli ; 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);
160 sei ; Disable interrupts
166 cli ; Enable interrupts
169 ; --------------------------------------------------------------------------
171 ; unsigned char mouse_buttons (void);