Re: [cc65] Question on 1351 mouse

From: Greg King <greg.king41verizon.net>
Date: 2010-02-17 21:31:33
From: "Greg King"; on Saturday, January 30, 2010; at 07:40 PM -0500
>
> Some of that cross-talk can be avoided by the mouse driver.  The
> driver can change the values in the keyboard matrix's output port and
> direction registers during it's reading of the buttons.  I did that
> in a driver that I created decades ago for the ROM Kernal's screen
> editor.  It translated mouse movement into cursor characters.  The
> blinking text cursor followed the mouse's I-beam sprite around the
> screen.
>
> I keep getting the idea that I should find that old code, and add it
> to CC65's drivers.  But, I always forget about it, an hour later. :-(
> (Maybe, if I keep your flagged letter in my mailbox, it will "kick" me
> enough times that I finally will do what I should have done years
> ago!)

I still haven't found my old drivers (I wrote another one that read a
Microsoft-serial type mouse through a SwiftLink cart.).  But, I managed
to "rediscover" some code that does the job.  The C64 target's 1351 and
joy-mouse drivers have been fixed.  (Some other joystick drivers can
benefit, but I haven't gotten to them, yet.)  My patch doesn't work on
the C128 -- I need to study how its keyboard is different from the
C64's.

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.  It changes the
input port into an output port, then stores all zero-bits in that port's
latch.  Reading from an output port sees the bitwise-AND of the latch
and the input signals.  Therefore, the scanner thinks that eight keys
are being pushed at the same time.  It doesn't know what to do about
that condition; so, it does nothing.  The driver lets the scanner see
normally, again, when no buttons/switches are active.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Feb 17 21:31:48 2010

This archive was generated by hypermail 2.1.8 : 2010-02-17 21:31:51 CET