10 August 2017, 17:34 | #1 |
Amigan
Join Date: Feb 2012
Location: London
Posts: 1,309
|
Scroll wheel with PS/2 mice
Hi,
I recently started playing around with some cool little Arduinos (Minis & Nanos) and was able to create a PS/2 Amiga mouse adapter. It seems to work well but I would like to implement scroll wheel support. The Amiga mouse port only has 2 quadrature encoders so this is not straightforward. Some designs use the joystick port as well but this feels a bit hacky for me. I notice that the Cocolino claims to support the scroll wheel. Does anyone know how they implement this? The best idea I can think of is to pull all 3 mouse buttons high which signals to a custom mouse driver that the X/Y quadrature encoder is now the scroll wheel. This is something a beginner in electronics can easily construct, it's literally just soldering a few wires to a £2 Arduino clone. |
10 August 2017, 17:52 | #2 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
And yes, it's a thing. I have a Cocolino, and I think it sucks because of this hack. |
|
10 August 2017, 18:12 | #3 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
This page shows the pinout of the Amiga's game port: http://old.pinouts.ru/Inputs/AmigaMouseJoy_pinout.shtml
If you could somehow utilise the PotX input to simulate an analogue signal, you could make a very accurate mouse wheel. With the PotY you could even read a second wheel. Just keep in mind that PotX is shortened by the middle mouse button and PotY by the right button. |
10 August 2017, 18:39 | #4 | |
Registered User
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
|
Quote:
If memory serves, the Punchinello Mk II did some kind of simulation of analogue signals. The problem with this method is that the analogue counters on the Amiga count at different rates depending on the current screenmode. |
|
10 August 2017, 18:54 | #5 |
Amigan
Join Date: Feb 2012
Location: London
Posts: 1,309
|
Thanks guys! Looks like the 3rd mouse button is the key. I wasn't aware the Amiga could write to the POT registers. This is very helpful!
|
10 August 2017, 19:00 | #6 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Don't add support for a scroll wheel. Your adapter will end up being horrible like the Cocolino. I know, I have one. Wouldn't have bought it if I knew beforehand, and would have bought a normal Amiga mouse instead.
Really, DON'T. |
10 August 2017, 20:38 | #7 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Joysticks with more than 3 buttons send them this way ; middle button + wheel up + wheel down could simply do the same. |
|
11 August 2017, 06:28 | #8 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
See here: http://www.amiga.org/forums/showpost...0&postcount=32 Last edited by Thorham; 11 August 2017 at 06:40. |
|
11 August 2017, 08:11 | #9 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
|
|
11 August 2017, 08:14 | #10 | |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Quote:
|
|
11 August 2017, 10:12 | #11 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
That flattening out on near-horizontal or vertical lines was something I always though was a "feature" of PC mice. To this day, you can easily draw a straight line of pixels in Paint or whatever on Windows by being careful with the movement, but the same thing is far more difficult using a native Amiga mouse. So perhaps it's part of the PS/2 protocol that has been replicated by some adaptors? Or maybe it's built into the controllers on some mice?
Anyway, using a PS/2 mouse on my Cocolino certainly feels different, but I haven't noticed a reduction in sensitivity or anything like that. And on the other hand, I'm totally lost on an Amiga when I *don't* have a scroll wheel, I've become that used to having it. If you're doing the software side on the Amiga yourself, you can use whatever communication scheme you like. The CD32 approach might indeed be a nice way to do things, switching to serial input mode once a frame to receive a minimal few bits of information from the adaptor along pin 9 (RMB). I have to say that I thought the Cocolino sent its extra information over pin 5, but maybe I'm wrong there... |
11 August 2017, 10:28 | #12 |
Registered User
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
|
Yeah, it doesn't discard the LSBs, it simply briefly re-uses them for wheel signals, during a vblank interrupt, and resets them again long before the system reads the mouse counters again during the next vblank. The LSBs are only changed in response to a signal from the wheeldriver, so if that's not running they're left alone. So whatever makes that particular adapter / mouse combination feel so horrible, it's something else, not the multiplexed wheel support.
[I'm assuming here that the Cocolino is indeed the same thing as the EZMouse - Amiga.resource.cx reckons it is.] |
15 August 2017, 15:40 | #13 |
Amigan
Join Date: Feb 2012
Location: London
Posts: 1,309
|
Thanks to everyone here. I have the scroll wheel mostly working.
Amiga VBlank interrupt server Every frame pull the middle button low. Delay a little by reading horiz changes in VHPOSR. Read middle/right mouse ports. Pull the middle button high. Signal() the main Task which does the input injection. Arduino Middle mouse button generates an interrupt when pulled low. The interrupt checks the status of the mouse wheel and writes to the middle/right mouse pins. Delay a bit Reset the pins. I had to use my scope to get the timing right on both sides. This gives me 4 commands. 0=Nothing 1=ScrollUp 2=ScrollDown 3=Unused. I could add another bit if I used the left button too. To do:
I fried 1 Arduino in the process - magic smoke and all Edit: forgot to add, the Amiga driver is optional. It's only used for scroll wheel support. Last edited by nogginthenog; 15 August 2017 at 16:01. |
15 August 2017, 15:51 | #14 |
Bit Copying Bard
Join Date: Jan 2017
Location: Kelty, Fife, Scotland
Age: 41
Posts: 1,293
|
Good work sir
|
16 August 2017, 00:59 | #15 | ||
Registered User
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
|
Quote:
Quote:
|
||
16 August 2017, 11:23 | #16 | |
Amigan
Join Date: Feb 2012
Location: London
Posts: 1,309
|
Quote:
Edit: I was wrong, I am using the internal pullup for the input! I also added the left mouse button to the VBL protocol. Now I can emulate the middle mouse button too. It's not using the real middle mouse button pin (tricky, but may be possible?) but an input event. Last edited by nogginthenog; 16 August 2017 at 11:52. |
|
15 October 2021, 23:25 | #17 |
Registered User
Join Date: May 2019
Location: Eindhoven
Posts: 12
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Scroll or Blockscroll with transparency? | earok | Coders. Blitz Basic | 5 | 30 January 2017 17:40 |
Scroll with the mouse? | BarrySWE | support.Apps | 14 | 29 May 2012 22:16 |
help me smooth scroll | rusty71 | support.WinUAE | 7 | 21 November 2011 15:36 |
Hardware Scroll tutorial? | Lonewolf10 | Coders. Tutorials | 14 | 24 January 2011 00:08 |
Using Mouse-Wheel Scroll in Workbench 3.1 | vroom6sri | New to Emulation or Amiga scene | 4 | 31 May 2007 11:06 |
|
|