[comp.os.msdos.programmer] Writing a program that uses a mouse - help needed

weasel@frey.nu.oz.au (Geoff Skellams) (11/05/90)

	I am interested in writing a program in Turbo C that is able to use a 
mouse. Unfortunately, I have been unable to find anything decent in any of the
books I have looked in (the only solution I have seen is to read the data
straight from the serial port).
	I figure that it will invlove installing interupt handlers that
look at the interrupt vectors hooked by the mousedriver, but I have not done 
anything like that before and am a little apprehensive on how to go about it.
	Can anyone out there point me in the direction of a book to read,
or even better, some C source code (such as something on simtel etc)
showing me how do use the mouse?

Geoff Skellams
-- 
Geoff Skellams ( Weasel )				weasel@frey.nu.oz.au

"He wasn't very loveable, but he was bloody efficient" - 
		Kerry Packer, on one of his heroes, Genghis Khan

wjb@moscom.UUCP (Bill de Beaubien) (11/07/90)

In article <1990Nov5.003125.7426@frey.nu.oz.au> weasel@frey.nu.oz.au (Geoff Skellams) writes:
>
>	Can anyone out there point me in the direction of a book to read,
>or even better, some C source code (such as something on simtel etc)
>showing me how do use the mouse?
>
>Geoff Skellams

The mouse is generally accessed via int 33h, through a bunch of subservices.
These are listed in the documentation which comes with the mouse (at least,
they used to be for Microsoft).  I believe they're also documented in the
interrupt list maintained by Ralf Brown.  If you really want a book on
programming the mouse, Microsoft publishes one, complete with disc.  I 
believe it's about 40 dollars.  One of the summary editions of DOS extensions
also lists the mouse interrupts (runs about 6 bucks).

Good luck
   Bill
-- 
Bill de Beaubien / wjb@moscom.com 

tcs@router.jhuapl.edu (11/09/90)

In article <1990Nov5.003125.7426@frey.nu.oz.au>, weasel@frey.nu.oz.au (Geoff Skellams) writes:
>
>	I am interested in writing a program in Turbo C that is able to use a 
>mouse. Unfortunately, I have been unable to find anything decent in any of the
>books I have looked in (the only solution I have seen is to read the data
>straight from the serial port).
>	I figure that it will invlove installing interupt handlers that
>look at the interrupt vectors hooked by the mousedriver, but I have not done 
>anything like that before and am a little apprehensive on how to go about it.
>	Can anyone out there point me in the direction of a book to read,
>or even better, some C source code (such as something on simtel etc)
>showing me how do use the mouse?
>
>Geoff Skellams
>-- 
>Geoff Skellams ( Weasel )				weasel@frey.nu.oz.au
>
>"He wasn't very loveable, but he was bloody efficient" - 
>		Kerry Packer, on one of his heroes, Genghis Khan

Just as a possible point of interest, I subscribe to The Cobb Group's 
Inside TurboC and a few issues ago there was an article on the mouse (and 
in the next issue, one on how to change the arrow to something else). I use 
that source in one of my programs and I have it around here somewhere, but 
I am unsure as to whether I could mail it to you. I'm sorry that I can't 
give you the exact issue number (I'm here at work, not at home). If you 
wish, e-mail me and I will get the issue and address to write for back-
issues. 

Carl Schelin
tcs@router.jhuapl.edu

alan@ukpoit.co.uk (Alan Barclay) (11/13/90)

I'm trying to get a set of colors so I can use text mode but
with a graduation from deep red->white->deep green. I'm using
a VGA and Microsoft C 5.1, the following code sets up the colors

long newcolormap[] =
{
	0x000000L, 0x00003fL, 0x0a0a3fL, 0x14143fL,
	0x1e1e3fL, 0x28283fL, 0x32323fL, 0x1f1f1fL,
	0x323f32L, 0x283f28L, 0x1e3f1eL, 0x143f14L,
	0x0a3f0aL, 0x003f00L, 0x3f0000L, 0x3f3f3fL
};

void setupvga(void)
{
	_remapallpalette(newcolormap);
} 

but I have to use the Norton Command Centre to change the normal
pallete colors (0,1,..,5,20,7,56,57,..,63) to sequential numbers
(0,1,...,15) as the colors at 20 & 56 .. 63 don't change. Does any
one know how to set the pallete colors like NCC does or alternately
how to set these colors over 16.

stever@Octopus.COM (Steve Resnick ) (11/15/90)

In article <1583@ukpoit.co.uk> alan@ukc.ac.uk (Alan Barclay) writes:
>
>I'm trying to get a set of colors so I can use text mode but
>with a graduation from deep red->white->deep green. I'm using
>a VGA and Microsoft C 5.1, the following code sets up the colors
>
>long newcolormap[] =
>{
>	0x000000L, 0x00003fL, 0x0a0a3fL, 0x14143fL,
>	0x1e1e3fL, 0x28283fL, 0x32323fL, 0x1f1f1fL,
>	0x323f32L, 0x283f28L, 0x1e3f1eL, 0x143f14L,
>	0x0a3f0aL, 0x003f00L, 0x3f0000L, 0x3f3f3fL
>};
>
>void setupvga(void)
>{
>	_remapallpalette(newcolormap);
>} 
>
>but I have to use the Norton Command Centre to change the normal
>pallete colors (0,1,..,5,20,7,56,57,..,63) to sequential numbers
>(0,1,...,15) as the colors at 20 & 56 .. 63 don't change. Does any
>one know how to set the pallete colors like NCC does or alternately
>how to set these colors over 16.

According to my references here, BIOS int 10H function 10H sets the palette
registers (like NCC does) for EGA/VGA display adapters. The information
is quite lengthy however. I am relatively sure that this is listed in
Ralf Brown's interrupt list. You may want to look there.

Hope this helps....
Steve


-- 
----------------------------------------------------------------------------
steve.resnick@f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick
Flames, grammar errors, spelling errrors >/dev/nul
The Asylum OS/2 BBS - (408)263-8017 IFNA 1:143/105.0