# Disk 6: Apple DOS



The DOS Collection of the AppleIIAsm Library consists of macros and subroutines dedicated to interfacing with Apple DOS, providing an abstraction layer for the programmer on top of the lower level routines used by DOS such as the file manager and RWTS. All of the basic functions of DOS are available for use, save for specific macros dedicated solely to reading and writing text files. The reasoning for this is that 1) unless you are interfacing with a BASIC program or another system, text files are largely unnecessary (binary files work better), and 2) text file manipulation often requires creating a system of your own since there is no simple default way to read the end of a file. The macros and routines that do exist can be used to create your own custom system for reading and writing text files.

Of all the collections in the library, the DOS collection is perhaps the most convoluted and has the largest overhead due to the more complex nature of its functionality. There are many subroutines and macros that are meant to be used only by the collection itself, though the enterprising programmer may of course utilize them. These are described in the detailed listings.



---



### MAC.DOSREQ.ASM

| MACRO   | DEPENDENCY   | PARAMETERS                                                   | ACTION                                                       | DESTROYS | CYCLES | BYTES |
| ------- | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | ------ | ----- |
| `FMFIL` | HEAD.DOS.ASM | ]1 = Command <br/>]2 = Slot<br />]3 = Drive<br />]4 = Volume<br />]5 = Record | Fill most common parameters of the File Manager.             | NZCV     | 603    | 303   |
| `FMNAM` | HEAD.DOS.ASM | ]1 = String Address                                          | Copy a string to the file name parameter in the File Parameter List. | NZCV     | 117    | 70    |
| `FRWB`  | HEAD.DOS.ASM | ]1 = Read/Write flag <br />]2 = Command<br />]3 = Slot<br />]4 = Drive<br />]5 = Volume<br />]6 = Record<br />]7 = Byte Offset<br />]8 = Write Byte | Read or write a byte from or to a file. Use `FRWRTB` and `FRDB` instead of this, both of which call this macro. | NZCV     | 779    | 404   |
| `FWRTB` | HEAD.DOS.ASM | ]1 = Slot<br />]2 = Drive<br />]3 = Volume<br />]4 = Record<br />]5 = Byte Offset<br />]6 = Write Byte | Write a byte to a file.                                      | NZCV     | 665    | 337   |
| `FRDB`  | HEAD.DOS.ASM | ]1 = Slot<br />]2 = Drive<br />]3 = Volume<br />]4 = Record<br />]5 = Byte Offset<br />]6 = Write Byte (always 0) | Read a byte from a file.                                     | NZCV     | 700    | 357   |
| `FRWR`  | HEAD.DOS.ASM | ]1 = Read/Write flag<br />]2 = Command<br />]3 = Slot<br />]4 = Drive<br />]5 = Volume<br />]6 = Record<br />]7 = Byte Offset<br />]8 = Range Address<br />]TEMP = Range Length | Read or write a range of bytes in a file. Use `FRDR` or `FWRTR` instead of this macro directly. | NZCV     | 846    | 451   |
| `FRDR`  | HEAD.DOS.ASM | ]1 = Slot<br />]2 = Drive<br />]3 = Volume<br />]4 = Record<br />]5 = Byte Offset<br />]6 = Range Address<br />]7 = Range Length | Read a range of bytes from a file.                           | NZCV     | 697    | 361   |
| `FWRTR` | HEAD.DOS.ASM | ]1 = Slot<br />]2 = Drive<br />]3 = Volume<br />]4 = Record<br />]5 = Byte Offset<br />]6 = Range Address<br />]7 = Range Length | Write a range of bytes to a file.                            | NZCV     | 940    | 509   |
| `sRWTS` | HEAD.DOS.ASM | ]1 = Slot<br />]2 = Drive<br />]3 = Volume <br />]4 = Track<br />]5 = Sector<br />]6 = Buffer<br />]7 = Command | Set the most common RWTS parameters.                         | NZCV     | 228    | 141   |
| `GRWTS` | HEAD.DOS.ASM | none                                                         | Execute the RWTS routine.                                    | NZCV     | 19     | 11    |





### MAC.DOSFM.ASM

| MACRO   | DEPENDENCY     | PARAMETERS                                                   | ACTION            | DESTROYS | CYCLES | BYTES |
| ------- | -------------- | ------------------------------------------------------------ | ----------------- | -------- | ------ | ----- |
| `FCAT`  | HEAD.DOS.ASM   | ]1 = Slot <br />]2 = Drive                                   | Catalog.          | NZCV     | 657    | 348   |
| `FULCK` | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = Slot<br />]3 = Drive         | File unlock.      | NZCV     | 629    | 353   |
| `FLOCK` | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = Slot<br />]3 = Drive         | File lock.        | NZCV     | 172    | 116   |
| `FDEL`  | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = Slot<br />]3 = Drive         | File delete.      | NZCV     | 791    | 412   |
| `FVFY`  | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = Slot<br />]3 = Drive         | File verify.      | NZCV     | 791    | 411   |
| `FCLOS` | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = Slot<br />]3 = Drive         | File close.       | NZCV     | 797    | 415   |
| `FRENM` | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = New filename address<br />]3 = Slot<br />]4 = Drive | File rename.      | NZCV     | 927    | 578   |
| `FOPEN` | HEAD.DOS.ASM   | ]1 = Filename address<br />]2 = Slot<br />]3 = Drive<br />]4 = Volume<br />]5 = Record | File open.        | NZCV     | 828    | 433   |
| `BLOAD` | SUB.FBLOAD.ASM | ]1 = Filename address<br />]2 = Load address<br />]3 = Slot<br />]4 = Drive<br />]5 = Volume | Load binary file. | NZCV     | 3768   | 2735  |
| `BSAVE` | SUB.FBSAVE.ASM | ]1 = Filename address<br />]2 = Load address<br />]3 = Range length<br />]4 = Slot<br />]5 = Drive<br />]6 = Volume | Save binary file. | NZCV     | 5300   | 2758  |



### MAC.DOSMORE.ASM

| MACRO   | DEPENDENCY | PARAMETERS | ACTION                                       | DESTROYS | CYCLES | BYTES |
| ------- | ---------- | ---------- | -------------------------------------------- | -------- | ------ | ----- |
| `DVER`  | none       | none       | Get DOS version.                             | NZCV     | 28     | 18    |
| `DOSIN` | none       | none       | Check if DOS is loaded.                      | NZCV     | 17     | 12    |
| `ABAS`  | none       | none       | Check if Applesoft is loaded.                | NZCV     | 40     | 29    |
| `IBEX`  | none       | none       | Check if Integer Basic program is running.   | NZCV     | 17     | 12    |
| `ABEX`  | none       | none       | Check if Applesoft Basic program is running. | NZCV     | 26     | 18    |