[comp.sys.ibm.pc] Mouse

MRS120@PSUVM.BITNET (01/25/89)

I am trying to interface a Turbo Pascal 4.0 program with the Microsoft
Mouse driver & am having some difficulties.  My problem boils down to
the following:
     After loading the mouse driver & my program I want to configure
     the mouse so that when either button is pushed, an interrupt
     routine I have written (In Turbo pascal 4.0) is called & executed.

     Using Int 33h, setting AX to 12, CX to Mask, and DX to OFFSET, one
     would expect everything to work fine... wrong.  A detailed trace
     shows the OFFSET value being passed is pointing to La-La land &
     thus this doesn't work.  Fine.  Next try:

     Writting my OWN assembly routine (not trusting Turbo Pascal to pass
     a correct OFFSET value) still blows up the computer, BUT:  A trace
     shows the mouse driver correctly passing off control to my short
     assembly driver.  Unfortunately, all my routine attempts to do is
     RETurn control to the mouse interrupt routine.  Nothing happens
     & the system hangs.  Tracing shows the system returning to some
     empty segment of memory (ie: Definitely the wrong place).

     Any ideas?  Is there some mystic, Microsoft blessed, way of returning
     control from this?  Arghhhhhh!!!!!

     Thanx in advance...

----------------------------------------------------------------------------
                                 |
 Mark Supinski                   |  "Didja ever wonder what they do with
 MRS120@PSUVM.BITNET             |         frog ARMS?"
 Ma Bell (814) 867-2550          |
 U.S. Snail 207 Hammond Bldg     |   Ipsum Facto, E pluribus Unum, detente,
            Univ Park Pa 16801   |         Chow Mein, Glastnost...
                                 |                You get the idea......
_________________________________|__________________________________________

kulokari@cc.helsinki.fi (HANNU, HYLK, PUH. 90/7084283) (01/27/89)

In article <68532MRS120@PSUVM>, MRS120@PSUVM.BITNET writes:
> I am trying to interface a Turbo Pascal 4.0 program with the Microsoft
> Mouse driver & am having some difficulties.  My problem boils down to
> the following:
..
>      RETurn control to the mouse interrupt routine.  Nothing happens
>      & the system hangs.  Tracing shows the system returning to some
>      empty segment of memory (ie: Definitely the wrong place).

The "Mouse Interrupt Routine" is interrupt routine in name only.
Actually, it is called by the mouse driver by FAR call, and should
exit by FAR RET, not IRET. If you exit by IRET, one word too many
is popped (the flags, which aren't there).

If you insist on using Turbo interrupt procedure, you must insert
some inline code at the end. The code should pop the saved registers
and do a far return.

Hannu Kulokari
Computing Centre, University of Helsinki, Finland

sullivan@marge.math.binghamton.edu (fred sullivan) (01/30/89)

In article <68532MRS120@PSUVM> MRS120@PSUVM.BITNET writes:
>I am trying to interface a Turbo Pascal 4.0 program with the Microsoft
>Mouse driver & am having some difficulties.  My problem boils down to
>the following:
>     After loading the mouse driver & my program I want to configure
>     the mouse so that when either button is pushed, an interrupt
>     routine I have written (In Turbo pascal 4.0) is called & executed.
>
>     Using Int 33h, setting AX to 12, CX to Mask, and DX to OFFSET, one
>     would expect everything to work fine... wrong.  A detailed trace
>     shows the OFFSET value being passed is pointing to La-La land &
>     thus this doesn't work.  Fine.  Next try:
>
There is an archive at SIMTEL20 in the mouse directory with sample turbo
pascal programs which do exactly what you want.  I think it's called
rodent.arc.

Anyway, here's the scoop.  The routine has to be a curious blend of an
interrupt routine (as in turbo pascal or c) and a normal (far) routine.

In particular, it must push all the registers at the beginning, pop them
all at the end, like an interrupt routine, but return with a ret rather
than an iret.

The sample from simtel20 does this by compiling the routine as an interrupt
routine, but with inline assembly at the end which pops all the registers
and then does a ret.  This leads to a bizarre code sequence:
pop reg pop reg ... pop reg ret pop reg pop reg ... pop reg iret
where the first bunch of pops are generated by the inline assembly and the
last bunch by the compiler.  It works.  In turboc, you can declare the routine
far and put in the pushes and pops.

Fred Sullivan				SUNY at Binghamton
Dept. Math. Sciences			Binghamton, NY 13903
					sullivan@marge.math.binghamton.edu
First you make a roux!

brown@maccs.McMaster.CA (Rock Brown) (04/27/89)

Hello

Does anyone have any information on mouse routines in C/asm?
(preferably for Turbo 2.0)
Any good books, an archive site which has PD code, etc. would be 
appreciated.

Please email responses.
Thanks in advance.
Rock

--
Rock Brown
McMaster University
brown@maccs.McMaster.CA
...!uunet!utai!utgpu!maccs!brown

dold@mitisft.Convergent.COM (Clarence Dold) (11/08/89)

in article <5284@cps3xx.UUCP>, usenet@cps3xx.UUCP (Usenet file owner) says:

> position, etc. etc.).  A quick scan of the libraries provided with
> Microsoft C v5.1 doesn't reveal any mouse support.  Peter Norton doesn't
> talk about mice in his book on the IBM PC.  Help!!!

The Microsoft Mouse User's Guide has a section on calls to Mouse.lib
(provided).  I found that the mouse calls are actually calls to INT33,
after the Mouse driver is loaded.  What is given as a list of arguments
named %M1, %M2,... are regs.x.ax, regs.x.bx, ... (in Microsoft C).

The 'Interrup.lst' posted to this group also shows the same INT 33 calls.
-- 
---
Clarence A Dold - dold@tsmiti.Convergent.COM		(408) 434-5293
		...pyramid!ctnews!tsmiti!dold
		P.O.Box 6685, San Jose, CA 95150-6685	MS#10-007