Thread View: comp.sys.amiga.tech
10 messages
10 total messages
Started by Lance Shorb
Fri, 07 Dec 1990 04:16
Mouse Buttons
Author: Lance Shorb
Date: Fri, 07 Dec 1990 04:16
Date: Fri, 07 Dec 1990 04:16
12 lines
993 bytes
993 bytes
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.
--
Lance Shorb Voice: 1-503-230-7747
lances@techbook.COM ...!{tektronix!nosun,uunet}techbook!lances
Public Access UNIX at (503) 644-8135 (1200/2400) Voice: +1 503 646-8257
Public Access User --- Not affiliated with TECHbooks
Re: Mouse Buttons
Author: Bob Fahey <NECR0SIS>
Date: Fri, 07 Dec 1990 20:33
Date: Fri, 07 Dec 1990 20:33
34 lines
1902 bytes
1902 bytes
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.
Ok, I have a question for the net: How do you read the middle button on
a mouse? (i.e. optical)
Hope this helps. (And if the addr's are wrong, I am sure the net will correct
me, but I am pretty certain about the #'s I gave)
>--
>Lance Shorb Voice: 1-503-230-7747
>lances@techbook.COM ...!{tektronix!nosun,uunet}techbook!lances
>Public Access UNIX at (503) 644-8135 (1200/2400) Voice: +1 503 646-8257
>Public Access User --- Not affiliated with TECHbooks
bob
| ///| a.k.a. NECR0SIS faheyr@silver.ucs.indiana.edu -or- |
| \\\///_| faheyr@rose.ucs.indiana.edu |
| \XX/ | M I G A "'Ere long done do does did..." - The Smiths |
| "...life is seen through the eyes of a dog..." - Skinny Puppy |
Re: Mouse Buttons
Author: Daryl Scott Cantrell
Date: Fri, 07 Dec 1990 22:37
Date: Fri, 07 Dec 1990 22:37
61 lines
3213 bytes
3213 bytes
In article <faheyr.660601986@silver> faheyr@silver.ucs.indiana.edu (Bob Fahey <NECR0SIS>) 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.
[...]
Amazing. You just broke two cardinal rules of Amiga programming in
but four lines. I guess assembly really is more powerful then C..
1) That's a dumb loop. Never never never on a multitasking system.
2) You're reading the hardware registers directly when there's no need
to. Intuition supports a perfectly valid way to do this.
3) From a pure functionality standpoint, I don't think that's what he
wanted to do. Your loop busy waits (never never) until one button
or the other is pushed (assuming the registers haven't been moved
elsewhere and you're not checking irrelavent data..). From the way
he phrased it, I believe he meant to simply have something like BOOL
LMB and BOOL RMB which he could check arbitrarily.
To the original poster:
I'll mail you the code to do it "the right way" if you'll tell me:
a) is this in your own custom screen?
b) will you be using menus?
c) will you need to be able to access both buttons or just the left?
To the query about 3rd mouse button (sorry, zapped it..):
Hmm, the only real way to do it is by looking at hardware registers.
The GOOD way to program this is to write a device driver which takes
this into account. For the BAD way, modify your own code from above..
>>Lance Shorb Voice: 1-503-230-7747
>>lances@techbook.COM ...!{tektronix!nosun,uunet}techbook!lances
>bob
>| ///| a.k.a. NECR0SIS faheyr@silver.ucs.indiana.edu -or- |
>| \\\///_| faheyr@rose.ucs.indiana.edu |
--
Programmer = (BypassesOpSys ? HAS_NO_TALENT : HAS_TALENT);
+---------------------------------------+----------------------------+
| // Daryl S. Cantrell | These opinions are |
| |\\\ milamber@caen.engin.umich.edu | shared by all of // |
| |// Evolution's over. We won. | Humanity. \X/ |
Re: Mouse Buttons
Author: Brian Jackson
Date: Sat, 08 Dec 1990 12:00
Date: Sat, 08 Dec 1990 12:00
37 lines
2154 bytes
2154 bytes
In article <faheyr.660601986@silver> faheyr@silver.ucs.indiana.edu (Bob Fahey <NECR0SIS>) 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 |
-----------------------------------------------------------------------
Re: Mouse Buttons
Author: Brian Jackson
Date: Sat, 08 Dec 1990 12:11
Date: Sat, 08 Dec 1990 12:11
23 lines
1674 bytes
1674 bytes
In article <1990Dec7.223736.15332@engin.umich.edu> milamber@caen.engin.umich.edu (Daryl Scott Cantrell) writes:
>In article <faheyr.660601986@silver> faheyr@silver.ucs.indiana.edu (Bob Fahey <NECR0SIS>) writes:
>
> To the query about 3rd mouse button (sorry, zapped it..):
>
> Hmm, the only real way to do it is by looking at hardware registers.
>The GOOD way to program this is to write a device driver which takes
>this into account. For the BAD way, modify your own code from above..
Actually, the middle mouse button is readable under DOS 1.3. The
message is properly sent from the input device but Intuition screens
it out before it gets to the user. A properly written input handler
can get at it. Example code and executables exist (they do on GEnie, I
know.)
bj
>| // Daryl S. Cantrell | These opinions are |
-----------------------------------------------------------------------
| Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. |
| bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj |
-----------------------------------------------------------------------
Re: Mouse Buttons
Author: Christopher A. Wichura
Date: Sun, 09 Dec 1990 11:00
Date: Sun, 09 Dec 1990 11:00
25 lines
1852 bytes
1852 bytes
In article <1990Dec7.223736.15332@engin.umich.edu> milamber@caen.engin.umich.edu (Daryl Scott Cantrell) writes:
> To the query about 3rd mouse button (sorry, zapped it..):
>
> Hmm, the only real way to do it is by looking at hardware registers.
>The GOOD way to program this is to write a device driver which takes
>this into account. For the BAD way, modify your own code from above..
Can anyone say whether support for the 3rd mouse button was added in
KickStart 2? I'd bve nice if Intuition returned events for it just as it
does the other two...
-=> CAW
Yes, I have a three button mouse...
/////////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Christopher A. Wichura |Real programmers don't play tennis, or
caw@miroc.chi.il.us (my amiga) |any other sport that requires you to
u12401@uicvm.uic.edu (school account)|change clothes. Mountain climbing is
|OK, and real programmers wear their
Please! Do not send mail to my school|climbing boots to work in case a
account unless mail to miroc bounces.|mountain should suddenly spring up in
I often do not check uicvm.uic.edu |the middle of the machine room.
for periods in excess of a week. | --Unix Fortune
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\|//////////////////////////////////////
Re: Mouse Buttons
Author: Peter da Silva
Date: Sun, 09 Dec 1990 14:02
Date: Sun, 09 Dec 1990 14:02
9 lines
959 bytes
959 bytes
In article <16383@cbmvax.commodore.com> bj@cbmvax.commodore.com (Brian Jackson) writes: > Actually, the middle mouse button is readable under DOS 1.3. The > message is properly sent from the input device but Intuition screens > it out before it gets to the user. Is this fixed in 2.0? -- Peter da Silva. `-_-' <peter@sugar.hackercorp.com>.
Re: Mouse Buttons
Author: Dale Luck
Date: Sun, 09 Dec 1990 23:46
Date: Sun, 09 Dec 1990 23:46
21 lines
1683 bytes
1683 bytes
In article <16383@cbmvax.commodore.com> bj@cbmvax.commodore.com (Brian Jackson) writes:
>6.15332@engin.umich.edu> milamber@caen.engin.umich.edu (Daryl Scott Cantrell) writes:
>>86@silver> faheyr@silver.ucs.indiana.edu (Bob Fahey <NECR0SIS>) writes:
>> To the query about 3rd mouse button (sorry, zapped it..):
>> Hmm, the only real way to do it is by looking at hardware registers.
>
>Actually, the middle mouse button is readable under DOS 1.3. The
>message is properly sent from the input device but Intuition screens
>it out before it gets to the user. A properly written input handler
>can get at it.
Even easier is the hack I use for X. I check the qualifier bits in the
intuition message. There are three there for the state of the mouse
buttons. Although under 1.3 I can't detect a middle button event without
the mouse moving or some other intuition event, it does not seem to
be that much of a problem. It sure beat writing a input handler and a
pass around thing. Then again 2.0 or the a2024 junpstart disk, the
problem was fixed.
--
Dale Luck GfxBase/Boing, Inc.
{uunet!cbmvax|pyramid}!amiga!boing!dale
Re: Mouse Buttons
Author: Carl Edman
Date: Mon, 10 Dec 1990 05:20
Date: Mon, 10 Dec 1990 05:20
38 lines
2515 bytes
2515 bytes
In article <caw.3745@miroc.Chi.IL.US> caw@miroc.Chi.IL.US (Christopher A. Wichura) writes:
In article <1990Dec7.223736.15332@engin.umich.edu> milamber@caen.engin.umich.edu (Daryl Scott Cantrell) writes:
> To the query about 3rd mouse button (sorry, zapped it..):
>
> Hmm, the only real way to do it is by looking at hardware registers.
>The GOOD way to program this is to write a device driver which takes
>this into account. For the BAD way, modify your own code from above..
Can anyone say whether support for the 3rd mouse button was added in
KickStart 2? I'd bve nice if Intuition returned events for it just as it
does the other two...
-=> CAW
Yes, I have a three button mouse...
So do I. There are a few things which help.
First: There is Middlebutton. It is a nice little event-handler which
works fine together with all those other little event handlers. It
merely adds a qualifier to all other events which happen while the
middle mouse button is depressed. You can use this to great advantage
e.g. together with dmouse. My dmouse is configured to flip screens
when the right mouse button is depressed together with the middle
mouse button. Quite useful, especially with those multiple wb screens.
Second: Judging from the ScreenX 3.0 documentation, which claims that
it will do certain things when the middle mouse button is depressed
under 2.0, 2.0 seems to support the middle mouse button. The most
amazing thing is that although I don't run 2.0, screenx corresponds
correctly. Maybe MiddleButton emulates the correct 2.0 behavior ?
Carl Edman
Theorectical Physicist,N.:A physicist whose | Send mail
existence is postulated, to make the numbers | to
balance but who is never actually observed | cedman@golem.ps.uci.edu
in the laboratory. | edmanc@uciph0.ps.uci.edu
Re: Mouse Buttons
Author: Henrik Clausen
Date: Mon, 10 Dec 1990 13:20
Date: Mon, 10 Dec 1990 13:20
18 lines
1407 bytes
1407 bytes
In article <7237@sugar.hackercorp.com>, Peter da Silva writes:
> In article <16383@cbmvax.commodore.com> bj@cbmvax.commodore.com (Brian Jackson) writes:
> > Actually, the middle mouse button is readable under DOS 1.3. The
> > message is properly sent from the input device but Intuition screens
> > it out before it gets to the user.
>
> Is this fixed in 2.0?
Yes, I've verified this, and have an option for three-button mice in my
program.
-Henrik
______________________________________________________________________________
| Henrik Clausen, Graffiti Data | If the Doors of Perception where cleansed, |
| ...{pyramid|rutgers}!cbmvax! | Man would see Reality as it is - Infinite. |
\______cbmehq!adspdk!hclausen___|_________________________________W. Blake___/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads