2 ; Maciej 'YTM/Elysium' Witkowiak
6 ; Driver 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
19 .include "jumptab.inc"
20 .include "geossym.inc"
22 ; --------------------------------------------------------------------------
24 ; unsigned char __fastcall__ mouse_init (unsigned char type);
41 lda #<639 ; 80 columns on C128
45 lda #<319 ; 40 columns on C64/C128
59 ; --------------------------------------------------------------------------
61 ; void mouse_done (void);
66 ; --------------------------------------------------------------------------
68 ; void mouse_hide (void);
71 _mouse_hide = MouseOff
73 ; --------------------------------------------------------------------------
75 ; void mouse_show (void);
80 ; --------------------------------------------------------------------------
82 ; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
94 sta mouseRight+1 ; maxx
106 sta mouseLeft+1 ; minx
108 jmp addysp1 ; Drop params, return
110 ; --------------------------------------------------------------------------
112 ; void __fastcall__ mouse_pos (struct mouse_pos* pos);
113 ; /* Return the current mouse position */
118 stx ptr1+1 ; Remember the argument pointer
120 ldy #0 ; Structure offset
123 sei ; Disable interrupts
125 lda mouseXPos ; Transfer the position
137 plp ; Reenable interrupts
140 ; --------------------------------------------------------------------------
142 ; void __fastcall__ mouse_info (struct mouse_info* info);
143 ; /* Return the state of the mouse buttons and the position of the mouse */
148 ; We're cheating here to keep the code smaller: The first fields of the
149 ; mouse_info struct are identical to the mouse_pos struct, so we will just
150 ; call _mouse_pos to initialize the struct pointer and fill the position
155 ; Fill in the button state
157 jsr _mouse_buttons ; Will not touch ptr1
163 ; --------------------------------------------------------------------------
165 ; void __fastcall__ mouse_move (int x, int y);
171 sei ; Disable interrupts
177 plp ; Enable interrupts
180 ; --------------------------------------------------------------------------
182 ; unsigned char mouse_buttons (void);