******************************************************************************** PROGRAMING THE MOUSE WITH BASIC BY SKIPPY ******************************************************************************** DEAR PROGRAMER: WITH THE MOUSE BECOMING EVER MORE POPULAR IN TODAYS SOFTWARE I DECIDED TO LEARN TO PROGRAM THE MOUSE TO GIVE THE PROGRAM THAT LITTLE "POLISHED" LOOK. I LOOKED FOR A LONG TIME TO FIND INFORMATION ABOUT WRITING PROGRAMS USING THE MOUSE. BUT AFTER MANY CALLS TO OTHER BBS'S AND LOOKING IN BOOKS, I FOUND NOTHING OR JUST VERY LITTLE. SO I DECIDED TO DIG IN AND SPEND MANY LATE NIGHTS (AS MANY PROGRAMMERS KNOW) LOOKING AT HOW THEY DID IT IN OTHER LANGUGES. I HOPE YOU HAVE FUN USING THE FOLLOWING INFORMATION!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DONT BE ONE OF THE MANY WHO USE SHARWARE PROGRAMS AND NEVER PAY!!!! PLEASE SEND $5.00 TO STEVEN BRITTON 6930 S. 20TH ST #2305 OAK CREEK, WI 53154 (414) 761-3662 I HAVE PUT ALOT OF TIME INTO THIS, AND WILL MAKE MANY MORE SO WATCH THE BBS'S! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SPECIAL OFFER: FOR THE TOTAL PRICE OF $7.00 $5.00 MY EFFORTS $2.00 DISKETE AND POSTAGE ------ $7.00 I WILL SEND YOU MUCH MORE DOCUMENTED INFORMATION ON THE MOUSE AND EVEN A FEW SECRETS, ALONG WITH SOME GOOD MOUSE PROGRAMS I WROTE! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! PROGRAMING THE MOUSE WITH BASIC BY STEVEN BRITTON 1. SYSTEM REQUIREMENTS: IBM OR CLONE (100%) COMPUTER MOUSE MOUSE DRIVER A BASIC LANG I want you to enjoy the information givin here and feel free to pass it to friends or even use the info in your own programs (But dont forget to send the $5.00 please) 2. While writting this little package I tried to keep in mind a couple of things a. Keep it short b. Keep it simple and easy to understand c. Dont write a huge .DOC file that takes a long time to read. d. Let you be able to jump in as soon as possible!! 3. I put this package together on a 386sx 16 with 2meg and a 107HD. Basic Languages I have tested this on: TURBO BASIC (BORLAND Co.) GW BASIC (MICROSOFT INC.) QBASIC (MICROSOFT INC.) I originally wrote it all on and tested it in TURBO BASIC. I know many basic programers may not like it, but it works good for me (for now). 4. The first thing you must do is find out where the mouse driver is in memory. The following is a very simple way of doing it. 10 DEF SEG=0 20 MOUSEG=256*PEEK(207)+PEEK(206) 30 MOUSE=256*PEEK(205)+PEEK(204)+2 40 DEF SEG=MOUSEG TO SEE IF A MOUSE DRIVER IS INSTALLED: 50 IF (MOUSEG OR (MOUSE-2)) AND PEEK(MOUSE-2)<> 207 THEN GOTO 70 60 PRINT "MOUSE DRIVER NOT FOUND!": END Next is to reset the mouse driver: 70 M1%=0 80 CALL MOUSE(M1%,M2%,M3%,M4%) Now to show the mouse pointer: 90 M1%=1 100 CALL MOUSE (M1%,M2%,M3%,M4%) NOTE: WHEN DOING THE CALL STATMENT YOU MAY HAVE TO USE THE FOLLOWING INSTEAD (TURBO BASIC,ECT...) CALL ABSOLUTE MOUSE(M1%,M2%,M3%,M4%) 5. Now some notes to help you on the basics. When you run it for the first time notice that the pointer DOES NOT flicker! You dont have to draw it, erase it, draw it,... as when moving items normally so dont worry about that. If you run it as is you will find it very quick, simple, easy to understand. Now to understand some more basics: When placing values in M1% and making a call you can get differnt results. example: 90 M1%=2 100 CALL MOUSE (M1%,M2%,M3%,M4%) NOW THE POINTER IS INVISIBLE!!! 90 M1%=3 100 CALL MOUSE (M1%,M2%,M3%,M4%) 110 IF M2%=1 THEN PRINT "LEFT BUTTON PRESSED" 120 IF M2%=2 THEN PRINT "RIGHT BUTTON PRESSED" 130 IF M2%=3 THEN PRINT "BOTH BUTTONS PRESSED" 140 PRINT M3%: REM HORIZONTAL CURSOR POSITION 150 PRINT M4%: REM VERTICAL CURSOR POSITION 160 GOTO 100 Now I think you are getting the hang of it (I hope!!!) I want you to understand two things: 1. By putting different numbers in the M1% (M1%=?) you can get diffent results by checking the values of the other 3 (M2%,M3%,M4%) after you do the call to the mouse (CALL MOUSE ECT...) 2. Every time you want to retrieve info on the mouse (button status, cursor position, ect...) you must make a call to the mouse with the correct value going to the mouse in M1%. So it may be in a loop if you are always checking to see if the buttons were pressed. The following are a few (just a few) of values to put in M1% before making a call to the mouse and the results. (As I mentioned before, if you send me $7.00 I will send you a disk with ALL the values and the results along many other programs and ect...) M1% value RESULTS --------- ------- 0 M1% mouse status (-1 if found and reset, 0 if other) 1 nothing, shows cursor 2 hide the cursor 3 get mouse position and get button status Now there are Many additional items that I wont cover here, but you can do many things and get alot of information from the mouse. You can even change the pointer to anything you want!! (You design, pencil, hand, face,ect... UNLIMITED) Just have fun!!!