[comp.sys.mac.programmer] ADB Internals; would DTS get an answer?

alibaba@ucscb.UCSC.EDU (Alexander M. Rosenberg) (05/02/89)

Okay, I have a need to perform macroing-like functions (one Mac
will control another.). I want to interfere as little as possible
with the target Mac. I want to feed bogus ADB data to it's service
procedures. This _should_ be completely kosher.

An ADB service proc is set up as follows:

D0 CommandNum
A0 Buffer (pointer)
A1 ServiceProc (pointer)
A2 data Area (pointer)

Okay, so, this is a simple thing. The problem is that some people
(no names, but they work in the ROM group at Apple) decided that the
mouse and keyboard service procs would read the data that is available
through A0 via A3. What's in A3, you might ask? A pointer to the
ADBBase variables. These are found in private.a. 

The reason for calling service procs instead of diddling low memory
globals? The service procs are different for each Mac. Different
low memory globals may exist, and by calling the service procs
directly, I should be able to not have to know how the mouse
driver works.

The problems: 
1) the darn procs Apple supplies use A3 instead of A0.
(they do MOVE.W $164(A3), D1 and such instead of MOVE.W (A0),D1)

2) if no ADB devices are really hooked up to the target Mac, then
how do I obtain pointers to the service procs (especially since
6.0.X patches the mouse proc only if a mouse is connected...)?

Any answers would be appreciated. Especially answers from Apple.

-------------------------------------------------------------------------------
-  Alexander M. Rosenberg  - INTERNET: alibaba@ucscb.ucsc.edu   - Yoyodyne    -
-  Crown College, UCSC     - UUCP:...!ucbvax!ucscc!ucscb!alibaba- Propulsion  -
-  Santa Cruz, CA 95064    - BITNET:alibaba%ucscb@ucscc.BITNET  - Systems     -
-  (408) 426-8869          - Disclaimer: Nobody is my employer  - :-)         -
-                          - so nobody cares what I say.        -             -

tecot@Apple.COM (Ed Tecot) (05/15/89)

In article <6996@saturn.ucsc.edu> alibaba@ucscb.UCSC.EDU (Alexander M. Rosenberg) writes:
>1) the darn procs Apple supplies use A3 instead of A0.
>(they do MOVE.W $164(A3), D1 and such instead of MOVE.W (A0),D1)

The problem here is that the service routines in ROM were written before the
interface was designed.  When the interface was completed, the mouse routine
wasn't modified (the keyboard one was and uses A0 - if you have an example
to the contrary let me know).  In any case, this has been noticed and will
be fixed in future ROMs.  As to your work-around - use A0, but don't change
it.  You can stuff new values in the buffer that is passed to the routine.

>2) if no ADB devices are really hooked up to the target Mac, then
>how do I obtain pointers to the service procs (especially since
>6.0.X patches the mouse proc only if a mouse is connected...)?

Currently, the ROM makes a slot for the keyboard and mouse, even if one is
not connected.  Although you shouldn't depend upon this, it should ease
your worries.  Besides, what good is faking out the driver if the device
doesn't exist?

A final note:  I strongly suspect that your strategy will be your undoing.
The data passed to the service routines are in their raw format.  In
different environments, your code will have unexpected results, for example,
in Japan, where they keys have different meanings, or if the user alters
his or her mouse speed.

						_emt