[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prodos Calls
Bryan Parkoff <BLP-LDS@texas.net> wrote:
> I have two different programs that can execute a file.
>
> Applesoft BASIC
> 10 HOME
> 20 PRINT CHR$(4);"-PROGRAM.SYSTEM"
> 30 END
>
> Machine Language
> JSR $BF00
> $C8,$CA, $CC
> $2000
>
> Can you please give me sample how to write assemble program that can
> execute "PROGRAM.SYSTEM" without using Applesoft BASIC.
This article is more appropriate in comp.sys.apple2.programmer, so I've
cross-posted my reply there, and set followups there as well.
Executing a SYS file from machine code is not something that can be done
in a few lines. In short, you have to do the following steps:
- Get information about the file to validate its file type (optional).
- Open the file.
- Use the GET_EOF call to determine the file size (optional).
- Read it into memory starting at location $2000.
- Close the file.
- Do some setup of the ProDOS global page and other parts of the
environment (e.g. unhook anything your program has attached).
- JMP $2000 to start the program.
I think I've posted an article before showing the code required in
detail, but it wasn't recently enough to be in my archive.
--
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand