How do I access ProDOS routines from machine language?
You use the ProDOS Machine Language Interface (MLI). The MLI is responsible for carrying out nearly all of the functions (Read Block, Write Block, and 24 others) which ProDOS can perform. Machine language programs call ProDOS by doing a JSR to the MLI at $BF00. To determine which function to perform, ProDOS examines the “command” byte immediately following the JSR instruction. Immediately after the command byte come two more bytes that point to the command’s parameter list. When the call completes, it returns to the code immediately following the parameter list pointer. A ProDOS MLI call looks something like this: 20 00 BF JSR MLI 80 Database COMMAND_CODE 50 03 DW PARAM_LIST_LOCATION B0 __ BCS ERROR In the above, the command code ($80) says “Read a block” and the parameter list is located at $0350. The MLI call returns with the carry flag set and an error code in the accumulator if an error occurred; so, a simple error check (the Branch if Carry Set instruction) is often the next instr
You use the ProDOS Machine Language Interface (MLI). The MLI is responsible for carrying out nearly all of the functions (Read Block, Write Block, and 24 others) which ProDOS can perform. Machine language programs call ProDOS by doing a JSR to the MLI at $BF00. To determine which function to perform, ProDOS examines the “command” byte immediately following the JSR instruction. Immediately after the command byte come two more bytes that point to the command’s parameter list. When the call completes, it returns to the code immediately following the parameter list pointer. A ProDOS MLI call looks something like this: 20 00 BF JSR MLI 80 DB COMMAND_CODE 50 03 DW PARAM_LIST_LOCATION B0 __ BCS ERROR In the above, the command code ($80) says “Read a block” and the parameter list is located at $0350. The MLI call returns with the carry flag set and an error code in the accumulator if an error occurred; so, a simple error check (the Branch if Carry Set instruction) is often the next instruction
Related Questions
- Can the reporting or query language call routines written in a different programming language (e.g. VB, C++, SQL Server Stored Procedure)?
- How can I show a message in translated pages (translated in the appropriate language) that the page has been machine translated?
- How do I access ProDOS routines from machine language?