reading MOUSE

Juergen Buchmueller pullmoll at t-online.de
Tue Jun 12 08:25:37 PDT 2007


I wanted to share my findings about the <-MOUSE bus source.

The source for BUS[12-15] is a 256x4 PROM, which should contain something
similiar to a one-excess code lookup table. I don't know if I translated
this term correctly, just let me explain.

The mouse sends 4 signals, MX1, MX2, MY1 and MY2. I know of a kind of
rotating knob switches which have two signals. What they do is toggle the
signals like MX2, then MX1 for a left, but MX1, then MX2 for a right turn.
I suspect that the mouse is doing the same, just for two such switches, one
for X, and one for Y. It's not entirely clear from the schematics.

The 4 signals, and also the latched previous state of those signals, are
connected to the PROM's address lines like this:

address	input
-------------------
A0	MX1
A1	latched MX1
A2	MX2
A3	latched MX2
A4	MY1
A5	latched MY1
A6	MY2
A7	latched MY2

If you move to the west, then (probably) the sequence for A3-A0
would be this:
	0100 (4) -> 1101 (d) -> 1011 (b) -> 0010 (2) -> &c.
and to the right you'd see this:
	0001 (1) -> 0111 (7) -> 1110 (e) -> 1000 (8) -> &c

Of course left and right, up and down, may have to be swapped. You can't see
this in the schematics.

So in the PROM for any address 0x?2, 0x?4, 0x?b, and 0x?d there would be
the BUS[12-15] value which makes the microcode branch to decrement mouse X,
for any address 0x?1, 0x?7, 0x?8, and 0x?e it should increment X, and for
the other values there would be a "wrong value branch", perhaps 017.

And similiar for the upper nibble A7-A4 of the address. If you'd OR the two
values for X and Y, then one of X or Y being invalid would invalidate the
whole code.

A piece of code like this could generate the PROM, or a corresponding
lookup table:

for (addr = 0; addr < 256; addr++) {
	int lsb = addr % 16, msb = addr / 16, val = 0;

	if (lsb == 2 || lsb = 4 | lsb == 11 | lsb == 13)
		val |= ???;
	else if (lsb == 1 || lsb = 7 | lsb == 8 | lsb == 14)
		val |= ???;
	else
		val |= 017;
	if (msb == 2 || msb = 4 | msb == 11 | msb == 13)
		val |= ???;
	else if (msb == 1 || msb = 7 | msb == 8 | msb == 14)
		val |= ???;
	else
		val |= 017;
	mouse_prom[addr] = val;
}

The question left to solve is this: what are the expected values for mouse
x--, x ++, y--, and y++?

Since we don't have that PROM, we would have to guess from looking at the
microcode at 0340-0357. That is where it dispatches on the value returned
by reading the mouse.

Juergen


More information about the Altogether-devel mailing list