MOUSE DRIVER v3.1 ----------------- This updated version of Steve Taylor's mouse driver consists of two files: MDRIVER3 An auto running code file which installs the driver code into a utility page, which is created if necessary. MDRIVER3.1 The driver operating code and sprite graphics. When loaded and initalised it operates like the original v2.0 driver. There are, however a number of new features included. First, all of the pointers can now be up to 20x20 pixels in size, two new user control methods have been added and the screen area scanned by the pointer can be adjusted. he system variable MFLAG (5B99h = SVAR 409) determines which control method is in use. The default on initalisation is 1 if a mouse interface is detected or 0 if not. The control method can be altered by poking the system variable as listed below. MFLAG.... 0 Cursor with ',' =BUTTON 1 '.' =BUTTON 3 1 Mouse 3 Cursor with 'F0' =BUTTON 1 '. ' =BUTTON 3 4 Joystick with FIRE =BUTTON 1 SPACE=BUTTON 3 Any other value in MFLAG will disable pointer control! The BASIC functions XMOUSE and YMOUSE return the horizontal and vertical coordinates of the mouse respectively. BUTTON 1 returns the status of the left mouse button (1 whilst pressed) and BUTTON 3 returns the right button. BUTTON 0 will return 1 if either button is being pressed. To display the pointer use POKE SVAR 666,x: PAUSE 1 where x is the number of the sprite graphic required. The default graphics are: 1. Cross 2. Small crosshair 3. Small arrow 4. Large crosshair 5. Large arrow 6. Pencil 7. Caret 8. Dot A value of zero will turn off the pointer. This is necessary when the screen display is up-dated or when text or graphics are printed to the screen. The PAUSE 1 after the POKE SVAR 666,x will "force an interrupt" and make sure the pointer has been updated. As all of the sprites can now be 20x20 pixels full size any can be poked with new data. The location of sprite 8 is still displayed on screen when the program is initalised. Note that this address may alter depending on machine specifications and any software previously loaded! Data can be poked direct to that address if you like, but it will be lost when the computer is switched off. Data can be poked directly into the driver code and the code resaved for a permanent customised pointer. Load the code to 32768 with LOAD "MDRIVER3.1"CODE 32768 The sprite data can then be POKEd or LOADed into the sprite data area by refering to the table below: SPRITE data start address (code loaded to 32768) Sprite number 1 34029 2 34837 3 35645 4 36453 5 37261 6 38069 7 38877 8 39685 The code should then be resaved with: SAVE "MDRIVER3.1"CODE 32768,7725 NOTE: although the loader file (MDRIVER3) could be renamed, the main code file should NOT, as the filename is implicit in the loader code! The sprite data should be in the following format: There is a 6 byte 'header' which contains the parameters of the sprite ie: 1 Width of sprite in pixels 2 height in lines 3 pointer 'hotspot' x offset in pixels 4 pointer 'hotspot' y offset in pixels 5&6 Width * height The 'hotspot' offset is the number of pixels from the top-left corner of the sprite area. The 6 byte header is followed by the sprite data. The maximum size for a 20x20 sprite is 800 bytes plus the six byte header. The other new feature is the definable screen area of the pointer. This allows the programmer to restrict the pointer to a specific part of the screen. The addresses to change are (assuming again that the code has been loaded to 32768) are: ymin 33714 ymax 33715 xmin 33716 xmax 33718 Addresses 33717 and 33719 should always be zero, do not change these as the pointer may become unpredictable! The y parameters should be in the range 0 to 191 and the x parameters should be in the range 0 to 255. In both cases the minimum value should be lower than the maximum value! If the pointer is outside the new screen area it will be moved into the bottom left corner when first activated. To enable the pointer area to be changed during a program the following PROCedure can be used. This procedure locates the driver code and pokes it directly, wherever it is in memory. 5100 DEF PROC msw ymin,ymax,xmin,xmax 5110 LET pt=PEEK SVAR 666: POKE SVAR 666,0: PAUSE 1 5120 LET os=946+(((PEEK ((DPEEK &5afc)+4))*16384+DPEEK((DPEEK &5afc)+6))-16384) 5130 POKE os,ymin,ymax,xmin,0 ,xmax,0 5140 POKE SVAR 666,pt: PAUSE 1 5150 END PROC This procedure will turn off the pointer before changing the parameters. This is to avoid corrupting the screen display in cases where the pointer was outside the 'new' screen area when the procedure was called. The next procedure will again locate the driver code but this time it will load the sprite number sprt with the data in data$. When this procedure is called sprt SHOULD NOT be the current sprite, or the last sprite used if SVAR 666 is poked with 0! 5160 DEF PROC spch sprt, data$ 5170 LET os=(1261+((spt-1)*808))+(((PEEK ((DPEEK &5afc)+4) )*16384+DPEEK ((DPEEK &5afc)+6))-16384) 5180 POKE os,data$ 5190 PAUSE 5 5200 END PROC I have tried the new version of the mouse driver with a number of existing mouse operated programs and have found no problems. If however you do the same and experience trouble, please contact me with your findings. Geoff Bridges Ed's Notes.... To save you trouble I have included the 2 DEF PROCs on this issue under the filenames "MSW" and "SPCH". Also on this issue is an updated version of the EDITOR and INSTALLER which work with the new Mdriver3. You can load these from the main menu under the name "CURSOR EDIT 2". This comes with the option of making a stand alone disk with both the cursor editor and installer on it. Dave MOUSE CURSOR EDITOR + INSTALLER V3.1 by Dave Tonks Modified by Geoff Briges Since issue 56, Geoff has been busy modifying the MDRIVER2.0 code and has come up with a new version with lots more options. This is all explained if you load the MDRIVER 3.1 program from the menu of this issue. To compliment this, the Editor and Installer programs from issue 56 have been updated to match the new mouse driver. There are acually very few differences in their opperation exept that you can now define your new cursors as full 20x20 size. The installer has also been modified to cope with the new cursor addresses. The rest of the program works in exactly the same way as the original, so please read the text files from issue 56 for the full info. ooO END Ooo