[comp.sys.apple] ProDOS 8 System File Startup Buffers

jearls@polyslo.CalPoly.EDU ( Chumley The Troll ) (10/27/89)

I'm looking for an easy way to launch ProDOS 8 programs from the finder
but I need to be able to fill their startup buffers with info.  I know
that BASIC.LAUNCHER does essentially this; is there any way to get the
source for this or to get some hints (tech notes?) on how to do this?

Thanks,

- John

-- 
_______________________________________________________________________________
      Chumley@Bazaar.Deva.COM           | 
-aka- EARLSJ@AFAL-Edwards.AF.MIL        | If two wrongs don't make a right,
-aka- jearls@polyslo.CalPoly.EDU        | try three...

dlyons@Apple.COM (David Lyons) (10/28/89)

In article <1989Oct27.053021.21003@polyslo.CalPoly.EDU> jearls@polyslo.CalPoly.EDU (  Chumley The Troll  ) writes:
>I'm looking for an easy way to launch ProDOS 8 programs from the finder
>but I need to be able to fill their startup buffers with info.  I know
>that BASIC.LAUNCHER does essentially this; is there any way to get the
>source for this or to get some hints (tech notes?) on how to do this?

The information you need is all available--the trick is to locate it and
piece it together.

When you open a document in the GS Finder, the Finder checks for an Icon
matching the documents name/type/auxtype.  That icon specifies the pathname
of the application to launch--the Finder puts a list of the name of the
document you opened in a place where the application can find it, and then
it launches that application.

The place for that list is the MessageCenter, message #1.  This is documented
in the Apple IIgs Toolbox Reference manual, volume 2, in the Tool Locator
chapter.

Here's what you can do:  create a small SYS application that will fetch the
first pathname from message #1 of the MessageCenter and feed it to your
real application's startup buffer (this is what BASIC.LAUNCHER does for
BASIC.SYSTEM).

Your SYS program will load at $2000, which is the same place your main
application is going to have to be loaded, so you'll want to have your
program copy itself (or part of itself) someplace else when it runs (like
$1000).

You'll have to check the MessageCenter (do action 2, get, on message 1) and
get the first pathname, and delete the message from the MessageCenter.

OPEN your real application and READ it into memory at $2000.  CLOSE it.
Stuff the pathname from the MC into your app's startup buffer at $2006,
making sure it fits.  (When you OPEN the thing, a good way to get the
pathname is to take your own full or partial pathname from $0280, append
it to the prefix if it doesn't begin with a "/", and strip off the filename.
Then add the filename of the real application, and you've got the full
pathname of the application you really want to open.  If you do this right,
you deal with all cases, including for ex. Prefix="/HARD1/ABC/" and your
pathname at $280 = "DEF/GHI".  This is allowed.)

Finally, of course, JMP $2000 to execute the real application.
-- 

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   America Online: 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.