[comp.sys.apple] Tool 30 really is the Resource Mgr; user toolsets

dlyons@Apple.COM (David Lyons) (08/30/89)

In article <713@mountn.dec.com> shatara@memit.dec.com (Chris Shatara) writes:
>[...]
>    There is no tool30 on the Distribution disk for GS/OS v3.0 There
>    is however a tool34.  Are you sure the resouce manager is tool30?

Yup, I'm sure:

  030 = Resource Manager
  031 = (not currently used: reserved)
  032 = MIDI
  033 = Video Overlay toolset
  034 = Text Edit

You're correct that there is no "TOOL030" file--that's because the Resource
Manager is stored as *:System:System.Setup:Resource.Mgr (a Permanent Init
File).

>    If the resource manager is indeed tool30 (somehow) and I loaded
>    First Byte's tool30 into the */system/tools folder, could this cause
>    the system error $1103 that I talked about in a recent posting?

I don't remember the circumstances of the $1103 error, but when the
application loads toolset 30 and then starts making *toolbox calls*
to that toolset, it is *actually* making Resource Manager calls without
meaning to.  The most likely result is a crash into the monitor in short
order--but it's conceivable you could get an $1103 error somehow in the
resulting weirdness. 

In another message you asked for more details about user toolset.  The
answer is Yes, you have to convince the application writers to use them--
there's nothing you can do as a user to get the application to use User
Toolsets instead of System Toolsets.

User Toolsets are just like System Toolsets, except the current
application owns all the toolset numbers (the *system software*
owns all the system toolset numbers, and developers who steal
system toolset numbers are shooting themselves in the chests with
very slow bullets).

To call a *system* toolset, you JSL $E10000 or JSL $E10004.
To call a *user*   toolset, you JSL $E10008 or JSL $E1000C.
     (The toolset # and function # are always in X.)

(If your favorite programming environment doesn't provide a nice way
to call functions in user toolsets, *complain*!)

To install a *system* toolset, you use LoadOneTool (or LoadTools, or
     StartUpTools).
To install a *user*   toolset, you get the toolset in memory somehow
     (Restart/InitialLoad or InitialLoad2 are good choices).

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.

shubbell@pnet02.gryphon.com (Steve Hubbell) (08/30/89)

dlyons@Apple.COM (David Lyons) writes:
>
>To call a *system* toolset, you JSL $E10000 or JSL $E10004.
>To call a *user*   toolset, you JSL $E10008 or JSL $E1000C.
>     (The toolset # and function # are always in X.)
>

Thanks Dave!  My application needs to install its own toolkit and I found the
appendix in volume II of the Toolbox reference lacking this information.

While we are on this topic, maybe you will also be able to fill me in on
"SetWAP".  The appendix A of Volume II lacks a "good" description of what the
call is really used for.  What I dont understand is what (and why) I have to
use this call for...  Thanks for the help.

>
> --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
>   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
>   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
>   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
>   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons
>
>   My opinions are my own, not Apple's.


-------------------------------------------------------------------------------
Steve Hubbell - Manhattan Beach, CA
Co-Founder and President Zephyr Technologies, Inc.

UUCP: {ames!elroy, <backbone>}!gryphon!pnet02!shubbell
INET: shubbell@pnet02.gryphon.com
-------------------------------------------------------------------------------

dlyons@Apple.COM (David Lyons) (08/31/89)

In article <19273@gryphon.COM> shubbell@pnet02.gryphon.com (Steve Hubbell) writes:
>dlyons@Apple.COM (David Lyons) writes:
>>
>>To call a *system* toolset, you JSL $E10000 or JSL $E10004.
>>To call a *user*   toolset, you JSL $E10008 or JSL $E1000C.
>>     (The toolset # and function # are always in X.)

I should've noted before that the second entry point for each kind of
toolset (the -4 and -C entries) are like the first ones, *except* that
one extra RTL address is expected to have been put onto the stack, after
the parameters were put there.

>[...]
>While we are on this topic, maybe you will also be able to fill me in on
>"SetWAP".  The appendix A of Volume II lacks a "good" description of what the
>call is really used for.  What I dont understand is what (and why) I have to
>use this call for...  Thanks for the help.

You don't *have* to use SetWAP, but for most toolsets it's convenient.  The
"work area pointer" is a 4-byte pointer for each toolset--SetWAP and GetWAP
can set and get that value.

When the tool dispatcher gives control to one of your toolset's functions,
it has already loaded your toolset's current WAP value into the A and Y
registers, with the low word in A.  Typically, a toolset's WAP points to
its direct-page space in bank 0, so that the WAP value is $0000xx00, with
A = $xx00.  On entry to one of your functions, you could do a PHD, TCD to
save the old direct-page-register value on the stack and use your WAP for
direct-page storage (and PLD before you return to the system).

If you're using the WAP like that, your xxxStartUp function will, after
doing anything necessary to make sure it's okay to start up, use SetWAP
to set its own WAP value.  (Set it to what?  Either to the value of a
parameter that was passed to your startup function, or to the address
of some memory your startup function has just allocated using NewHandle.)
Your xxxShutDown function should set your WAP back to 0, and your xxxStatus
function should check the WAP value & return "true" if it's nonzero.

Note that the X register always contains the function number when a function
gets control.  This means it isn't too difficult to write a toolset that
will work *regardless* of what toolset number it is installed as.  (In
other words, you can compute proper error numbers based on the toolset
number in X, and you can use your toolset number "on the fly" as input
to SetWAP when needed.)

>Steve Hubbell - Manhattan Beach, CA

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.