[comp.sys.ibm.pc.programmer] Using a mouse with Turbo C

botterry@ac.dal.ca (02/20/90)

I am interested in using a mouse systems mouse (Genius Mouse with Mouse.com)
for some i/o on my Turbo-C programmers.  Do I have to resort to Assembler in
order to use the mouse or are there undocumented (or documented that I can't
find documented) Turbo-C commands?
Thanks in advance

Terry Grignon
Dalhousie University
Halifax, Nova Scotia, Canada

egeberg@plains.UUCP (Roger Egeberg) (02/22/90)

In article <1264@ac.dal.ca> botterry@ac.dal.ca writes:
>I am interested in using a mouse systems mouse (Genius Mouse with Mouse.com)
>for some i/o on my Turbo-C programmers.  Do I have to resort to Assembler in
>order to use the mouse or are there undocumented (or documented that I can't
>find documented) Turbo-C commands?
>Thanks in advance
>
>Terry Grignon

There's nothing "built-in" in Turbo C to support the mouse.  It seems that 
most of what I've seen is written for a Microsoft or Microsoft-compatible
mouse.

There was a two part article in the May/June 1988 and July/August 1988 issues
of Turbo Technix (now defunct) that explained how to use a Microsoft compatible
mouse with Turbo C.  Basically you have to put a function code into the AX
register and execute interrupt 33H.  Even if you can't find a copy of the
articles, you may be able to find the code from Turbo Technix.  I've seen it
on BBS's.

Another way is to buy a library that has support for a mouse.  I've used a
library called CXL (C Extended Function Library) by Mike Smedly.  It has
mouse support (as well as a lot of other stuff).  I found an evaluation
version on a local BBS that included a demo program and a library for the
Turbo C small memory model.  Registration is $35 (I think) and then you get
full source code and libraries for all memory models.  He also supports 
Microsoft C and Zortech C++.  I've been very happy with CXL.
-- 
Roger Egeberg
NDSU Extension Service              BITNET:    nu062423@ndsuvm1.BITNET
North Dakota State University       Internet:  egeberg@plains.NoDak.edu

ear@wpi.wpi.edu (Eric A Rasmussen) (02/22/90)

In article <1264@ac.dal.ca> botterry@ac.dal.ca writes:
>I am interested in using a mouse systems mouse (Genius Mouse with Mouse.com)
>for some i/o on my Turbo-C programmers.  Do I have to resort to Assembler in
>order to use the mouse or are there undocumented (or documented that I can't
>find documented) Turbo-C commands?

When I purchased my Logitech mouse a couple of years ago, it came with
documentation (on disk) about how to use the mouse with high level languages
including Modula-2/86, Turbo Pascal, Microsoft C, and even Basic via assembly
language routines.  The Logitech mouse, from what I understand, is a Mouse
Systems mouse compatible.  I believe it will also emulate a Microsoft mouse. 
In the user's manual, it recommends calling Logitech's bulletin board for the
latest list of languages supported.  I believe the following excerpts from the
read.me file on one of the software disks contains the information that can
help you.
-----------------------------------------------------------------------------
LOGIMOUSE Electronic Information

To report experiences and problems about the Logimouse software and hardware,
you can now call our Vax system using a modem.  It accepts both 300 and 1200
baud rates (not compatible with Racal-Vadic).  Log as the "mouse" user.
This system will also provide new sources for LOGIMENU as they become
available (we will be happy to publish those that you send us).

	(415) 364-7057

	Login: mouse

For more information, see your dealer, or call Logitech at (415) 365-9852
------------------------------------------------------------------------------
Please note that I cannot guarantee that this number is still active, as I
have never called it.  If you still need more information, I will consider
emailing you a copy of the relevant documentation included on my software
disk, but I would prefer not to do that as I'm not sure it is completely
legal.
 _                _                                         +-=-=-=-=-=-=-=-=-+
|_  ,_  .   _    |_}   _    _  ,_ _         _   _   _   ,_  | ear@wpi.wpi.edu |
|_  |   |  |_    | \  |_\  _>  | | |  |_|  _>  _>  |_'  | | | ear%wpi@wpi.edu |
--< A real engineer never reads the instructions first! >-- +-=-=-=-=-=-=-=-=-+

sagen@nucthy.physics.orst.edu (Milt Sagen) (02/22/90)

In article <1264@ac.dal.ca> botterry@ac.dal.ca writes:
>I am interested in using a mouse systems mouse (Genius Mouse with Mouse.com)
>for some i/o on my Turbo-C programmers.  Do I have to resort to Assembler in

This sounds kinky to me.  Do your Turbo-C programmers like this?

>order to use the mouse or are there undocumented (or documented that I can't
>find documented) Turbo-C commands?

It can be done in Turbo Pascal using the Intr procedure so I would believe it
possible in Turbo-C, in fact I wouldn't be suprised if Turbo C also has a
Intr function.

Assuming it does then all you need is the interrupt number for the mouse (33h)
and the command reference.  The latter, I would tell you now but I'm at home
and don't have it available.  Some texts on PC programming will have it.


Milt Sagen                    Internet: sagen@nucthy.physics.orst.edu
N.W. Hayes Apt. 8
Corvallis, OR  97330          Tele: (503) 754-8117

rogers@SRC.Honeywell.COM (Brynn Rogers) (02/23/90)

In article <8873@wpi.wpi.edu> ear@wpi.wpi.edu (Eric A Rasmussen) writes:
>In article <1264@ac.dal.ca> botterry@ac.dal.ca writes:
>>I am interested in using a mouse systems mouse (Genius Mouse with Mouse.com)
>>for some i/o on my Turbo-C programmers.  Do I have to resort to Assembler in
>>order to use the mouse or are there undocumented (or documented that I can't
>>find documented) Turbo-C commands?
>
>When I purchased my Logitech mouse a couple of years ago, it came with
>documentation (on disk) about how to use the mouse with high level languages
>including Modula-2/86, Turbo Pascal, Microsoft C, and even Basic via assembly
>language routines.  The Logitech mouse, from what I understand, is a Mouse
>Systems mouse compatible.  I believe it will also emulate a Microsoft mouse. 
>In the user's manual, it recommends calling Logitech's bulletin board for the
>latest list of languages supported.  I believe the following excerpts from the
>read.me file on one of the software disks contains the information that can
>help you.

My mouse didn't come with any programming information.
I have a C-9 (the newest model that also didn't have a name for a while)
with version 4.00 drivers.   I like the mouse, programming info would be nice.


I find the MSDOS Interrupt list to be the most complete source of information
on any interrupt driven devices (mouse, vga ...)  It can be found on simtel
somewhere and probably many bbs's (INTER589.ARC is the latest version I think)

Interrupt 33(hex) are all the mouse control functions for a microsoft compatable
mouse.   You can talk to mice through loading the registers and doing
the C interrupt function call.  In some cases, you can do things much more
efficiently (read faster) through an assembly call, because there seems to
be an appreciable overhead to the interrupt() calss built into most C langs.


There is a book from the Microsoft press that tells how to program the mouse
and includes a disk and examples and stuff (for under $30).  I can't recall the
name but it is copyrighted in 89 or 88, so it certainly is not out of date yet.


>-----------------------------------------------------------------------------
>LOGIMOUSE Electronic Information
>
>To report experiences and problems about the Logimouse software and hardware,
>you can now call our Vax system using a modem.  It accepts both 300 and 1200
>baud rates (not compatible with Racal-Vadic).  Log as the "mouse" user.
>This system will also provide new sources for LOGIMENU as they become
>available (we will be happy to publish those that you send us).
>
>	(415) 364-7057
>	Login: mouse
>

Logitech has a PC based BBS that can be reached at
       (415) 795-0408  

I believe it can handle anything up to 2400 baud.


 Brynn Rogers    Honeywell S&RC        rogers@src.honeywell.com
 home 612 874-7737  

few@quad1.quad.com (Frank Whaley) (02/23/90)

I've seen a number of responses to this, so let me post an offer.

I have a 462 line (7355 bytes) 'shar' file that demonstrates the use
of the Micros*ft mouse driver from Turbo C, which I'll mail to anyone
that sends me a request.  From the header:
-----
Attached is a 'shar' file containing 6 files (described below) which
demonstrate how I use the Microsoft mouse driver from Turbo C.
	mouse.h		Contains the declarations of data types and the
			mouse functions provided.
	mouse.c		The actual mouse functions -- one for each of the
			'public' routines provided by the latest version
			*I* have of the Micros*ft mouse driver.
	m1.c		A demonstration of installing a Turbo C function
			as a 'mouse trap' handler.  This program requires
			an assembler (TASM or MASM).
	m2.c		A much simpler demonstration of polling the mouse
			to provide remarkably similar output.
	m3.c		Another similar demo which demonstrates how to
			hide the mouse cursor, but show it whenever the
			mouse is moved or a button is pressed.
	mt.c		A demonstration of tracking the mouse in graphics
			mode (EGA 640x350x16) and plotting dots when a
			button is pressed.
-----
-- 
Frank Whaley
Senior Development Engineer
Quadratron Systems Incorporated
few@quad1.quad.com
uunet!ccicpg!quad1!few

Water separates the people of the world;
Wine unites them.

mccarthy@well.sf.ca.us (Patrick McCarthy) (02/23/90)

In article <1264@ac.dal.ca> botterry@ac.dal.ca writes:
>I am interested in using a mouse systems mouse (Genius Mouse with Mouse.com)
>for some i/o on my Turbo-C programmers.  Do I have to resort to Assembler in
>order to use the mouse or are there undocumented (or documented that I can't
>find documented) Turbo-C commands?

Depending on the level of mouse support you need, you may find it sufficient
to write C functions which communicate with the mouse driver via software
interrupts (i.e., by using the library function in86x()).  Howver, designing
a thorough interface takes a lot of work, so you may wish to buy a commercial
package.  I work for Blaise Computing in Berkeley, CA; we sell a package
called Turbo C TOOLS which lists for $149.  There are several others on the
market, so you may wish to call someone like Programmer's Connection,
which is a mail order house specializing in programming tools such as ours
and our competitor's.  They're located in Canton, OH, and have an 800
number you can get from information.

Pat McCarthy
mccarthy@well.uucp