Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!sunybcs!bingvaxu!marge.math.binghamton.edu!sullivan From: sullivan@marge.math.binghamton.edu (fred sullivan) Newsgroups: comp.sys.ibm.pc Subject: Re: Mouse (int 33h) problems Message-ID: <1778@bingvaxu.cc.binghamton.edu> Date: 30 Jan 89 04:41:51 GMT References: <68532MRS120@PSUVM> Sender: news@bingvaxu.cc.binghamton.edu Reply-To: sullivan@marge.math.binghamton.edu (fred sullivan) Organization: Dept. of Mathematical Sciences, SUNY at Binghamton Lines: 36 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!