[comp.sys.apple] GS Tool dispatcher

AWCTTYPA@UIAMVS.BITNET ("David A. Lyons") (02/15/89)

>Date:         Sun, 12 Feb 89 22:41:12 GMT
>From:         Roy Bannon <sm.unisys.com!csun!polyslo!rbannon@OBERON.USC.EDU>
>Subject:      Tool Dispatcher

>I recently saw a post about the FPE.  It claimed that the tool
>dispatcher takes 100uSec to get to the SANE routines.  Is this true?
>If it is, what is it doing for all this time. This just seems like a
>long time.

[This is going to be a technical msg, assuming a fair amount of
knowledge of the 65816 and the GS tool dispathcer.]

That sounds like about the right amount of time.  If you really want
to see what it's doing, go into the monitor and type E1/0L and go
from there.  You'll find a JMP into the ROM.  It does a two-level
table lookup:  first it looks up the address of the toolset's FPT
(Function Pointer Table) in the System TPT (Tool Pointer Table), and
then it looks up the address of an individual function within that
FPT.  It also looks up the toolset's WAP (work area pointer) and
loads it into A and Y before calling the routine.

There's an idea floating around somewhere in my head for
turbocharging the tool locator to see how much overall improvement it
gives; but unfortunately I don't think there's any way to do it while
staying compatible with utilities that patch info toolbox functions.

The plan would be to "flatten out" the data structures & have just a
single table lookup, using the byte-swapped function code times 4 as
the index.  The problem is that utilities will want patch things by
doing a GetTSPtr (gets a pointer to the toolset's FPT) and assuming
that the table it finds is in its own memory block that can be
re-sized with memory manager calls, etc.  I don't see how to
reconcile that with a flattened table structure.

It's really too bad there isn't a complete set of toolbox functions
for patching toolbox functions--SetFuncPtr is the main one that's
missing. Probably too late to get the benefits of adding it now,
though--have to stay compatible with utilities that follow the
current rules when they make patches.)

>Roy
>rbannon@polyslo.calpoly.edu

--David A. Lyons              bitnet: awcttypa@uiamvs
  DAL Systems                 CompuServe:  72177,3233
  P.O. Box 287                GEnie mail:    D.LYONS2
  North Liberty, IA 52317     AppleLinkPE: Dave Lyons