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
54 ; --------------------------------------------------------------------------
56 ; void mouse_done (void);
61 ; --------------------------------------------------------------------------
63 ; void mouse_hide (void);
66 _mouse_hide = MouseOff
68 ; --------------------------------------------------------------------------
70 ; void mouse_show (void);
75 ; --------------------------------------------------------------------------
77 ; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
89 sta mouseRight+1 ; maxx
101 sta mouseLeft+1 ; minx
103 jmp addysp1 ; Drop params, return
105 ; --------------------------------------------------------------------------
107 ; void __fastcall__ mouse_pos (struct mouse_pos* pos);
108 ; /* Return the current mouse position */
113 stx ptr1+1 ; Remember the argument pointer
115 ldy #0 ; Structure offset
118 sei ; Disable interrupts
120 lda mouseXPos ; Transfer the position
132 plp ; Reenable interrupts
135 ; --------------------------------------------------------------------------
137 ; void __fastcall__ mouse_info (struct mouse_info* info);
138 ; /* Return the state of the mouse buttons and the position of the mouse */
143 ; We're cheating here to keep the code smaller: The first fields of the
144 ; mouse_info struct are identical to the mouse_pos struct, so we will just
145 ; call _mouse_pos to initialize the struct pointer and fill the position
150 ; Fill in the button state
152 jsr _mouse_buttons ; Will not touch ptr1
158 ; --------------------------------------------------------------------------
160 ; void __fastcall__ mouse_move (int x, int y);
166 sei ; Disable interrupts
172 plp ; Enable interrupts
175 ; --------------------------------------------------------------------------
177 ; unsigned char mouse_buttons (void);