Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hplabs!pyramid!cbmvax!bj From: bj@cbmvax.commodore.com (Brian Jackson) Newsgroups: comp.sys.amiga.tech Subject: Re: Mouse Buttons Message-ID: <16382@cbmvax.commodore.com> Date: 8 Dec 90 12:00:38 GMT References: <1990Dec7.041658.14294@techbook.com> Reply-To: bj@cbmvax.commodore.com (Brian Jackson) Distribution: na Organization: Commodore, West Chester, PA Lines: 37 In article faheyr@silver.ucs.indiana.edu (Bob Fahey ) writes: >lances@techbook.com (Lance Shorb) writes: >> I'm interested in finding a method to determine the status of both mouse >> buttons (ie. LeftDown, LeftUp, RightDown, RightUp) without having to >> sort through a pile of IDCPM, or CONSOLE device messages. >> There's got to be an easier way. > >Yes, indeed, there is an easier way: Check the registers. >From what I remember, here's how it goes: > >mouse: btst #6,$bfe001 ;0 = lbutton up, 1 = lbutton down > beq.s out > btst #10,$dff016 ;0 = rbutton up, 1 = rbutton down > bne.s mouse >out: ... > >This will repeat the loop until either the l- or r-button is hit. Once again, folks, this type of thing is a major taboo. First, don't access the hardware in this manner. If you write your code properly, then you shouldn't have to "sort through a pile of messages." If you are getting "a pile" then you either asked for them or, at least, better be concerned as to what they are :) Secondly, the above example busy loops. This will suck down major CPU time, slowing everything else in the system - often by a large amount. Don't do this. bj >bob ----------------------------------------------------------------------- | Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. | | bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj | | 'Please dosconnect in your mind the concepts "seems to work just | | fine' and 'Is allowed' - Peter Cherna | -----------------------------------------------------------------------