Classic Computer Magazine Archive COMPUTE! ISSUE 54 / NOVEMBER 1984 / PAGE 10

Apple ML Disk Access

I own an Apple IIe computer and do a lot of my programming in machine language. One of the things I'm currently working on is a program that accesses the disk drive from ML using the RWTS and File Manager routines in DOS. The way to access these routines is to JMP to location $3D9 for RWTS or to $3D6 for File Manager. At each of these locations is another JMP that goes somewhere in DOS. In Apple's new Disk Operating System, ProDOS, there is nothing at these addresses to JMP to RWTS or File Manager. Could you tell me how to access RWTS and File Manager from ProDOS?

Daniel Wilson

Apple's ProDOS operating system might resemble DOS 3.3 when used from BASIC; but, as you have discovered, it is quite different when used from machine language. The RWTS ("Read or Write a Track and Sector") and File Manager subroutines are parts of DOS 3.3, not the Apple IIe, and aren't included in ProDOS. Instead, all operating system services are requested by calling the ProDOS MLI (Machine Language Interface). There are 24 functions that can be requested through the MLI, including many of the functions performed by the DOS File Manager.

Unlike DOS 3.3, which works only with Disk II drives, ProDOS is designed to work with many different disk drives, each with its own method of storing data. ProDOS organizes data into "blocks" of 512 bytes, which may or may not correspond to the size of the sector used by the storage device. The MLI contains functions to read and write individual blocks from disk, which are barely equivalent to RWTS's functions, but these are intended only for diagnostic and repair purposes. For ordinary use, direct disk access is not recommended because file operations are provided which could do the same job.

The MLI is called by a JSR $BF00 instruction, followed by three bytes of data. The first byte is the number of the MLI function being requested, and the second and third bytes contain the address of the parameter list for the request. These three bytes must be placed in your program immediately after the JSR $BF00 instruction. The MLI function dispatcher increases the return address on the stack by three to skip over these bytes.

Although the MLI performs many of the same functions as the DOS File Manager, there is no compatibility between the two. ProDOS has a completely different set of function codes, error codes, and parameter list formats. Information about these codes, the structure of ProDOS, and lots more, is available in the Apple ProDOS Technical Reference Manual. This publication is available from most Apple dealers and is intended for advanced programmers who want to use ProDOS from machine language.