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);
43 lda #<639 ; 80 columns on C128
47 lda #<319 ; 40 columns on C64/C128
55 ; --------------------------------------------------------------------------
57 ; void mouse_done (void);
62 ; --------------------------------------------------------------------------
64 ; void mouse_hide (void);
67 _mouse_hide = MouseOff
69 ; --------------------------------------------------------------------------
71 ; void mouse_show (void);
76 ; --------------------------------------------------------------------------
78 ; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
90 sta mouseRight+1 ; maxx
102 sta mouseLeft+1 ; minx
104 jmp addysp1 ; Drop params, return
106 ; --------------------------------------------------------------------------
108 ; void __fastcall__ mouse_pos (struct mouse_pos* pos);
109 ; /* Return the current mouse position */
114 stx ptr1+1 ; Remember the argument pointer
116 ldy #0 ; Structure offset
119 sei ; Disable interrupts
121 lda mouseXPos ; Transfer the position
133 plp ; Reenable interrupts
136 ; --------------------------------------------------------------------------
138 ; void __fastcall__ mouse_info (struct mouse_info* info);
139 ; /* Return the state of the mouse buttons and the position of the mouse */
144 ; We're cheating here to keep the code smaller: The first fields of the
145 ; mouse_info struct are identical to the mouse_pos struct, so we will just
146 ; call _mouse_pos to initialize the struct pointer and fill the position
151 ; Fill in the button state
153 jsr _mouse_buttons ; Will not touch ptr1
159 ; --------------------------------------------------------------------------
161 ; void __fastcall__ mouse_move (int x, int y);
167 sei ; Disable interrupts
173 plp ; Enable interrupts
176 ; --------------------------------------------------------------------------
178 ; unsigned char mouse_buttons (void);