Re: [cc65] Question on 1351 mouse

From: Greg King <>
Date: 2010-02-18 04:36:45
From: silverdr; on Wed., Feb. 17, 2010; at 05:59 PM -0500
> On 2010-02-17, at 21:31, Greg King wrote:
> > The driver prevents the keyboard from interfering by changing the
> > keyboard's output port into an input port while the driver reads its
> > controller device.  That disables a wire that is left active by the
> > Kernal.  That wire is used by the STOP-key to break out of BASIC
> > programs -- CC65 programs don't use that feature.  The wire is
> > shared by these keys:
> > STOP, "Q", Commodore, Space, "2", CTRL, Left-Arrow, and "1".
> > I listed them, in order, from bit 7 over to bit 0.  The rightmost
> > five keys can look like joystick switches.
> >
> > The driver prevents the mouse/joystick from interfering by
> > "blinding" the keyboard scanner while any button/switch is active.
> How does it distinguish between key and button/switch activation?
> E.g., between SPACE and LMB/FIRE in control port I?

It doesn't need to distinguish between anything.
"The driver prevents the keyboard from interfering ..." means that the
Space-bar isn't seen.  No key can be seen because all keyboard "wires"
are de-activated.

The keyboard is a bunch of "cross-point" switches.  An output port is
connected to the columns; and, an input port is connected to the rows.
Normally, when you push a key, it electrically connects one column to
one row.  The scanner shifts a zero-bit across the output byte.  That
"pulls down" each column wire, in turn.  When the cross-connected wire
is "grounded", a zero-bit is seen at the input port.  Then, the scanner
has a sixteen-bit number with two zero-bits (and, fourteen one-bits) in
it.  The firmware knows how to decode that into a character.  But, none
of the wires can be grounded (by the Kernal) while the mouse driver has
the output port switched to input.  Therefore, the keyboard is almost
invisible!  [I say "almost" because certain combinations of simultaneous
key-presses can connect two rows together through a column.  If a
joystick has grounded one of those rows, then the other row, too, will
be grounded.  But, sane people don't type like that -- so, we're safe.
:-) ]

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Feb 18 05:14:45 2010

This archive was generated by hypermail 2.1.8 : 2010-02-18 05:14:49 CET