[comp.os.msdos.programmer] Interfacing to the Mouse Driver

mlf@genrad.UUCP (Matt Fichtenbaum) (12/03/90)

Some past articles have discussed difficulties people have had in using
int 33 function 0c to install one's own event handler such that the [Microsoft
and compatibles] mouse driver calls it when a mouse event (button press,
movement) occurs.  Two things to note:

1. The mouse driver calls the handler with the DS register pointing to its -
   the mouse driver's - data segment, not the handler's.  In Turbo C the handler
   can be declared as "huge;" in QuickC some inline assembly is needed.

2. The QuickC debug-mode stack check, in which each routine verifies that there
   is sufficient room on the stack for its local variables, gets confused when
   the user's handler calls the stack-check routine before DS has been
   "corrected."  This can be avoided by using #pragma check_stack(off) to
   suppress stack checking for the handler.  I don't know if Turbo C has a
   corresponding problem.

Matt
"Our job is to rescue fires, not to put out your cat."

ralf@b.gp.cs.cmu.edu (Ralf Brown) (12/04/90)

In article <HUGHES.90Dec3091513@maelstrom.Berkeley.EDU> hughes@maelstrom.Berkeley.EDU (Eric Hughes) writes:
}In MS C the _loadds keyword was added for cases exactly like this.
}This generates a PUSH DS; MOV DS, SEG DGROUP prologue and a 
}POP DS epilog.  (If I remember correctly...)

Turbo C++ also has _loadds.
-- 
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/3.1
BITnet: RALF%CS.CMU.EDU@CMUCCVMA   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | Everything is funny as long as it is happening to
I claim something?| someone else.  --Will Rogers