Mouse: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(it works. thanks infiniteneslives)
 
(Replaced content with "Three controllers analogous to a computer '''mouse''' are known to be compatible with software for the NES or FC, either directly or through a simple adapter. *Super NE...")
Tag: Replaced
 
(45 intermediate revisions by 6 users not shown)
Line 1: Line 1:
The '''Super NES Mouse''' (SNS-016) is a peripheral for the Super NES that was originally bundled with ''Mario Paint''.
Three controllers analogous to a computer '''mouse''' are known to be compatible with software for the NES or FC, either directly or through a simple adapter.
It can be used with an NES through an adapter, made from an NES controller extension cord and a Super NES controller extension cord, that connects the respective power, ground, clock, latch, and data pins.


As with the [[standard controller]], the mouse is read by turning the latch ($4016.d0) on and off, and then reading bit 0 of $4016 or $4017 several times.
*[[Super NES Mouse]]
But its report is 32 bits long as opposed to 8 bits.
*[[Hori Track]]
*[[Subor Mouse]]


The first byte of the report can be ignored.  The other three bytes are in big-endian order:
[[Category:Pointing devices|*]]
<pre>
76543210  Second byte of report
||||++++- Signature: 0001
||++----- Current sensitivity (0: low; 1: medium; 2: high)
|+------- Left button (1: pressed)
+-------- Right button (1: pressed)
 
76543210  Third byte of report
|+++++++- Vertical displacement since last read
+-------- Direction (1: up; 0: down)
 
76543210  Fourth byte of report
|+++++++- Horizontal displacement since last read
+-------- Direction (1: left; 0: right)
</pre>
The displacements are in sign-and-magnitude, not two's complement.
For example, $05 represents five mickeys (movement units) in one direction and $85 represents five mickeys in the other.
 
The mouse can be set to low (x/4), medium (x/2), or high (x) sensitivity.
To change the sensitivity, send a clock while the latch ($4016.d0) is turned on.
 
A program MUST NOT play [[APU DMC|samples]] and read the mouse at the same time.
On the NES, sample playback causes occasional double reads on $4016 and $4017, which the program sees as bit deletions from the serial stream.
Ordinarily, one would read each controllers twice, compare the data, and use the previous frame's data if they don't match.
This works because the extra latch pulse to set up the second read has no side
effects on the [[standard controller|standard NES or Super NES controller]].
But an extra latch pulse sent to a mouse will clear the mouse's count of accumulated mickeys.
 
[[category:Controllers]]

Latest revision as of 16:19, 5 March 2022

Three controllers analogous to a computer mouse are known to be compatible with software for the NES or FC, either directly or through a simple adapter.