[comp.sys.cbm] 1350/1351 mice and c64 a/d conversion

hedley@cbmvax.cbm.UUCP (Hedley Davis) (01/21/87)

There are alot of questions about the 1350/1351 mice on the net.

The Amiga mouse is a simple device providing raw quadrature signals at
the DB9 connector. There are two sets of quadrature signals, one for x
and one for Y. These signals are fed to the custom chips in the Amiga
where they are scanned and interpreted at a high rate of speed. ( On the
order of Khz ). 

The 1350 mouse was an effort to provide a mouse for the c64/c128 series
computers which could be used with all of our existent joystick based
software. It consists of an Amiga mouse with a small 4 bit micro which 
interprets the quadrature signals and converts them into joystick like
signals. Every change in the quadrature inputs to the micro processor
results in a 20 MS. pulse to the appropriate joystick direction line.
These 20 MS. pulses ( Low active, open collector ) can be retriggered
so that a fast rate of mouse motion will result in the appropriate
signal being continuously asserted. The 1350 is all well and good for
use with software expecting a joystick, but you cannot use a joystick
for drawing circles in a paint package, therefore a true proportional
mouse was designed for the c64/c128 computers.

The 1351 mouse is like the 1350 expect that instead of a 4 bit micro, a
custom gate array has been added. The mouse has two modes of operation.
The mode of operation is selected when the mouse is powered up. When
powered up, the mouse will default to the primary mode of operation,
unless the right button is depressed in which case, the mouse will
power up in the secondary mode of operation. 

The secondary mode of operation is like that of 1350, i.e. the mouse
acts like a joystick.

The primary mode of operation allows the mouse to act like a true
proportional mouse. It uses the SID pot registers to pass digital
position information from the mouse directly into the c64/c128 memory
map without processor intervention. This is because the SID A/D
conversion cycle is performed automatically every 512 CPU cycles. If you
buy a 1351 mouse, a disk is included with source code and demo programs
designed to be of assistance to those wishing to write programs which
may utilize the mouse. I won't go into the nitty gritty operation at
this point unless somebody yells about it. Suffice to say that it is
only neccesary to poll the mouse at a 60Hz rate in order to accurately
determine its position.

SO the point is that the Amiga mouse is NOT interchangeable with the 1350
or 1351 series mice. The 1350 is a subset of the 1351. For c64/C128 users
who want true proportional mouse capability, the 1351 is the obvious
choice. 

I will go briefly over the SID a/d cycle as somebody out there has been
asking questions. 

The SID conversion cycle is 512 CPU cycles long. During the first 256
clocks, SID sinks both POT lines via open collector drivers. This
discharges the small caps shown on the schematic. During the next 256
cycles, SID releases the POT lines, and starts an 8 bit counter.
Normally, the pot input is connected to a variable resistor connected
to 5 volts. The capacitors will charge at a rate dependent on the caps
value ( fixed by the computer ), and the resistor ( user adjustable ).
When the voltage at the pot input crosses a threshold ( nominally  2.5
volts ), the eight bit counter value is latched into the appropriate SID
POT register. At the end of the second 256 clocks, the SID again clamps
the POT lines to ground restarting the cycle. The conversions are
automatic, and cannot be affected by the processor.


One thing to note is the POT signals at the joystick connectors are
routed through a 4066 analogue switch before reaching SID. The 4066
acts a MUX allowing the two SID pot lines to be used for both sets of
pot lines used for the two sets of joystick connectors. The control
which selects which set of pot lines are seen by SID is one of the
keyboard scan lines ( see the schematic in the C64 programmers reference
guide ). This means that every 60th of a second, the keyscan comes
along, and mucks with the POT signals. This really buggers readings from
the pot lines, so if you wish to use the POT signals for any type of a/d
conversion you should write a small blurb of interrupt code, and insert
it into the normal interrupt routine via the IRQ vector.
The keyscan takes just a little bit of time, and if you read the pot
lines at the beginning of the interrupt service routine before the
keyscan, then the values in the POT registers should be accurate.

Hedley Davis
1351 design engineer

cuda@ihlpg.UUCP (01/23/87)

> I will go briefly over the SID a/d cycle as somebody out there has been
> asking questions. 
> 
> Hedley Davis
> 1351 design engineer

Thank you.  That was what I was looking for.

Mike Nelson
ihlpg!cuda