ProDOS MLI example Print E-mail
Source Code
Written by Jeremiah Stoddard   
Sunday, 20 April 2008 16:38

The ProDOS Machine Language Interface allows the assembly language programmer to utilize ProDOS disk functions. An MLI call consists of JSR $BF00 followed by three bytes. The first byte is a number identifying the function you want to use (e.g. $C7 identifies the function GET_PREFIX which returns the current prefix), and the next two bytes contain the address of a parameter list. The first byte of the parameter list is the number of parameters, followed by the parameters themselves. This is documented in the ProDOS 8 Technical Reference Manual, but in case it's of help to anyone, I've provided (below) an example of using a ProDOS MLI call from the ORCA/M Macro Assembler. ORCA also has Macros to take care of MLI calls, but that can be discussed at another time.

 

* GP - GET PREFIX
* AN EXAMPLE OF USING THE PRODOS $C6 MLI CALL TO GET THE DEFAULT PREFIX.
* THE DEFAULT PREFIX (IF ANY) IS PRINTED TO THE SCREEN.

         KEEP  GP
MAIN     START
         JSR   $BF00                    PRODOS MLI ROUTINE
         DC    H´C7´                    FILL NEXT BYTE WITH $C7 - GET PREFIX
         DC    A´ARGS´                  ADDRESS TO ADDRESS OF BUFFER
         CMP   #$00
         BNE   END                      THERE WAS AN ERROR
         LDA   PNAME                    NUMBER OF CHARACTERS
         CMP   #$00
         BEQ   END
         TAY
         LDX   #$01
LOOP     LDA   PNAME,X
         ORA   #$80                     COUT EXPECTS MSB TO BE ON
         JSR   $FDED                    COUT
         INX
         DEY
         BNE   LOOP
END      RTS

ARGS     DC    H´01´                    NUMBER OF PARAMETERS
         DC    A´PNAME´                 LOCATION OF THE PATHNAME
PNAME    DS    64                       THE PATHNAME WILL GO HERE
         END