[comp.sys.mac.programmer] mcky resource

mikeoro@hubcap.clemson.edu (Michael K O'Rourke) (08/02/89)

A few weeks ago, I posted a question and got no reply, so here it goes again:

I need to know the format of the mcky resource.  I also need to know which
resources pertain to the keyboard settings and the general settings.  Are
they all in the system or in the corresponding control panel devices?  

The reason i need this is for a program/init combo which will allow sysops
to set all the computers in a lab to the same setting in one swoop.  I plan
to send the data over appletalk to reset all the machines to be the same as
the master machine.  I NEED to know what data to send and its format!  Please,
will some nice person at Apple reply to this?  I am at a dead-end right
know and this is the only thing holding up release of this package.

Michael O'Rourke

roland@dna.lth.se (Roland Mansson) (08/05/89)

In article <6127@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael K O'Rourke) writes:
>A few weeks ago, I posted a question and got no reply, so here it goes again:
>
>I need to know the format of the mcky resource.  I also need to know which
>resources pertain to the keyboard settings and the general settings.  Are
>they all in the system or in the corresponding control panel devices?  

Below is some info about the mcky format from the last time it was 
discussed.

-----
From: holland@m2.csc.ti.com (Fred Hollander)
Subject: Re: Why can't we speed up the mouse?
Organization: TI Computer Science Center, Dallas

Pretty reasonable guess it was.  Actually, there are 5 'mcky' resources:
Tablet 0, Slow 1 ... Fast 4.  Each resource is 8 bytes.  Byte x (1-8)
indicates the number of pixels you must move your mouse to multiply the
motion by x.  For example, the current "Fast" requires the mouse to move
16 pixels (in who knows how much time) before the motion is mulitplied by
7.  In case anyone is interested here is what I did with mine:

Removed id's 1 and 2 (kept tablet) and moved 3 and 4 down to replace them.
Added id's 3 and 4 with the following data:
3: 01030507090B0D0F
4: 0103050708090A0B

I don't have any problem with fine motion using the new fast speed, yet a small
flick of the wrist moves the mouse accross the screen.  Since, you can easily
go back to the original settings using the mouse CDEV, I can't see a real
need for writing anything new.

Fred Hollander
Computer Science Center
Texas Instruments, Inc.
holland%ti-csl@csnet-rela


From: blm@cxsea.UUCP (Brian Matthews)
Subject: A Partial (but Useful) Look at mcky resources
Date: 31 Dec 88 21:09:49 GMT
Organization: Computer X Inc.

Note:  in the follow article I describe how to make some modifications to
standard Macintosh system software.  Only do this if you understand the
instructions, and take the normal precautions (backup, use a copy of the
System, etc).  The modifications are fairly simple, but don't blame me if
you screw something up.

After reading the discussion on moving the cursor faster, I decided to
dig around a bit.  So, taking Macsbug in hand (so to speak), I
disassembled the cursor VBL, and figured out (approximately) how the mcky
resources are used.  Note that I'm working on a MacPlus running System
6.0.2, but I suspect the scaling stuff is the same for ADB rodents and
recent systems.

As someone else pointed out, there is one mcky resource for each of the
Mouse Tracking choices in the Mouse cdev.  They are stored as mcky 0
(tablet) through mcky 4 (fastest) in the System file.

Each mcky resource consists of 8 bytes.  Each byte is a threshold value,
and the index of the byte within the mcky is the scale value.  It's not
entirely clear exactly how the value that is compared to the threshold
value is computed.  It has something to do with how far the mouse moved
in the last 60th of a second (obviously :-)), but the cursor VBL also
appears to keep some kind of running average.  This means that in a short
move, long move pair, the long move will be scaled less than in a long
move, long move pair.

In any case, a movement value between 1 and 255 is calculated, and looked
up in the current mcky resource.  The index of the first byte greater
than or equal to the movement value is used as the scale factor.

For example, the tablet mcky resource is all FF's, so the movement value
is always less than the first threshold, and no scaling is done.  The
fastest mcky resource contains 01 04 07 0A 0D 0F 10 FF, so that a
movement value of 1 will result in no scaling (matching the first
theshold value), but a movement value of 0C will result in a scale factor
of 5 (as the 5th byte counting from 1 is 0D and the first threshold
greater than or equal to the movement value of 0C).  The last byte is FF
so the movement value will always at least match this.

The mcky resource is copied into the cursor VBL, so it can't be made
longer without patching the cursor VBL itself.  Therefore, the maximum
scale factor is fixed at 8 without patching (which I'll talk about in a
bit).

You can however, modify a mcky so that scaling takes place faster.  For
instance, I modifed mcky 0 to read 01 03 03 03 03 03 03 FF.  A movement
factor of 1 still results in a scale factor of 1 (so I can still move the
mouse in single pixel increments).  A movement factor of 2 or 3 will
result in a scale factor of 2, and any larger movement factor will result
in the maximum scale factor.

If you'd like to modify a mcky, simply fire up ResEdit, open the System
file and the mcky resources, and choose one of them.  I chose 0, as this
a "special" mcky in a sense.  You can use any of them, just remember
which.

When you have decided on a mcky to use, open it.  You will see 8 hex
bytes.  These are the threshold values.  Simply change the bytes you want
changed, and save everything.  Note that the last byte should always be
FF so the search stops, and there should be exactly eight bytes.

Next, open the control panel, choose Mouse, and select the mouse tracking
corresponding the mcky you modified.  The cursor movement should change
immediately to reflect the changed mcky.

You can also experiment by modifying the threshold value in memory.  To
do this, you'll need Macsbug or some other debugger.  I've included in
parens the Macsbug 6.0 command to use in each case.

First, get into the debugger, and disassemble the instructions E8 bytes
past the address in 8ee (il @8ee+e8).  This should look something like:

	LEA	*-$00F0,A0
	CLR.W	D2
	ADDQ.W	#$1, D2
	CMP.B	(A0)+,D5
	BHI.S	*-$0004

If it doesn't look like this, STOP!  You're cursor VBL is different than
mine.  If it is the same as this, the address placed in A0 by the LEA is
the address of the copy of the mcky resource.  It will be 8 bytes before
the address in 8ee (so you can look at them with dm @8ee-8).  You can
modify these bytes in memory, and instantly see the effect on the cursor
(use sb @8ee-8 xx xx xx xx xx xx xx in Macsbug).  Note that you should
leave the last byte FF.

A future project for some intrepid INIT writer out there is to write an
INIT which patches the cursor VBL to use a different address, so a larger
mcky can be used.  As the LEA only takes four bytes, it will take some
doing.  You'd also have to think about what to do with Control Panel, as
the mouse copies the chosen mcky into the cursor VBL, like we did by hand
above.

-- 
Brian L. Matthews  blm@cxsea.UUCP   ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm
+1 206 251 6811    Computer X Inc. - a division of Motorola New Enterprises


From: holland@m2.csc.ti.com (Fred Hollander)
Subject: Re: Fooling with mcky: DRAT!
Date: 31 Dec 88 18:01:30 GMT
Organization: TI Computer Science Center, Dallas

In article <2273@ilium.cs.swarthmore.edu> jackiw@cs.swarthmore.edu (Nicholas R Jackiw) writes:
>Concerning one's ability to speed up the mouse:
>
>Control Panel setting.  This gives us mcky#0=DITL#10='Very Slow', mcky#4=
>DITL#14='Fast'. What's unfortunate about this is that the mcky's ascend
>numerically in contents, from #0=$0104070A0D0F10FF to #4=$FFFFFFFFFFFFFFFF.
>While you can think of values less than $010407.., you can't get much higher
>than $FFFF. This implies that while clever clueless hacking might be able
>to SLOW down the mouse even more, the FAST setting in the control panel is
>going to remain as fast as a mcky will allow.  

This is reversed.  The higher the number the slower, that is the more you
need to move the mouse before the multiplier "kicks in".  $FF...FF means the
the motion will always be 1:1, unless you can move the mouse 255 pixels very
quickly.  At the other extreme, 01...01 will always multiply the motion by 8.

Fred Hollander
Computer Science Center
Texas Instruments, Inc.
holland%ti-csl@csnet-rela

The above statements are my own and not representative of Texas Instruments.
-- 
Roland Mansson, Lund University Computing Center, Box 783, S220 07 Lund, Sweden
Phone: +46-46107436   Fax: +46-46138225   Bitnet: roland_m@seldc52
Internet: roland_m@ldc.lu.se   or   roland_m%ldc.lu.se@uunet.uu.net
UUCP: {uunet,mcvax}!sunic!ldc.lu.se!roland_m    AppleLink: SW0022