[comp.sys.apple] This ProDOS Quit code.

mackay@dalcsug.UUCP (12/01/87)

A friend wrote a FORTH under ProDOS 8 and hooked up most of the MLI functions.
However, one thing I have with all the other applications I use, is a 
way to Quit, back to whatever program launched it (I use Mousedesk by
the now defunct VersionSoft).  

The ProDOS tech ref man (the version I have came with ProDOS 1.0)
doesn't mention anything about this- in fact, it says that you have
to write code that asks the user what application they want to quit
to- this is rediculous because it's obvious that AppleWriter, Works,
Access //, Ascii Express, AppleSloth (the new version) all do this
automatically.

How is this managed?   Who remembers the calling program's directory
and system file name?  What's the MLI call if it is one, or how's it done
otherwise?  Thanks a lot, guys!
--
+---------+				Dalhousie University
|    _    |     From the		Halifax, Nova Scotia
|   (_)===|     Disk of ...		Canada
|         |      Daniel		mackay@dalcs.UUCP
+---------+			...{utai,uunet}!dalcs!dalcsug!mackay

crimmins@russell.STANFORD.EDU (Mark Crimmins) (12/02/87)

In article <210@dalcsug.UUCP> mackay@dalcsug.UUCP (Daniel MacKay) writes:
>A friend wrote a FORTH under ProDOS 8 and hooked up most of the MLI functions.
>However, one thing I have with all the other applications I use, is a 
>way to Quit, back to whatever program launched it (I use Mousedesk by
>the now defunct VersionSoft).  
>
>The ProDOS tech ref man (the version I have came with ProDOS 1.0)
>doesn't mention anything about this- in fact, it says that you have
>to write code that asks the user what application they want to quit
>to- this is rediculous because it's obvious that AppleWriter, Works,
>Access //, Ascii Express, AppleSloth (the new version) all do this
>automatically.
>
>How is this managed?   Who remembers the calling program's directory
>and system file name?  What's the MLI call if it is one, or how's it done
>otherwise?  Thanks a lot, guys!

Not in the ProDOS manual?  I kinda doubt that, but...

Here's the generic way to quit from ProDOS:

       jsr $BF00	;MLI address
      .BYTE $65   	;or dfb $65, or whatever
		        ;$65 is the MLI QUIT code
      .WORD qtprms      ;address of a parmeter table (lsb first)

qtprms: .BYTE $04,$00,$00,$00,$00,$00,$00   ;(or dfb, or whatever)

That's it; it'll send you to whatever code is installed in the ProDos
selector area.

In case my assembler jargon is not clear, here's the monitor commands
to install a quit command at $1000:

1000:20 00 BF 65 06 10
1006:04 00 00 00 00 00 00

Try doing that, and a 1000g will send you to your selector.

Have fun,
Mark Crimmins
crimmins@russell.stanford.edu (arpa)

mackay@dalcsug.UUCP (12/04/87)

In article <871@russell.STANFORD.EDU>, crimmins@russell.STANFORD.EDU (Mark Crimmins) writes:
> In article <210@dalcsug.UUCP> mackay@dalcsug.UUCP (Daniel MacKay) writes:
> >...
> >How is this [the quit] managed?Who remembers the calling program's directory
> >and system file name?  What's the MLI call if it is one, or how's it done
> >otherwise?  Thanks a lot, guys!
> 
> Not in the ProDOS manual?  I kinda doubt that, but...

William DenBesten at Bowling Green State U also sent me the solution, he
mentioned that it isn't in the ProDOS tech ref man, but IS in 
_Beneath Apple ProDOS_.  (maybe it's in the NEW version, I have one for 
ProDOS 1.0)

> 
> Here's the generic way to quit from ProDOS:
> 
>        jsr $BF00	;MLI address
>       .BYTE $65   	;or dfb $65, or whatever
> 		        ;$65 is the MLI QUIT code
>       .WORD qtprms      ;address of a parmeter table (lsb first)
> 
> qtprms: .BYTE $04,$00,$00,$00,$00,$00,$00   ;(or dfb, or whatever)
> ...
> Have fun,
> Mark Crimmins
> crimmins@russell.stanford.edu (arpa)
Thank you VERY much!  it works perfectly.  The FORTH code it translates 
into is:

: BYE CLOSE-ALL 4 PAR! $ 65 MLI.JSR ;

.. so it closes all open files, drops a 4 into the ProDOS parameter list
(why? they're all zeros anyway!!) and calls the MLI function hex 65.

Thank you William, and thank you Mark!
--
+---------+				Dalhousie University
|    _    |     From the		Halifax, Nova Scotia
|   (_)===|     Disk of ...		Canada
|         |      Daniel		mackay@dalcs.UUCP
+---------+			...{utai,uunet}!dalcs!dalcsug!mackay

mat6013@DMZRZU71.BITNET.UUCP (12/04/87)

> In article <210@dalcsug.UUCP> mackay@dalcsug.UUCP (Daniel MacKay) writes:
   [...]
>> The ProDOS tech ref man (the version I have came with ProDOS 1.0) doesn't
>> mention anything about this- in fact, it says that you have to write code
>> that asks the user what application they want to quit to- this is
>> rediculous because it's obvious that AppleWriter, Works, Access //, Ascii
>> Express, AppleSloth (the new version) all do this automatically.
   [...]
> Not in the ProDOS manual?  I kinda doubt that, but...
  [...]

That's *REALLY* true !

 Back in 1984 I bought my copy of the ProDOS Technical Reference Manual just a
few month after ProDOS was first available to the end user.
 It  only  shows a copyright date of 1983 - no release date or revision number
but explicitly references ProDOS 1.0 in the version specific parts.
 On  the other side, the quit call already worked in ProDOS 1.0 and is used by
the Exerciser which is dated Oct 83.

                                        Matthias Kapffer
                                        <MAT6013@DMZRZU71.BITNET>

dalea@cerebus.UUCP (Dale M. Arends X5706) (12/08/87)

In article <217@dalcsug.UUCP> mackay@dalcsug.UUCP (Daniel MacKay) writes:
[and others...]
>> Here's the generic way to quit from ProDOS:
>> 
>>        jsr $BF00	;MLI address
>>       .BYTE $65   	;or dfb $65, or whatever
>> 		        ;$65 is the MLI QUIT code
>>       .WORD qtprms      ;address of a parmeter table (lsb first)
>> 
>> qtprms: .BYTE $04,$00,$00,$00,$00,$00,$00   ;(or dfb, or whatever)
>> ...
>Thank you VERY much!  it works perfectly.  The FORTH code it translates 
>into is:
>
>: BYE CLOSE-ALL 4 PAR! $ 65 MLI.JSR ;
>
>.. so it closes all open files, drops a 4 into the ProDOS parameter list
>(why? they're all zeros anyway!!) and calls the MLI function hex 65.
>
When it was written (as an afterthought to support the Utilities and a
particular Quark product), it was decided that the parameter block would
consist of 4 items: the parameter count (4) and three words that could be
used as pointers to data (or whatever) for the quit routine to use.  This
would allow program dispatchers and the like to keep resident data areas
between program launches as well as a plethora of other possible functions.

Whether or not this capability was ever used, I don't know, but that is the
reason I put it in.  As I have been away from Apple for several years, the 
current situation is not known to me.

The preceeding historical moment was brought to you as a public service and
in no way involves Apple.


-- 
--
		Dale M. Arends  (Fujitsu America Inc., San Jose, Calif.)
		amdahl!cerebus!dalea

The opinions expressed herein do not necessarily reflect those of my employer.
They are entirely my own if they make sense and I disavow them if they don't.