Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!ucsd!ucbvax!hplabs!hp-pcd!hpcvra!everett From: everett@hpcvra.CV.HP.COM (Everett Kaser) Newsgroups: comp.os.msdos.programmer Subject: Re: Programming the Mouse Message-ID: <31600001@hpcvra.CV.HP.COM> Date: 31 Jul 90 19:24:49 GMT References: <1990Jul30.182430.7493@uokmax.uucp> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 31 / gene@uokmax.uucp (Gene E. Johannsen) writes... > I am writing a program that I want to use the mouse with. I don't >have a reference work to the mouse so I am using a list of interrupts. Below >is a small program I writing to learn how to use the mouse. All it will do is >set up and turn on the mouse and then print an '*' when I press the left >button. It prints the '*' but freezes immediately afterwards: >BUTTON PROC FAR > push ax ;This is where the problem comes. It prints > push dx ;the '*' okay, but then it freezes. > mov ah,02h > mov dl,2ah > int 21h > pop dx > pop ax > ret >BUTTON ENDP I believe that your problem is the call to DOS (INT 21h) inside your mouse event handler routine. Since the mouse generates a hardware interrupt, which controls CPU execution to be vectored to the mouse driver, which then calls your routine, you cannot call DOS, only manipulate your own code/data space, make calls to INT 33h (the mouse driver), directly manipulate the display (dangerous), etc. Since in your main program you've called DOS to get a key, when you call DOS from the mouse event handler (which was called from a hard- ware ISR), you're re-entering DOS. DOS was not designed to be re-entrant and you screw up their stacks and flags and stuff. Everett Kaser Hewlett-Packard Company ...hplabs!hp-pcd!everett work: (503) 750-3569 Corvallis, Oregon everett%hpcvra@hplabs.hp.com home: (503) 928-5259 Albany, Oregon