[comp.sys.apple] Apple Tech note on calling Basic System Tasks from Assembler...

ranger@ecsvax.UUCP (Rick N. Fincher) (06/01/87)

I recently got a request from Ted Medin for help about calling the 
Prodos CAT command from assembler.  I'm posting this to the net because
I'm sure there are others out there who can use this info.  I'm going to
be quoting from Prodos Tech Note #2 for those who want to go back and
look up the full text.

To start off with, Prodos does not have a built in directory or catalog
function.  The CAT command is provided by Basic.System.  If you are willing
to sacrifice the 10.5 K or so that Basic.System occupies, your assembly
language programs can call all of its built in functions (Cat, Catalog
Rename, delete, lock, unlock, create, prefix, bye, etc. etc.) by placing
the ASCII string for the command in the getln buffer ($200) and issue a
JSR BE03.

Sending strings preceded by an ASCII 4 (Control-D) to COUT does NOT work.
PR# and IN# will also not work with the JSR BE03 technique.

It is not explicitly stated in the Tech note, but I'm pretty sure that you
don't use a Control-D in the string that you put in $200.  This appears to
be the routine (JSR BE03) that executes immediate Prodos commands typed
from the keyboard, so Control-D is not needed.

This method will also allow the BLOAD and BSAVE commands to be used easily
from assembler.  If you are a relatively inexperienced assembly language
programmer, this method may well use less memory than if you were to 
write the code yourself to do all of these functions.  It will certainly be
quicker to use them than to reinvent the wheel, no matter how experienced
you are.

Hope this helps,

Rick Fincher
ranger@ecsvax