[comp.sys.ibm.pc] Mouse handlers and Turbo c 2.0

gefuchs@top.cis.syr.edu (Gill E. Fuchs) (12/14/89)

Hi...

I have a simple problem that I have not been able to find answers to in any
books.

I am trying to use the Microsoft Mouse driver, function 12 (0CH) to
set my own handler... for mouse events...(This works fine using a far call)
but once an event occurs and the handler is called the handler cannot 
access any variables outside that routine...

Code is as follows


typedef MOUSE_EVENT struct M_E {
    int down,button,x,y;}
struct MOUSE_EVENT far *mevent;
far handler(void);

main()
{ ....
  ....
  mevent->down=0;
  setup_handler(....);
  loop: while (mevent->down==0) then goto loop;
  .....
  .....
  Do_sumthing();
}

far handler()
{  mevent->down=1;
   mevent->button=_BX;
   mevent->x=_CX;
   mevent->y=_DX;
}


The problem is that mevent->down is not set to 1 after calling the handler.

(note that i am using turbo C 2.0)

Thankyou for any help out there....

P.S.  Anybody out there with the descriptions for dip switch settings for
      an Epson Rx-80 F/T...I have lost the manual and need to adjust them...

Thankyou once again...

Vahid Koussari
Gefuchs@top.cis.syr.edu

lloyd@comp.vuw.ac.nz (Lloyd Parkes) (12/18/89)

try setting the storage class of mevent to volatile. e.g.

volatile struct MOUSE_EVENT far *mevent;

				Lloyd
--
------------------------------------------------------------------------
Lloyd	| lloyd@comp.vuw.ac.nz	  | "... I can gleek upon occasion." - 
Parkes	| ...!uunet!vuwcomp!lloyd | Nick Bottom
------------------------------------------------------------------------