Path: ns-mx!uunet!munnari.oz.au!comp.vuw.ac.nz!actrix!David.Empson
From: David.Empson@actrix.gen.nz (David Empson)
Newsgroups: comp.sys.apple2
Subject: Re: Speaking of the Zip...
Message-ID: <1991Nov18.142243.5711@actrix.gen.nz>
Date: 18 Nov 91 14:22:43 GMT
References: <9111180102.AA09048@ravine.scar.utoronto.ca>
Organization: Actrix Information Exchange, Wellington, New Zealand
Lines: 54
Comment-To: t229taob@RAVINE.SCAR.UTORONTO.CA

In article <9111180102.AA09048@ravine.scar.utoronto.ca> t229taob@RAVINE.SCAR.UTORONTO.CA (Brian Tao) writes:
> David.Empson@actrix.gen.nz (David Empson) writes:
> 
> [..snip..]
> > 2015: 20 00 BF  JSR     $BF00   ; Do a ProDOS QUIT call
> > 2018: 65                $65
> > 2019: 1D 20             $201D
> > 201B: 00 00     BRK     $00
> > 201D: 04 00 00 00 00 00 00
> 
>     Isn't the first byte of the parameter list the byte count?  I type in
> this little program into the monitor and run it whenever something in P8
> crashes and I want to get back to GS/OS.  I've always only used four zero
> bytes, not six.

Nope, the first byte is the PARAMETER count, which in unrelated to the
byte count (except that each parameter is at least one byte).  The P8
Quit call has always been defined as having the following parameter block:
[ProDOS-8 Tech Ref manual, page 87]

	DFB	4		; parameter count
	DFB	00		; quit type (0 is only defined value)
	DW	0000		; reserved
	DFB	00		; reserved
	DW	0000		; reserved

That's six bytes of zeros in total.  GS/OS defines a second quit type
for ProDOS-8 that allows a P8 application to Quit-launch another
application (either P8 or GS/OS).  To do this, you change the quit
type to $EE, and the following word points to a P8 pathname (pascal
string) for the application to launch.

This only works if you booted via GS/OS.

>     BTW, do you know if there's any place in ROM I can call from GSBug so
> that the current (crashed) application will "quit" and return me to the
> previous application? 

This is dangerous, especially if the application uses the toolbox.
You may be able to enter a GS/OS quit call into memory and jump to it,
but I wouldn't trust anything.  Reboot.  It is much safer.

I don't know if it is safe, but you could jump to the GQuit entry
point.  To find it, boot GS/OS and go into BASIC.SYSTEM directly from
Finder.  Disassemble the language card memory at $D100 (in bank 1) and
you will see a JML to the GQuit entry point.  I know from past
experience that this entry point is in a different place in ProDOS-16
and GS/OS, so it could move again.
I also don't know if this entry point works while GS/OS is active.
-- 
David Empson

EMPSON_D@kosmos.wcc.govt.nz
David.Empson@bbs.actrix.gen.nz
