It is currently Sun Jun 16, 2019 4:40 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Sat Jan 05, 2019 7:41 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
Discovered today when doing some tests that the hyperkin SNES mouse cannot cycle its sensitivity via software. Reading the line while the strobe is up does not change its sensitivity. There is, however, a separate button on the bottom of the mouse, next to the optical sensor, that will manually cycle it (literally).

Because of this, anything that relies on this ability to detect the mouse (as currently suggested on the wiki, which I will revise shortly), will fail to recognize the hyperkin as a mouse, unfortunately.

A list of relevant NES mouse software I know of:


Top
 Profile  
 
PostPosted: Sat Jan 05, 2019 8:41 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21439
Location: NE Indiana, USA (NTSC)
I filed an issue about the Hyper Click. It's waiting on my finding enough other things to order.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Sat Jan 05, 2019 10:44 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
As a follow-up, my Hyperkin mouse exhibits the following sensitivity behaviours:

The reported sensitivity is always 0, and this does change if I push the sensitivity button on the bottom of the mouse.

There are actually only two sensitivity settings for this device. High sensitivity produces values from -63 to 63 on each axis. Low sensitivity produces -31 to 31. It seems like the low setting just divides the magnitude in half. Hard to measure with any accuracy, but the response seems very linear vs. the mouse's physical speed. On both sensitivities it's easy to get reports of 1 displacement by moving slowly.
(Edit: this was updated twice with better measurements after producing test ROM below, and revising it.)

I don't see any jitter when the mouse is at rest. It's a very stable 0,0 report. The sign bit for a 0 seems to hold whatever it held last before reaching 0.

Checked the fifth byte read after the end of the report, and it seems to always be $80, which is curious.

Also, when moving the mouse while connected to my Famicom, I hear a faint sound, maybe at 850 or 1700 Hz. Assuming that's indicates some sort of periodic power draw from the mouse? (Another user who tested a Hyperkin with this ROM noticed a similar sound on their AVS.)


I visualized this with a sprite at 128,128 and a second sprite at 128+x,128+y, and I could easily see the hard square edge of the report range by moving the mouse vigorously. Unless someone else gets around to it before me, I'll follow up with a better test ROM later, but I'm not ready to release the thing I'm using at the moment, sorry. (Edit: made the test ROM, see below.)


I'm curious about how the SNES' mouse differs in this respect. The information about sensitivity that I've seen is a bit vague. I'm also surprised that I can find many, many review videos for the Hyperkin mouse but none seem to notice this difference in sensitivity (did find a couple amazon reviews that seem to address it though). Maybe it's a bit of a difficult thing to notice if you're not doing something scientific with it, but I'd be interested in hearing confirmation that the Hyperkin's sensitivity does work this way on an SNES as well, e.g. going into Mario Paint with it and trying the speed settings (does it make a difference, is it stuck on turtle, etc.).


Last edited by rainwarrior on Mon Jan 07, 2019 10:15 pm, edited 7 times in total.

Top
 Profile  
 
PostPosted: Sun Jan 06, 2019 1:12 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
I cut down my current project to make a little mouse test ROM.

Attachment:
mset.png
mset.png [ 3.92 KiB | Viewed 9536 times ]

mset.txt wrote:
Plug a SNES mouse (or equivalent) into either NES port, or a Famicom expansion adatper.
On reset, this program will search for a mouse on any of the four appropriate data lines. ($4016 d0/1, $4016 d0/1)
The first one found will be selected as the mouse. (The mouse is any device whose report's second byte ends with %0001)

5 bytes are read each frame.
A record of the last 24 frames is displayed on the left hand side.

The top right displays the last report.
The first and last bytes there are raised to indicate they are less important.
(First byte should be 00, last byte is past the end of the report.)

Just beneath this are two numbers, the first is the mouse port, and the second is the current sensitivity.
Port 0: $4016 d0 (NES)
Port 1: $4017 d0
Port 2: $4016 d1 (Famicom)
Port 3: $4017 d1
Port -: No mouse found.
Click the right mouse button to cycle the sensitivity setting.

Below this are two numbers indicating the lowest and highest X displacement reported,
followed by two more numbers indicating lowest and highest Y displacement reported.
Click the left mouse button to reset the lowest and highest to 0.

In the middle is the current offset displayed visually with a circle over a cross.


Source code is in mset_src.zip

Edit: revised test to widen report to 5 bytes, cleaned up code a bit and added some documentation.
Edit: Fixed bug that incorrectly displayed decimal 10 as 0.


Attachments:
mset_src.zip [52.25 KiB]
Downloaded 336 times
mset.nes [32.02 KiB]
Downloaded 334 times


Last edited by rainwarrior on Tue Jan 22, 2019 6:30 pm, edited 2 times in total.
Top
 Profile  
 
PostPosted: Mon Jan 07, 2019 9:35 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
Made an update to the test ROM with better code, and a bit more info, like what's in the first byte of the report, and what's in the byte after it.


Top
 Profile  
 
PostPosted: Tue Jan 22, 2019 5:59 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
Received an original SNES mouse for comparison.

1. The X/Y values hold the most recent sign when sitting at zero (same as Hyperkin).

2. Sensitivity 1 and 2 have very clear hard clamping at +/- 21, and +/- 28 respectively. I could not see any obvious hard limit for sensitivity 0, the highest value I managed to produce was 63.

3. Sensitivity 0 seems to produces a set of values linearly increasing with speed, though anything above 20 gets increasingly difficult to produce, 30 is very vigorous. Timing with a metronome and ruler and many repeated tests, this seems to roughly correspond to "inches per second" (at 60Hz polling) for my SNES mouse, maybe rounding up so that a value of 1 can be triggered with relatively slow motion.

Sensitivity 1 and 2 on the other hand seem to remap those first 8 linear values to a new set.

Sensitivity 0: 0,1,2,3,4,5,6,7,8,9... ...63?
Sensitivity 1: 0,1,2,3,8,10,12,21,21... (clamped)
Sensitivity 2: 0,1,4,9,12,20,24,28,28... (clamped)

I've seen both sensitivities 1 and 2 report some other values, but they almost always output from these two tables. I've never seen any values higher than 21 or 28.

5. Extra bits past the 4th byte read as all 1.


Last edited by rainwarrior on Wed Jan 23, 2019 12:13 am, edited 2 times in total.

Top
 Profile  
 
PostPosted: Tue Jan 22, 2019 6:04 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
Applying the metronome/ruler test with my hyperkin mouse, it seems roughly linear. The maximum value in either setting is reached by about 8 inches per second (60Hz poll). High sensitivity goes 0-63. Low sensitivity goes 0-31. All values in these ranges appear to be possible. The ratio of sensitivity does seem to be 2:1.


Last edited by rainwarrior on Wed Jan 23, 2019 12:14 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 12:09 am 
Offline

Joined: Sun Mar 03, 2013 1:52 am
Posts: 119
Location: Texas, USA
Wouldn't inches per second values be related to how often you read the mouse?:
  • If you are reading the mouse once per frame and a value of 3 appears to be 3 inches per second, then if you change to reading the mouse every other frame, a value of 3 would now represent 1.5 inches per second.
  • If you are reading the mouse once per frame on an NTSC system and a value of 3 appears to be 3 inches per second, then if you read the mouse once per frame on a PAL system, a value of 3 would now represent 2.5 inches per second.

For comparison, nocash's fullsnes - SNES Mouse - Mouse Sensitivity uses counts per inch: "The Mouse Resolution is specified as '50 counts/inch (+/-10%)'" (at the linear sensitivity setting).

For the original SNES ball mouse, would it be useful to?:
  • Measure the diameter of the ball.
  • Count the number of windows on one of the encoder wheels.


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 12:12 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
Ahh, good point. Yes, my "inches per second" was polling at 60Hz. I'm glad that 50 counts per inch is roughly in agreement of what I measured then.

Yes, measuring the ball and the rollers and counting the holes in the wheel sounds like a good idea. I will do this tomorrow.


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 11:56 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
Taking some measurements of my SNES mouse, I get:

Ball diameter: 0.97"
Roller diameter: 0.27"
Wheel: 20 slots

20 x (Ball : Roller) = ~72 holes per revolution
72 / (Ball * π) = ~24 holes per inch

So, from the measurements I was getting I'd have to assume the mouse counts each change from dark to light and vice versa, and with that assumption this (very rough measurement) would agree well with the stated 50 per inch spec?


As an additional test, I rebuilt my test ROM to run at 1/3 the framerate (20hz) just to verify a few things. The sensitivity 1/2 readings still come out according to the tables, and the sensitivity 0 is slightly easier to "max out" at 63 this way. The expected 3x multiplier from the lower poll rate applies as well.

The occasional "off table" value for sensitivities 1/2 are curious. I don't really have any theories about why this happens. Testing now I've seen rarer instances of 4, 6, 15, 18 in sensitivity 1, and 2, 3 in sensitivity 2. Have never seen any values above 21/28 though. When I say they happen rarely, I mean like if you're moving the mouse and watching the stream for a few seconds you're likely to catch one. They're not hard to reproduce, but they're relatively infrequent (maybe 1 in 50 if you're in a susceptible range?). They don't seem to appear spuriously, like every one I've spotted was next to nearby values in the table on adjacent frames.


Edit: Added 1/6 framerate (10hz) version for further testing. Also noticed the Hyperkin report is not dependent on the poll rate, unlike the SNES mouse. See below.


Attachments:
mset6x.nes [32.02 KiB]
Downloaded 317 times
mset3x.nes [32.02 KiB]
Downloaded 325 times


Last edited by rainwarrior on Wed Jan 23, 2019 2:28 pm, edited 1 time in total.
Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 2:20 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
A followup with the Hyperkin, when testing at 20Hz the output values seem to be the same, rather than 1/3. I suppose with the optical mouse it has its own internal update, and maintains a "current speed" that it reports when you poll it? So for that one I suppose "inches per second" would be a better description.


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 2:24 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8379
Location: Seattle
I vaguely think I remember reading some description of old PS/2 and/or serial mice that that was how they worked?

If that's true here too, then the "off table" values you're seeing could be the sum of two smaller values.


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 2:34 pm 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 915
The measured table/values are interesting. When displaying them in a table with fixed-width font, the multipliers for double/triple/quad speed seem to be chosen as so:
Code:
Sensitivity 0: | 0  | 1  | 2  | 3  | 4  | 5  | 6  | 7  | 8  | 9  | 10 | ... 63
Sensitivity 1: | 0  | 1  | 2  | 3  | 8  | 10 | 12 | 21 | 21 | 21 | 21 | ... 21
Sensitivity 2: | 0  | 1  | 4  | 9  | 12 | 20 | 24 | 28 | 28 | 28 | 28 | ... 28
               |    |    |    |    |    |    |    |    |    |    |    |
Multiplier 0:  <--1----------------------------------------------------------->
Multiplier 1:  <--1---------------><--2----------><-3-><--max----------------->
Multiplier 2:  <--1-----><-2-><--3-----><--4----------><--max----------------->
I guess the multiplying is done by table with 8 entries, that would explain why bigger values are clamped to max values. I hope the tables aren't too small, with the clamping occuring too early? Ie. the idea about sensitivity 1 and 2 should be to span longer screen distances with a short but quick mouse move. If the clamping prevents longer distances then there's something wrong : )

The unit "counts per second" was confusing me, too. Made me think of a test environment where you were moving the mouse at constant speed alongsides of a 5 meter runway... But I guess you were just moving the mouse back-and-forth, at metronome speed? Good idea (only problem would be (de-)accelleration when changing the direction between back & forth).
But anyways, "counts per second" makes some sense, "counts per inch" is right for sensitivity 0, but for the other sensitivities, it does also depend on the speed, so it could be called "counts per inch per speed" (or the like).

With the mouse tested polled at 60Hz and at 20Hz, it looks as if the "speed" boundaries are determined in "counts per poll" (rather than "counts per second").
For the odd values, maybe there's some extra rule alike "if new.value=fast AND previous.value=fast ONLY THEN multiply new.value by 2..4"?

Btw. another idea, if you would have two mice, you could move them together, at same speed, but with different sensitivity. Dunno if that would be really useful.


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 2:38 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
lidnariq wrote:
I vaguely think I remember reading some description of old PS/2 and/or serial mice that that was how they worked?

If that's true here too, then the "off table" values you're seeing could be the sum of two smaller values.

What was how they worked?

Like my current theory is that sensitivity mode 0 is just the underlying counter, i.e. clicks since last poll. And then in sensitivity mode 1/2 that value becomes a table lookup. That seems to work for everything except the rare "extra" values noticed.

The extras are all possible sums of values from the table, but I don't have an idea what would cause that summing to happen, or if it is a sum why it never exceeds the maximum table value?


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 2:45 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7499
Location: Canada
nocash wrote:
I guess you were just moving the mouse back-and-forth, at metronome speed? Good idea (only problem would be (de-)accelleration when changing the direction between back & forth).

Specifically I'm using the test ROM above, clicking LMB to reset the maximum values to 0, then moving the mouse trying to make the cord pass marks on the ruler in time with the metronome. I trying to starting a little distance before and stop a little after, so the brief slower begin/end doesn't affect the maximum measured. It probably sounds very inaccurate, but it's easy to do over and over, and the results I'm getting are fairly consistent.

nocash wrote:
Btw. another idea, if you would have two mice, you could move them together, at same speed, but with different sensitivity. Dunno if that would be really useful.

I have two mice, but one is the Hyperkin which works very different. Plus I only have one SNES to NES adapter. :S


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group