[comp.sys.apple] Ending a SYS file

ART100@psuvm.psu.edu (Andy Tefft) (02/14/90)

Since I found out that the keyboard buffer recently posted to comp.bin.
works with hyperc, I thought I'd try to make it into a SYS file.
I managed to assemble a little relocator which works fine but now
I need to know how to end the thing. The simplest way to code would
be to do a prodos bye, but the simplest way to use would be if it
could just go ahead and execute another system file (which i will know,
of course, and be able to assemble in there). How can I do either of
these?

--
Andy Tefft                     art100@psuvm.psu.edu

fadden@cory.Berkeley.EDU (Andy McFadden) (02/14/90)

In article <90044.234706ART100@psuvm.psu.edu> ART100@psuvm.psu.edu (Andy Tefft) writes:
[snip]
>I need to know how to end the thing. The simplest way to code would
>be to do a prodos bye, but the simplest way to use would be if it
>could just go ahead and execute another system file (which i will know,
>of course, and be able to assemble in there). How can I do either of
>these?

Executing a ProDOS bye:
1) Call the MLI "bye" command.           (sorry  :-) )
[ 300:20 0 bf 4 65 0 0 0 0 n300g    ...I think... ]

Executing another system file:
1) Read the file into memory at $2000
2) jmp $2000

The read routine isn't hard to code... just do a GET_EOF on the file
and then do a READ for that number of bytes.  Add a few OPENs and CLOSEs,
and you're all set.

>Andy Tefft                     art100@psuvm.psu.edu

-- 
fadden@cory.berkeley.edu (Andy McFadden)
...!ucbvax!cory!fadden

BRL102@psuvm.psu.edu (Ben Liblit) (02/15/90)

In article <22086@pasteur.Berkeley.EDU>, fadden@cory.Berkeley.EDU (Andy
McFadden) says:
>
>Executing a ProDOS bye:
>1) Call the MLI "bye" command.           (sorry  :-) )
>[ 300:20 0 bf 4 65 0 0 0 0 n300g    ...I think... ]

Almost!  The correct code is

     300:20 0 bf 65 6 3 4 0 0 0 0 0 0n300g

although this doesn't really sound like what the original poster was asking for
in the first place.   :-)

                      Ben Liblit
                      BRL102 @ psuvm.bitnet -- BRL102 @ psuvm.psu.edu
                      "Fais que tes reves soient plus longs que la nuit."

cs122aw@ux1.cso.uiuc.edu (Scott Alfter) (02/15/90)

In article <22086@pasteur.Berkeley.EDU> fadden@cory.Berkeley.EDU.UUCP (Andy McFadden) writes:
>Executing a ProDOS bye:
>1) Call the MLI "bye" command.           (sorry  :-) )
>[ 300:20 0 bf 4 65 0 0 0 0 n300g    ...I think... ]

Just a little off.  When the system bombs on me (not often, unlike the Mac), I
give this incantation from the Monitor:

300:20 0 BF 65 10 3 N 310:4 0 0 0 0 N 300G

This will dump you into the quit code.  If you put it in assembly language, it
looks like this:

MLI     EQU  $BF00      ;Entry to ProDOS MLI
        JSR  MLI        ;Call the MLI
        DFB  $65        ;QUIT
        DA   PARMS      ;Address of parameter table
PARMS   HEX  04         ;Parameter table for QUIT:  4 nulls
        HEX  00000000

(The above source will work for Big Mac or Merlin.  A different assembler will
take different pseudo-ops.  But you already knew that, right? :-) )

Scott Alfter-------------------------------------------------------------------
Internet: cs122aw@ux1.cso.uiuc.edu    _/_ Apple IIe: the power to be your best!
          alfter@mrcnext.cso.uiuc.edu/ v \
          saa33413@uxa.cso.uiuc.edu (    (              A keyboard--how quaint!
  Bitnet: free0066@uiucvmd.bitnet    \_^_/                     --M. Scott, STIV

dlyons@Apple.COM (David A. Lyons) (02/15/90)

In article <1990Feb14.203730.1970@ux1.cso.uiuc.edu> cs122aw@ux1.cso.uiuc.edu (Scott Alfter) writes:
>[...]
>This will dump you into the quit code.  If you put it in assembly language, it
>looks like this:
>
>MLI     EQU  $BF00      ;Entry to ProDOS MLI
>        JSR  MLI        ;Call the MLI
>        DFB  $65        ;QUIT
>        DA   PARMS      ;Address of parameter table
>PARMS   HEX  04         ;Parameter table for QUIT:  4 nulls
>        HEX  00000000

Technically, you're supposed to have SIX bytes of $00 in the parameter list,
not just 4.  (The 4 is the correct count, but two of the parameters are
defined as two-byte values, for a total of 6.)
-- 
David A. Lyons, Apple Computer, Inc.      |   DAL Systems
Apple II Developer Technical Support      |   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.

cs122aw@ux1.cso.uiuc.edu (Scott Alfter) (02/15/90)

In article <38653@apple.Apple.COM> dlyons@Apple.COM (David A. Lyons) writes:
>Technically, you're supposed to have SIX bytes of $00 in the parameter list,
>not just 4.  (The 4 is the correct count, but two of the parameters are
>defined as two-byte values, for a total of 6.)

Sorry about that.  I always thought it was only 4, but I just looked in 
Beneath Apple ProDOS, and it says six.  I've always used a particular article
in Nibble in the past as an MLI reference, but it had absolutely nothing at
all on the QUIT call.  I don't even remember where I figured out the QUIT
call to begin with!

Scott Alfter-------------------------------------------------------------------
Internet: cs122aw@ux1.cso.uiuc.edu    _/_ Apple IIe: the power to be your best!
          alfter@mrcnext.cso.uiuc.edu/ v \
          saa33413@uxa.cso.uiuc.edu (    (              A keyboard--how quaint!
  Bitnet: free0066@uiucvmd.bitnet    \_^_/                     --M. Scott, STIV

jetzer@studsys.mu.edu (Mike Jetzer) (02/15/90)

In article <22086@pasteur.Berkeley.EDU> fadden@cory.Berkeley.EDU.UUCP (Andy McFadden) writes:
>Executing another system file:
>1) Read the file into memory at $2000
>2) jmp $2000

>The read routine isn't hard to code... just do a GET_EOF on the file
>and then do a READ for that number of bytes.  Add a few OPENs and CLOSEs,
>and you're all set.

Even easier:  Never mind the GET_EOF call; just request $FFFF bytes.
If the read is successful, and it read more than $0000 bytes, there
you have it!




-- 
Mike Jetzer
"Hack first, ask questions later."

cwilson@NISC.SRI.COM (Chan Wilson) (02/15/90)

In article <22086@pasteur.Berkeley.EDU> fadden@cory.Berkeley.EDU.UUCP (Andy McFadden) writes:
>In article <90044.234706ART100@psuvm.psu.edu> ART100@psuvm.psu.edu (Andy Tefft) writes:
>[snip]
>>I need to know how to end the thing. The simplest way to code would
>>be to do a prodos bye, but the simplest way to use would be if it
>>could just go ahead and execute another system file (which i will know,
>>of course, and be able to assemble in there). How can I do either of
>>these?
>
>Executing a ProDOS bye:
>1) Call the MLI "bye" command.           (sorry  :-) )
>[ 300:20 0 bf 4 65 0 0 0 0 n300g    ...I think... ]

Close, but no cigar.

Try 800:20 0 bf 65 6 8 4 n 800g

Disassembly:

800:20 00 BF	Jsr $BF00  	(MLI)
803:65		Hex 65		(quit code for P8)
804:06 08	Da  $0806	(parm table)
806:04		Hex 04		(# of Paramters)
		(don't need any paramaters for a Q&D quit)

>>Andy Tefft                     art100@psuvm.psu.edu

>fadden@cory.berkeley.edu (Andy McFadden)

--Chan
			   ................
  Chan Wilson -- cwilson@nisc.sri.com <or> radius!cwilson@apple.com
Janitor/Architect of comp.binaries.apple2 archive on wuarchive.wustl.edu
	      I don't speak for SRI, someone else does.
			   ................

cs122aw@ux1.cso.uiuc.edu (Scott Alfter) (02/16/90)

In article <13228@fs2.NISC.SRI.COM> cwilson@NISC.SRI.COM (Chan Wilson) writes:
>800:20 00 BF	Jsr $BF00  	(MLI)
>803:65		Hex 65		(quit code for P8)
>804:06 08	Da  $0806	(parm table)
>806:04		Hex 04		(# of Paramters)
>		(don't need any paramaters for a Q&D quit)

You'd better throw six zeros after the "HEX 04" command.  Apple ain't using
them now, but they might in the future.  (BTW, I thought it was four zeros,
but I've gotten mail since that says to use six.)

Scott Alfter-------------------------------------------------------------------
Internet: cs122aw@ux1.cso.uiuc.edu    _/_ Apple IIe: the power to be your best!
          alfter@mrcnext.cso.uiuc.edu/ v \
          saa33413@uxa.cso.uiuc.edu (    (              A keyboard--how quaint!
  Bitnet: free0066@uiucvmd.bitnet    \_^_/                     --M. Scott, STIV

dlyons@Apple.COM (David A. Lyons) (02/18/90)

In article <1990Feb16.045044.4162@ux1.cso.uiuc.edu> cs122aw@ux1.cso.uiuc.edu (Scott Alfter) writes:
[in the ProDOS 8 QUIT command]
>You'd better throw six zeros after the "HEX 04" command.  Apple ain't using
>them now, but they might in the future.  (BTW, I thought it was four zeros,
>but I've gotten mail since that says to use six.)

In a limited way, the parameters *are* currently used.

If the first one-byte parameter is $EE, then the Quit is an "enhanced"
quit call, and the next (2-byte) parameter points to the pathname of
an application to launch.  The enhanced quit call is currently implemented
only when GS/OS has been booted (and therefore only on a GS).

The application to be launched can be a SYS, S16, or EXE file.  The
high bits of the characters in the name *are* important (they should
normally be off, as for all ProDOS pathnames).
-- 
David A. Lyons, Apple Computer, Inc.      |   DAL Systems
Apple II Developer Technical Support      |   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.

L77@TAUNOS.BITNET (02/19/90)

> In article <22086@pasteur.Berkeley.EDU> fadden@cory.Berkeley.EDU.UUCP (Andy
>  McFadden) writes:
>>Executing another system file:
>>1) Read the file into memory at $2000
>>2) jmp $2000

>>The read routine isn't hard to code... just do a GET_EOF on the file
>>and then do a READ for that number of bytes.  Add a few OPENs and CLOSEs,
>>and you're all set.


 >Even easier:  Never mind the GET_EOF call; just request $FFFF bytes.
 >If the read is successful, and it read more than $0000 bytes, there
 >you have it!

..but then you better watch BEQing upon a successful call,i.e. error
code=$00,because the error code for EOF-encountered is NOT $00 (I forget what
it IS right now).

                       L77@TAUNOS