[comp.sys.apple2] ProDos from machine language

archie@wheatena.berkeley.edu (Archie Cobbs) (03/20/90)

Hi everyone. I have a question regarding ProDos. I don't use it much so
this is probably pretty easy to answer. You know how in Applesoft you
can say:

	10  D$ = CHR$(4)
	20  PRINT D$;"CATALOG"

or whatever. Under DOS 3.3 you can do the exact same thing in assembly
language (by sending the appropriate sequence of characters to $FDED)
and DOS 3.3 will respond. However, under ProDos it seems that while the
above Applesoft program works, the machine language equivalent doesn't
get the attention of ProDos, and your command just appears unanswerd
on the screen.

My question is not "how do you interface with ProDos from machine
language?", which I know there is some way to do similar to
DOS 3.3's file manager, but "how can I get ProDos to read a command
string?" For example, I have a program where the user can issue any disk
command, and the program just sends whatever the user asks for to $FDED
with a control-d prepended, but this doesn't work in ProDos.

Any solutions / explanations would be appreciated.

-Archie
Archie Cobbs					  archie@brahms.berkeley.edu

gt0t+@andrew.cmu.edu (Gregory Ross Thompson) (03/21/90)

archie@wheatena.berkeley.edu (Archie Cobbs) writes:
> or whatever. Under DOS 3.3 you can do the exact same thing in assembly
> language (by sending the appropriate sequence of characters to $FDED)
> and DOS 3.3 will respond. However, under ProDos it seems that while the
> above Applesoft program works, the machine language equivalent doesn't
> get the attention of ProDos, and your command just appears unanswerd
> on the screen.

  What you want is "Beneath Apple Prodos" from Quality Software.  It
fully documents the ProDOS MLI.  I've found the book to be invaluable.
Basically, you call the MLI, tell it what you want it to do, and where
it can find the parameters.  It does its thing, and then all you do is
read back the error from the accumulator, and go to the parameter list
and get the returned values.  Kinda simple...

> -Archie
> Archie Cobbs                                      archie@brahms.berkeley.edu

		-Greg T.

archie@russet.berkeley.edu (Archie Cobbs) (03/21/90)

In article <ca1cg8m00WB9It0oZA@andrew.cmu.edu> gt0t+@andrew.cmu.edu (Gregory Ross Thompson) writes:
>  What you want is "Beneath Apple Prodos" from Quality Software.  It
>fully documents the ProDOS MLI.  I've found the book to be invaluable.
>Basically, you call the MLI, tell it what you want it to do, and where
>it can find the parameters.  It does its thing, and then all you do is
>read back the error from the accumulator, and go to the parameter list
>and get the returned values.  Kinda simple...
>
>		-Greg T.

I apologize for not making this clearer. I don't want to deal with MLI or
anything. I want to be able to take a BASIC.SYSTEM command such as
"CATALOG /RAM" or whatever and send that string directly to ProDos (running
under BASIC.SYSTEM) and have it deal with interpreting it. The reason is
that I have a program where the user can enter ANY disk command they please.
It's ridiculous for me to parse the command and then send it to ProDos when
there already exist more competent routines for doing that. I just need an
address that bypasses the TRACE filtering junk that ProDos does or something.
Maybe it would be help to state that this program is actually attached to
an Applesoft program like this:

	10  ON ERR GOTO 30
	20  CALL XXX1
	30  CALL XXX2

So the idea is that DOS thinks an Applesoft program is running, so if the
user enters a bogus command, control goes back to my program where the error
is printed out and life is restored to normal. This avoids MLI's and such,
which is what I want to do if possible because it means more stuff to learn
for a silly program that's probably not worth the trouble in the first place.

If this book has locations for doing this kindof thing then I'll get it.
Thanks.

-Archie

Archie Cobbs					  archie@brahms.berkeley.edu

ggray@wpi.wpi.edu (Gary P Gray) (03/21/90)

In article <1990Mar20.224015.25922@agate.berkeley.edu> archie@brahms.berkeley.edu writes:
  {really the best way to do this deleted }
I think I know what you want.

From March 1988 Nibble magazine (not direct quotes)
By S. Scott Zimmerman "Nibbling at Assembly Langauge Part XV"


Place the string containing the command into the input buffer starting at
$200. The string can be up to 255 chars long and must end with a return.
All of the characters must have the high bit set, and all letters must be
upper case. They must be immediate mode operations, not stuff like READ or
Write.

Issue a jsr $BE03.  Errors will be indicated with the carry bit set, and an
error number in the accumulator. You can print out the standard error message
using the prodos routine at $BE0C.

Disclaimer: A) I did not ask the author to print this info
            B) I have never tried this. If you have problems I can check the
               article again, but I have no practical experience.

-- 
-- WARNING!!! The above opinions may be HAZARDOUS or FATAL if swallowed!!! --
This has only been a test. Had these      |  Gary Gray -- ggray@wpi.wpi.edu
been real opinions you would have been    |  GEnie: GGRAY6
told who to sue by your local lawyers.    |

greyelf@wpi.wpi.edu (Michael J Pender) (03/21/90)

In article <1990Mar20.224015.25922@agate.berkeley.edu> archie@brahms.berkeley.edu writes:
>I apologize for not making this clearer. I don't want to deal with MLI or
>anything. I want to be able to take a BASIC.SYSTEM command such as
>"CATALOG /RAM" or whatever and send that string directly to ProDos (running
>under BASIC.SYSTEM) and have it deal with interpreting it. 

I understood.  From the Prodos 8 technical Reference Guide, all
you have to do is place the desired basic command in the input buffer
at $200, an ascii string with high bits set, and should end with a 
carriage return, just the way getln would leave it.

Then JSR $BE03 (known as DOSCMD).  If the carry is set an error
occurred and the error type (basic system error number) is returned
in the accumulator.

Please note, not all commands work properly this way, some of the ones
that DON'T work include run, -, load, chain, read, write, append and 
exec, they might not return to the assembler program.

The ones that do work are cat, catalog, prefix, create, rename,
delete, lock, unlock, save, store, restore, pr#, in#, fre, open
close, flush, position, brun, bload, and bsave.

---
Michael J Pender Jr  Box 1942 c/o W.P.I.   W.O.S. is not dead.
greyelf@wpi.bitnet   100 Institute Rd.     ...its time to get started,
greyelf@wpi.wpi.edu  Worcester, Ma 01609   there is much to be done.
If my next computer isn't a IIgs, it won't be an apple... Me.