Mouse Driver 2.0
Interrupt driven pointer utility to work with the Mouse Interface as well as supporting the keyboard cursor keys making it easy for programs to support both input methods.
Used extensively for PD work, especially by Dan Dooré and commercial titles like Football League Manager.
Released December 10th, 1993
MOUSE DRIVER V2.0 RELEASE NOTES - 10.12.93
The updated mouse driver consists of two files:
MDriver The auto-loader which allocates the driver memory and relocates the code.
MDriver2.0 The actual driver, containing code and graphics.
Once loaded, it functions just like the original v1.0 driver supplied with the mouse interface (if there is one attached). However, a new system variable MSPRITE (5C9Ah = SVAR 666) allows you to turn on and off a variety of interrupt-driven pointers, and mouse-testing has been added with facilities for non-mouse owners.
System variable MFLAG (5B99h = SVAR 409) determines whether the keyboard, mouse or neither is scanned for (0, 1 and 2 respectively). This is defaulted to 0 or 1 on installation, depending on a mouse being detected, but can be changed with a POKE.
Keyboard control uses, as for DRiVER, the cursor keys with [.] and [,] representing the mouse buttons. This keyboard facility allows mouse-only programs to be used without any alteration, and provides access to the interrupt-driven pointer (see below) for non-mouse owners.
Please note: System variable 5C9B (MDATAD, SVAR 667, 2 bytes) is used by the driver and should not be overwritten. It can be used as a check to see if the driver has been loaded - it will be non-zero
The Basic functions XMOUSE and YMOUSE will return the coordinates of the mouse; BUTTON 1 returns the status of the left mouse button, BUTTON 3 returns the right button, and BUTTON 0 returns 1 if either button has been pressed. As with the original mouse driver, BUTTON 2 is not used.
To turn the pointer on, use
POKE SVAR 666,x
where x is the number of the sprite graphic:
2. Small crosshair
3. Small arrow
4. Large crosshair
5. Large arrow
8. User sprite
PAUSE 1 will "force an interrupt" and make sure the pointer has been turned on/ changed (you don't need to turn it off before changing the sprite).
To turn the pointer off, use
POKE SVAR 666,0: PAUSE 1
You must ALWAYS turn the pointer off before printing text or graphics on the screen (or changing it in any other way except, perhaps, altering the palette). Once you have finished you can then turn it back on again. The sample programs on the disk provide examples of this.
Please note: the pointer will not work in modes 1 and 2, regardless of the state of MSPRITE. The mouse coordinates, of course, are updated in any mode with or without the pointer
In addition to the sprites supplied, number 8 is a "user sprite". This sprite's address is reported when you install the driver, and you can POKE some sprite data directly to that address, if you like.
LOAD "MDriver2.0" CODE &8000 LOAD "spritedata" CODE &8A00 SAVE OVER "MDriver2.0" CODE &8000,3000
To have the sprite installed for you.
The sprite data consists of the following:
Width (in mode 4 pixels); height (in lines); x offset (in pixels); y offset (in pixels); width * height (2 bytes).
These 6 bytes are followed by the data for the two images (the first for an even x-coordinate, the second for odd x), which is stored line by line: mask, colour, mask, colour...
The maximum size for one sprite image (including mask) is 400 bytes, so 20x20 sprites are possible.
System Variables summary:
SVAR - 398 MSEDP 5B8Eh (8) Used by the mouse as a data store. 399 BUTSTAT 5B8Fh Mouse button status. 406 MXCRD 5B96h (2) Mouse x coordinate. 408 MYCRD 5B98h Mouse y coordinate. 409 MFLAG 5B99h 0/1/2 to scan keyboard/mouse/neither. . . 666 MSPRITE 5C9Ah Sprite number, or 0. 667 MDATAD 5C9Bh (2) Used by the pointer routine.
The code relocates itself in a utilities page, and uses at least two free slots. If there is not enough space for it, a "No memory" error will be reported.
The mouse driver is compatible with DRiVER, but you should turn the pointer OFF before entering the WIMP environment. It is also fully compatible with MasterDOS, MasterBASIC and other recognised device drivers such as the DUMP utility.
Mouse Driver v2.0 is Public Domain software and may, as such, be used and copied freely. You may also use it in this form for commercial software, provided appropriate credit is given. However the code may not be reproduced in any other form without prior permission from the author.
Steve Taylor 10.12.93
The mouse loader works in two parts with an autorunning code file (at address 20224) that then loads the 4kb driver file into the highest available utility page. Unfortunatly this code is hard-wired for Drive 1, loading using file spec "D1:MDRIVER?.?" making it fail on Atom or Trinity ethernet interfaces that are using D2.
The following program will correct it:
10 INPUT "Drive: ";d 20 DIR d 30 INPUT "Enter file number of file: ";f 40 LET f=f-1,t=f DIV 20,s=(f MOD 20 DIV 2)+1,p=256*f MOD 2 50 READ AT d,t,s,65536 60 LET t=PEEK (65549+p),s=PEEK (65550+p) 70 READ AT d,t,s,65536 80 PRINT PEEK 65546: PRINT PEEK 65833 90 POKE 65546,32: POKE 65833,19 100 REM WRITE AT d,t,s,65536 110 REM Remove REM from above line to write back to drive
In certain cases you may wish to force the driver to load lower in the memory space
POKE &511c,&66: REM Force Mdriver to load lower DPOKE &5afc,0 LOAD "Mdriver"CODE POKE &511c,&00 : REM Release page