Re: [cc65] Question on 1351 mouse

From: <silverdr1wfmh.org.pl>
Date: 2010-02-18 12:34:14
On 2010-02-18, at 04:36, Greg King wrote:

>> 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 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.

OK. The row in question is the one connected to PB4 AFAIR ($DC01 AFAIR)

> 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.

So far so good - clear.

> 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.

OK. Keyboard won't work while the mouse driver has the output port switched to input. If you disable (or rather: confuse) the keyboard scanner it won't read the SPACE bar because there will be no ground on the appropriate column to get connected to. This means if PB4 is read as zero then it must be the button rather than the key. This way you actually _can_ and do distinguish between those two events, right?

And if you chain the mouse driver in the IRQ before the KERNAL, then - once PB4 bit goes up - you know that the button has been released and you can put the PA as output again, right?

In pcode:

setPaAsInput()
if PB4 == 0
	setState(LMBDOWN)
else
	setState(LMBUP)
	setPaAsOutput()
end
kernalIrq()

And the same can be applied to other bits (RMB, joystick...)
More or less correct?
-- 
SD!

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Feb 18 12:34:22 2010

This archive was generated by hypermail 2.1.8 : 2010-02-18 12:34:25 CET