Amiga, Atari and Mac Classic Mouse - retronicdesign/USBJoystickAdapter_v3.2 GitHub Wiki

image image image

Amiga Mouse pinout

image

PIN FUNCTION  
1 V-Pulse  
2 H-Pulse  
3 VQ-Pulse  
4 HQ-Pulse  
5 Button 3 (M) *some 3rd party models  
6 Button 1 (L)  
7 +5v  
8 Gnd  
9 Button 2 (R)  

Atari Mouse pinout

image

PIN FUNCTION  
1 X1-Pulse  
2 X2-Pulse  
3 Y1-Pulse  
4 Y2-Pulse  
5 Button 3 (M) *some 3rd party models  
6 Button 1 (L)  
7 +5v  
8 Gnd  
9 Button 2 (R)  

Mac Classic Mouse pinout*

image

PIN FUNCTION  
1 Chassis Gnd  
2 +5v  
3 Gnd  
4 X2-Pulse  
5 X1-Pulse  
6 nc  
7 Button  
8 Y2-Pulse  
9 Y1-Pulse  

*Need a D-SUB 9 gender changer to operate

Theory of operation

Our D-SUB 9 joystick adapter can also operate as an HID standard mouse. These 3 mices despite their different pinouts have a common operation method. They all use rotary encoder outputs to feed the host computer their delta displacement horizontaly and vertically from the ball movement.

Rotary encoders in their minimal configuration require 3 elements;

  • A rotating disk with slots punched at regular interval on the outer edge. Slots shoud be placed at an interval the same lenght as their opening size. (50% duty-cycle) The more the slots, higher will be the movement reading precision.
  • Two sensors (installed half the lenght of a slot from each other (90 degrees in phase)
  • Two light sources coupled with each sensor to "see" the slot opening.

Let's name one sensor A and the other one B. Because each are installed half the lenght of a slot from the other, first sensor to change its status will determine the direction the disk is rotating. To calculate displacement, each change in A and B gives 1/2 the lenght of a slot width. This is called a quadrature output. Note that sensibility can be adjusted via software to increment/decrement the delta displacement for each detected movement.

image image

There are two assemblies like this in a mouse, one for the horizontal and one for the vertical displacement of the ball.

image

Real-time software decoding technique

To simplify and accelerate delta calculations in software, a 4x4 state change table is used:

  0 1 2 3
0 0 1 -1 X
1 -1 0 X 1
2 1 X 0 -1
3 X -1 1 0

To use this state table, you have to combine A and B readings in a 2 bit value. LSB is A and MSB, B. Columns represent the actual value of the 2-bit readings while lines are the previous 2-bit reading state. For example, if you had A and B low (0) and you currently read A low and B high (2), delta displacement is -1. Note that X are impossible state change.

Our software uses state change interrupts to trigger this table pointing routine. Result is obtained in minimal CPU cycles. We store the displacement in delta accumulators so at the next USB polling, movements captured are transmitted to the host computer. Real-time capture combined with asychroneous data transmission.