I have a simple program on my Apple IIc written in assembly language. It starts by getting a filename from the user (just the file name, not the full path), then it opens the corresponding file with a MLI call (
$C8). To my suprise, the MLI call returned error
$40: "Pathname has invalid syntax". I have checked all parameters, but they where OK. I have tried to type
PREFIX /myvolume before starting my program. And this time, it worked! (The file was opened without any error.) I understood that when you start ProDOS (just PRODOS and BASIC.SYSTEM), then the prefix is empty. I have checked it, by replacing the
open MLI call by a
get_prefix call. And yes, the prefix length is 0.
Did you know that? Until then, I believed that the prefix was set to the root prefix of the booting disk by the system at boot.
For the story, reading here and there, I have found a workaround by reading the path of the running program (my program in that case) at memory address
$280, and calling
set_prefix to that path. A lot of assembly lines. My assembly program and the file to read have the same prefix (same directory).
Can you confirm my analysis?