[net.micro.cpm] Commodore 128 Mouse Interface

corbin@encore.UUCP (Steve Corbin) (05/06/86)

I have just purchased a Commodore 128 mouse with the hopes of connecting
it to my Z80/CPM machine.  The only documentation supplied in the package
is the connector pinout.  Does anyone know where I can get the full
technical details for this device?  Items of interest would be schematics,
electrical and timing characteristics, suggested hardware interfaces, and
software drivers.


The connector is laid out as follows:

	PIN	SIGNAL
	 1	UP
	 2	DOWN
	 3	LEFT
	 4	RIGHT
	 5	nc
	 6	BUTTON 1 (left)
	 7	VCC (+5v)
	 8	GND
	 9	BUTTON 2 (right)


The little I could tell about these signals is:

BUTTON #1, BUTTON #2

These lines are connected to one contact of the pushbuttons with the other
contacts to GND.  No pull-up or debounce circuitry.

UP, DOWN, LEFT, RIGHT

Active low signals indicating direction(s) of movement.  UP/LEFT, UP/RIGHT,
DOWN/LEFT and DOWN/RIGHT may be simultaneous and asynchronous with respect
to each other.  Questions are:

	1.  Are these lines pulsed for each 'step' of movement?

	2.  What is the resolution of movement? (i.e. steps/inch)

	3.  What is the minimum/maximum pulse width?

	4.  What is the minimum/maximum high time between pulses?

	5.  What is the output voltage levels?


Thanks in advance,
Steve Corbin

Usenet: corbin@encore
        {ihnp4, allegra, linus}!encore!corbin

GUBBINS@RADC-TOPS20.ARPA (Gern) (05/07/86)

The C128 'mouse' is not a mouse at all, except it looks like one.   It
is an inverted tracball.  It is simply a digital joystick like interface.
You 'roll-up' (at ANY speed), and it lowers the UP line (pin-1).  Similarly,
for down, left, right (pins 2,3,4 respectively).   The left button is
pin-6, otherwise known as FIRE and the right button is connected in a different
fashion to POT-X (on pin-9).   There is no increments, or timming, or pulse
widths (this is what I consider makes a REAL mouse).   Tracballs work the
same way.   You can use a digital (standard) joystick in place of this
C128 mouse, or a tracball, and the software will not notice (save for no
right button).    This mouse does not even come close to the 'magic' feel
of a real mouse (Microsoft Mouse), but then again it is only $35 instead
of $85 and cheap and marginal is the name of the game in Commodore land.

Cheers,
Gern
-------

daveh@cbmvax.cbm.UUCP (Dave Haynie) (05/07/86)

In article <290@encore.UUCP> corbin@encore.UUCP (Steve Corbin) writes:
>I have just purchased a Commodore 128 mouse with the hopes of connecting
>it to my Z80/CPM machine.  The only documentation supplied in the package
>is the connector pinout.  Does anyone know where I can get the full
>technical details for this device?  Items of interest would be schematics,
>electrical and timing characteristics, suggested hardware interfaces, and
>software drivers.
>
>....
>
>The little I could tell about these signals is:
>
>BUTTON #1, BUTTON #2
>
>These lines are connected to one contact of the pushbuttons with the other
>contacts to GND.  No pull-up or debounce circuitry.

On the C128, one of the buttons is sensed though a 6526 CIA, the other 
though a port on the SID chip.  Essentially what happens is that one bit
of a parallel output port is used to read in each button press.  Bouncing
has not been a problem, as the port device has a degree of internal pullup,
and scanning this at a 250KHz rate, or thereabouts, at most, we've found
no need for debouncing.  Also, the first button is completely compatible
with the C128/C64 joystick fire button; a large portion of the total
design is based on necessary compatibility with the joystick.

>UP, DOWN, LEFT, RIGHT

These pins emulate the four switches in the standard C128/C64 digital
joystick.

>Active low signals indicating direction(s) of movement.  UP/LEFT, UP/RIGHT,
>DOWN/LEFT and DOWN/RIGHT may be simultaneous and asynchronous with respect
>to each other.  Questions are:
>
>	1.  Are these lines pulsed for each 'step' of movement?

Yes, the lines are pulsed; faster movement results in greater "active" time.
There's a tiny, dedicated microprocessor in the mouse that does the "vane"
pulse to joystick pulse conversion.  These lines are attached to the same
parallel port in the C128/C64 as is the fire button.  

>	2.  What is the resolution of movement? (i.e. steps/inch)
>	3.  What is the minimum/maximum pulse width?

Not sure about these.

>	4.  What is the minimum/maximum high time between pulses?

I think you can "saturate" the pulsing, i.e., if you move it fast enough,
you can get a continuous active output.

>	5.  What is the output voltage levels?

The voltage level into the mouse should be 5v +/- 5% regulated DC, the 
output will be standard TTL levels.

>Thanks in advance,
>Steve Corbin
>
>Usenet: corbin@encore
>        {ihnp4, allegra, linus}!encore!corbin

As for programming it, there's a short machine program (6502 code of course)
in the C64 Programmer's Reference Guide, intended for joysticks, which could
be modified for optimal mouse performance.  In the example, $DC00 is the
location of the memory-mapped port.

	;Program to read the direction change from a joystick or mouse.

	DX = $C110		;X direction
	DY = $C111		;Y direction

DJRR	LDA $DC00		;Read port
DJRRB	LDY #$00		;Decode it, buy shifting values right
	LDX #$00		;and testing for the carry bit.
	LSR A			;Bits 0 and 1 modify the Y direction
	BCS DJR0
	DEY
DJR0	LSR A
	BCS DJR1
	INY
DJR1	LSR A			;Bits 2 and 3 modify the X direction
	BCS DJR2
	DEX
DJR2	LSR A
	BCS DJR3
	INX
DJR3	LSR A			;Bit 4 is the fire button.

	STX DX			;Exit here with X,Y directions stored, and
	STY DY			;the fire button status in the carry bit.
	RTS

-- 

Dave Haynie    {caip,inhp4,allegra,seismo}!cbmvax!daveh
               "There, beyond the bounds of your weak imagination
                Lie the noble towers of my city, bright and gold"
								-Genesis

cem@intelca.UUCP (05/13/86)

> The C128 'mouse' is not a mouse at all, except it looks like one.   It
> is an inverted tracball.  It is simply a digital joystick like interface.
> You 'roll-up' (at ANY speed), and it lowers the UP line (pin-1).  Similarly,
> for down, left, right (pins 2,3,4 respectively).   The left button is
> pin-6, otherwise known as FIRE and the right button is connected in a different
> fashion to POT-X (on pin-9).   There is no increments, or timming, or pulse
> widths (this is what I consider makes a REAL mouse).   Tracballs work the
> same way.   You can use a digital (standard) joystick in place of this
> C128 mouse, or a tracball, and the software will not notice (save for no
> right button).    This mouse does not even come close to the 'magic' feel
> of a real mouse (Microsoft Mouse), but then again it is only $35 instead
> of $85 and cheap and marginal is the name of the game in Commodore land.
> 
> Gern

Hmmmm, there was a message from someone at commodore saying almost the
exact opposite stuff. They seem to think the mouse did indeed break
the motion into pulses. The pulses were dependent on both how far and
how fast the mouse moved. I will have to track it down (maybe it was
in net.micro) and forward it.

--Chuck
-- 
                                            - - - D I S C L A I M E R - - - 
{ihnp4,fortune}!dual\                     All opinions expressed herein are my
        {qantel,idi}-> !intelca!cem       own and not those of my employer, my
 {ucbvax,hao}!hplabs/                     friends, or my avocado plant. :-}

GUBBINS@RADC-TOPS20.ARPA (Gern) (05/21/86)

I plugged the C-128 mouse into the rig of my own design and manufacture
for a Z-100.   I also plugged a regular joystick into the mouse program.
I did not put the mouse on a scope, but the results are conclusive:
The C-128 is not a real mouse, but is an inverted tracball (probably
using the same IC that is in the tracball too).  It does not yield any
stepping increments or my custom software would have been able to detect
it.    A REAL mouse costs money to make, the C-128 is cheap.
The Commodore man is full of it, you can check it out for yourself.

Cheers,
Gern
-------

daveh@cbmvax.cbm.UUCP (Dave Haynie) (06/12/86)

> 
> I plugged the C-128 mouse into the rig of my own design and manufacture
> for a Z-100.   I also plugged a regular joystick into the mouse program.
> I did not put the mouse on a scope, but the results are conclusive:
> The C-128 is not a real mouse, but is an inverted tracball (probably
> using the same IC that is in the tracball too).  It does not yield any
> stepping increments or my custom software would have been able to detect
> it.    A REAL mouse costs money to make, the C-128 is cheap.
> The Commodore man is full of it, you can check it out for yourself.
> 
> Cheers,
> Gern
> -------

Maybe you should have scoped it out.  The Commodore Mouse is in some ways
a real mouse and in some ways not, of course depending upon what you consider
a "real" mouse.  The mouse workings are very cheap in most everyone's mouse;
they simply consist of two circular wheels alternately transparent and 
opaque, which cause two phototransistors to pluse in proportion to the
velocity at which the mouse moves.  The expensive part comes in the mouse
interface, which generally transmits some good and meaningful velocity
information in a form that the computer can accept.  Up to this point, a
trackball does something very similar, and the two are really interchangable.

Now the interface on the CBM mouse is a custom microprocessor that sits out
in the mouse and watches the motion of the vanes.  It will pulse a four
bit digital TTL level signal which corresponds to the 4 bits of joystick
information all Commodore consumer type computers accept.  Thus it is 
compatible with joystick software, at least to a degree.  The main problem
is that the pulsed digital lines can easily get saturated when moving the
mouse; this seems to happen even at reasonably slow speeds.  Also, even a
program written specifically to read the mouse is going to look sloppy as
compared to the same thing with a standard quadrature mouse, the digital
pulsing takes lots of processor time to scan correctly, and it still
doesn't convey the same resolution of information available in the mouse
that you're thinking of.

Most arcade-style trackballs take an even simpler route, and don't pulse the
digital output at all; they look just like digital joysticks.  That's what
you get for buying a Commodore/Atari/ETC COMPATIBLE trackball.  There are
also trackballs that generate a quadrature output compatible with the mouse
output on an Amiga or MAC machine. 

The bottom line is that the current Commodore Mouse, as intended for C64 and
C128 style computers, is a compromise between full mouse functionality and
compatibility with software that's out there.

-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Dave Haynie    {caip,ihnp4,allegra,seismo}!cbmvax!daveh

"As a dreamer of dreams and a travellin' man, I had chalked up many a mile."
"I read dozens of books about heros and crooks, and I learned much from both 
	of their styles.."
						-Jimmy Buffett

	These opinions are my own, though for a small fee they be yours too.
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

daveh%cbmvax.cbm.UUCP@seismo.css.gov (Dave Haynie) (06/30/86)

> 
> I plugged the C-128 mouse into the rig of my own design and manufacture
> for a Z-100.   I also plugged a regular joystick into the mouse program.
> I did not put the mouse on a scope, but the results are conclusive:
> The C-128 is not a real mouse, but is an inverted tracball (probably
> using the same IC that is in the tracball too).  It does not yield any
> stepping increments or my custom software would have been able to detect
> it.    A REAL mouse costs money to make, the C-128 is cheap.
> The Commodore man is full of it, you can check it out for yourself.
> 
> Cheers,
> Gern
> -------

Maybe you should have scoped it out. The Commodore Mouse is in some 
ways a real mouse and in some ways not, of course depending upon what 
you consider a "real" mouse. The mouse workings are very cheap in most 
everyone's mouse; they simply consist of two circular wheels 
alternately transparent and opaque, which cause two phototransistors to 
pluse in proportion to the velocity at which the mouse moves. The 
expensive part comes in the mouse interface, which generally transmits 
some good and meaningful velocity information in a form that the 
computer can accept. Up to this point, a trackball does something very 
similar, and the two are really interchangable.

Now the interface on the CBM mouse is a custom microprocessor that sits 
out in the mouse and watches the motion of the vanes. It will pulse a 
four bit digital TTL level signal which corresponds to the 4 bits of 
joystick information all Commodore consumer type computers accept. Thus 
it is compatible with joystick software, at least to a degree. The main 
problem is that the pulsed digital lines can easily get saturated when 
moving the mouse; this seems to happen even at reasonably slow speeds. 
Also, even a program written specifically to read the mouse is going to 
look sloppy as compared to the same thing with a standard quadrature 
mouse, the digital pulsing takes lots of processor time to scan 
correctly, and it still doesn't convey the same resolution of 
information available in the mouse that you're thinking of.

Most arcade-style trackballs take an even simpler route, and don't 
pulse the digital output at all; they look just like digital joysticks. 
That's what you get for buying a Commodore/Atari/ETC COMPATIBLE 
trackball. There are also trackballs that generate a quadrature output 
compatible with the mouse output on an Amiga or MAC machine.

The bottom line is that the current Commodore Mouse, as intended for 
C64 and C128 style computers, is a compromise between full mouse 
functionality and compatibility with software that's out there.

-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Dave Haynie    {caip,ihnp4,allegra,seismo}!cbmvax!daveh

 These opinions are my own, though for a small fee they be yours too.
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/