HELP / ANSWERS by Geoff Bridges Now a few tips for users of Steve Taylor's Mouse Driver v2.0 First in the readme notes on the disk, it is explained how to save the data for a user sprite (sprite 8), but unfortunatly the address given to load the data to is incorrect. The information given is:- LOAD "Mdriver2.0" Code &8000 LOAD "spritedata" Code &8A00 SAVE "Mdriver2.0" CODE &8000,3000 This should be:- LOAD "Mdriver2.0" Code &8000 LOAD "spritedata" Code &8E00 SAVE "Mdriver2.0" CODE &8000,4400 The address given on screen for the user sprite when the mousedriver loader is run is correct. The pointer currently in use is selected by poking SVAR 666 with the pointer number (1 to 8) and is disabled by poking SVAR 666,0. It advisable to disable the pointer when printing or drawing to the screen to avoid corruption of the display behind the pointer. To avoid using the poke command throughout your program a small procedure can be used:- DEF PROC pointer n POKE SVAR 666,n PAUSE 1 END PROC a typical program fragment could be: IF printing_to_screen THEN pointer 0 ......... printing routine pointer 5 ......... continue with program When the mouse is used from BASIC the variables XMOUSE and YMOUSE hold the current position of the pointer. These values are in screen pixels 0-191 for YMOUSE and 0-255 or 0-511 for XMOUSE depending upon the screen MODE. This is not much use if you need to locate a character position on screen. The following procedure will calculate the current screen line/column position of the pointer. It also detects if the pointer has been moved since the last call to the procedure to avoid any unnecessary screen up-dates if nothing has happened. DEF PROC mouse_position LET old_xm=xm,old_ym=ym LET xm=XMOUSE DIV PEEK SVAR 55 LET ym=(191-YMOUSE) DIV PEEK SVAR 54 IF xm<>old_xm or ym<>old_ym THEN LET moved=1:ELSE LET MOVED=0 END PROC First the existing values of xm and ym are saved then the present values are calculated. These are then checked with the old values and if either differ then the variable 'moved' is set to a non-zero value. The value of 'moved' could be set to a specific number if the xm and xy values were within a certain area of the screen; a menu area for example. The SVARs used in the calculations for xm and ym hold the CSIZE vertical and horizontal values currently set for the characters on screen. Therefore if CSIZE 8,8 was used with a MODE 4 screen then 191/8 would give 24 vertical character lines and 255/8 would give 32 character columns on each line. Because the YMOUSE zero value is at the bottom of the screen and the character zero line is at the top of the screen the YMOUSE value has to be 'inverted' first, hence the (191-YMOUSE) part of the calculation. The pressing of a mouse button is indicated by a non-zero value of the BUTTON functions. The left button is BUTTON 1 and BUTTON 3 is the right button. BUTTON 0 will be non-zero if either button is pressed. The button status can also be found by PEEKing SVAR 399. Bit 0 is set when the left button is pressed and bit 2 when the right button is pressed. PEEKing SVAR 399 gives the following values Left Button ............ 1 Right Button ........... 4 Both buttons together .. 5 Neither button ......... 0 By use of the mouse_position Procedure and the button status it is a simple task to program a routine to select from a range of menu items etc.