[comp.sys.atari.8bit] commodore mouse

slackey@bbn.com (Stan Lackey) (12/28/88)

Well, I just *know* I'm going to alienate both groups, but I am going
to say it anyway...

I am trying to use the Commodore mouse on my Atari.

The mouse runs in either of two modes: sleazy joystick mode, or proportional
mode.  I have gotton joystick mode to "work" as well as it can, but 
proportional mode would be much better.

The mouse docs say that the X/Y coords are sent on the pot lines.

Now - It seems that the way Commodore reads the pot lines is different from
the way Atari does.  Simply reading the pot registers as one would on the
Commodore does not work on the Atari.  Does the mouse send an analog voltage
proportional to the distance the mouse has moved?  Does anyone know?

I have directed followups to atari.8bit, or just reply.  Thanks. -Stan

fred@cbmvax.UUCP (Fred Bowen) (01/09/89)

In article <33889@bbn.COM> slackey@BBN.COM (Stan Lackey) writes:
>I am trying to use the Commodore mouse on my Atari. [...]
>The mouse docs say that the X/Y coords are sent on the pot lines.
>Now - It seems that the way Commodore reads the pot lines is different from
>the way Atari does.  Simply reading the pot registers as one would on the
>Commodore does not work on the Atari.  Does the mouse send an analog voltage
>proportional to the distance the mouse has moved?  Does anyone know?

I doubt you will be able to use the 1351 mouse's proportional mode- it takes
advantage of special features built into the C64/C128 computers.

The mouse uses the SID (the audio chip) POT registers to pass digital position
information from the mouse directly into the C64/C128 memory map without
processor intervention.

The SID A/D conversion cycle is 512 CPU cycles long.  During the first 256
clocks, SID sinks both POT lines, discharging some small caps in the computer.
During the next 256 cycles, SID starts an 8-bit counter and releases the POT
lines, allowing them to charge at a rate determined by the mouse.  When the
voltage at the POT input crosses a threshold the counter value is latched into
the appropriate SID POT register.  The conversions are automatic, and cannot
be affected by the processor.  Tricky, eh?

It is only necessary to poll the mouse at a 60Hz rate to accurately determine
its position.  If you buy a 1351 mouse, a diskette is included with 6502 source
code and demo programs.

--
-- 
Fred Bowen			uucp:	{uunet|rutgers|pyramid}!cbmvax!fred
				arpa:	cbmvax!fred@uunet.uu.net
				tele:	215 431-9100

Commodore Electronics, Ltd.,  1200 Wilson Drive,  West Chester,  PA,  19380

Bob_BobR_Retelle@cup.portal.com (01/11/89)

Fred Bowen writes about how the C-64 reads the 1351 Commodore mouse..
 
Fred, if you're still tuned in here, is this A/D process similar to the way
the C-64 reads the Paddle pots..?
 
The 8-bit Atari uses a somewhat similar way of reading the A/D ports through
hardware, although the scaling seems to be a little different.  The Atari
paddles on a C-64 give a slightly different range than the Commodore paddles
do...   also, a much asked question revolves around the differences between
the Atari and Commodore versions of the Koalapad touch tablet...
 
I guess this is mostly out of curiosity, not any immediate application..
 
As far as the proportional mode of the 1351 mouse, does the resultant data
get stored in the same locations as the paddle values..?  If so, it just might
be possible that the mouse could be read on an 8-bit Atari...  
 p t 0
I guess I'm just a little bit confused as to the actual input method from
the mouse... if it's a variable resistance, as in a paddle, does the computer
translate the x-y values into an absolute position, rather than relative
direction and speed values, as an Amiga or Atari ST mouse..?
 
Again, just mostly curiosity, I guess...
 
BobR

slackey@bbn.com (Stan Lackey) (01/12/89)

In article <13398@cup.portal.com> Bob_BobR_Retelle@cup.portal.com writes:
>Fred Bowen writes about how the C-64 reads the 1351 Commodore mouse..
>The 8-bit Atari uses a somewhat similar way of reading the A/D ports through
>hardware, although the scaling seems to be a little different.  The Atari
>paddles on a C-64 give a slightly different range than the Commodore paddles
 
>As far as the proportional mode of the 1351 mouse, does the resultant data
>get stored in the same locations as the paddle values..?  If so, it just might
>be possible that the mouse could be read on an 8-bit Atari...  

I started this - I got a cbm mouse to use with the Atari.
The first problem was that it didn't even plug in due to differing mechanics
(on my XE - I know nothing of 400/800 or XL), so I had to go to Radio Shack
and get connectors.  Their joystick extension cable might work - I didn't
think of it at the time.

The mouse runs in two modes: joystick simulator and analog proportional.
I use joystick simulator - the mouse puts out a 20ms pulse on the appropriate
lines when moved.  I have an assem language routine that I invoke with a timer
that polls the lines, and updates memory locations accordingly.  Like the
ST mouse/trakball routine I posted sometime back.

The reason I am going to all this trouble is for that second mouse button -
my religion does not accept one-button mouses.  Also, I got the cbm mouse for
$40, and I don't even know how to get an ST mouse.  And my trakball is 
beginning to stick.

In joystick mode, the second
button can actually be read through the pot input; when pushed, it reads like
3, and when released, it reads like 230? or so.

Anyway, it looked to me like the Commodore and the Atari read the pot lines
in a similar way; but trust me, it doesn't work.  In proportional mode,
the Atari pot registers read 230? or whatever the max value is, regardless
of mouse position. 

I would love to get a curcuit to allow the Atari to read the analog output.
Joystick mode [insert obscene expression], but I can live with it for now...
-Stan

kimes@ihlpe.ATT.COM (Kit Kimes) (01/12/89)

From article <34436@bbn.COM>, by slackey@bbn.com (Stan Lackey):
> 
> The reason I am going to all this trouble is for that second mouse button -
> my religion does not accept one-button mouses.  Also, I got the cbm mouse for
> $40, and I don't even know how to get an ST mouse.  And my trakball is 
> beginning to stick.
> 
I have avoided jumping into the discussion because I'm not well versed on
the internals of the 8bit Atari, but I do know that it has to be possible.

Both Total Control Systems' GOE and USA Media's Diamond GOE are designed
to be used with an ST mouse.  I have the TCS demo disk and it works quite
nicely with the mouse.  I realize that this doesn't help you solve the 
problem of HOW it works, but it is possible.

BTW, USA Media (formerly Merrill Ward and Associates) was/is selling an
ST mouse with their GOE system for an additional $39.99.  I have seen
them for approximately the same price mail order from companies that
specialize in Atari hardware and software.


					Kit Kimes  
					AT&T--Bell Laboratories
					...att!ihlpe!kimes

fred@cbmvax.UUCP (Fred Bowen) (01/13/89)

In article <13398@cup.portal.com> Bob_BobR_Retelle@cup.portal.com writes:
> 
>Fred, if you're still tuned in here, is this A/D process similar to the way
>the C-64 reads the Paddle pots..?
>The 8-bit Atari uses a somewhat similar way of reading the A/D ports through
>hardware, although the scaling seems to be a little different.   [...]
>As far as the proportional mode of the 1351 mouse, does the resultant data
>get stored in the same locations as the paddle values..?   [...]
>I guess I'm just a little bit confused as to the actual input method from
>the mouse... if it's a variable resistance, as in a paddle, does the computer
>translate the x-y values into an absolute position, rather than relative
>direction and speed values, as an Amiga or Atari ST mouse..?

The POT lines are read on the C64/128 via the SID POTx,y registers, just as
the 1351 mouse movements are.  The difference between an actual paddle and
the mouse inputs is how they are driven- the mouse manipulates the resistance
(normally variable as in the paddle) such that the value one would read from
the SID POT register is equivalent to the digital data corresponding to the
mouse's relative movement (bits 6-1).  The mouse's speed can only be inferred,
taking into account the polling frequency and the relative change in position.
The left button appears as a joystick "fire" signal, and the right button as a
joystick "up" signal.

The specifics pertaining to the SID and the values of the caps and resistors
(accounts for the difference between CBM and Atari scaling factors) can be
found in the C64 or C128 Programmer's Ref Guide.  The specifics pertaining to
the value read from the SID POT register can be found in the 1351 User's Guide.

One important note- on the C64/128, a 4066 analog switch is used to toggle the
POT lines between the two joy/paddle ports.  The selection is made via one of
the lines shared with the keyboard scan lines.  This means a keyscan will
temporarily clobber anything in the POT registers.  Since the POT register
requires some time to "charge" before its data is valid, at least 1.6ms must
transpire after this switch has been twiddled.

--
-- 
Fred Bowen			uucp:	{uunet|rutgers|pyramid}!cbmvax!fred
				arpa:	cbmvax!fred@uunet.uu.net
				tele:	215 431-9100

Commodore Electronics, Ltd.,  1200 Wilson Drive,  West Chester,  PA,  19380