DOS 3.1 was the first shipping version of Apple II DOS. It was included with the first Disk II drives for the Apple II, in July 1978, in the form of the DOS 3.1 System Master disk. It was replaced with DOS 3.2 in February 1979.
Architecture and Commands
DOS 3.1 has four software layers, each with increasing abstraction.:
- The low-level driver, written by Steve Wozniak, which do the heavy lifiting of actually operating the disk drive
- RWTS, short for Read/Write Track/Sector, which is a basic API for the low-level driver. It only supports four operations, SEEK (to a particular track), READ (a sector), WRITE (a sector), and FORMAT (the whole disk).
- The File Manager, which is the layer that implements a file system using the RWTS functions. The File Manager commands are:
- The Main DOS Routines, which hook into the machine's BASIC interpreter and intercept all disk commands. In addition to snooping all interactive input to the BASIC interpreter, it watches the output from BASIC for control sequences which denote DOS commands. It also implements the following commands:
- BLOAD, which loads a binary program into memory.
- BRUN, which executes a binary program from disk.
- BSAVE, which saves a binary program to disk.
- EXEC, which executes a text file as if it were typed into the BASIC interpreter.
- LOAD, which enters a BASIC program from disk into the interpreter's memory.
- RUN, which runs a BASIC program from disk.
- SAVE, which saves the current BASIC program to a disk file. This file is not a text listing but a packed representation designed to save space.
Documentation
There was never proper documentation for DOS 3.1. The original Disk II systems and the DOS 3.1 System Master disk came with a leaflet outlinking the commands, but not doing a very good job. The Apple DOS reference manual finally shipped with the DOS 3.2 upgrade.
Disk Format
DOS 3.1 format disks have 35 tracks and 16 sectors per track, with 256 bytes per sector. Once formatting overhead is taken into account, this allows a storage capacity of 113.75KB, but 13KB of that is used for DOS and the file catalog, leaving an actual capacity of 100.75KB.
Two kinds of Apple DOS disks can be created. All Apple DOS disks must include a copy of the Apple DOS code, so that they can be recognised and booted by the Disk II controller. "Slave" disks are initialised with a duplicate of the currently running DOS instance by the INIT command. All of the memory addresses on slave disks are fixed, so a slave disk will always act as though it is on a machine with the same memory size as the machine it was initialised on. "Master" disks, on the other hand, are created with the MASTER.CREATE program on the System Master disk, which uses a file RAWDOS to store a relocatable version of DOS on the new master disk. Other than the memory size issue, there is no difference between a slave disk and a master disk.
DOS 3.1 recognises four file types, each identified by a letter in the CATALOG listing. They are:
- I: Integer BASIC programs, stored in a packed, space-saving format.
- A: Applesoft BASIC programs, also stored in a packed, space-saving format.
- B: Binary files, either data files or machine-language programs.
- T: ASCII text files, which can be executed as BASIC programs with the EXEC command (although saving them as type I or A with the SAVE command reduces their size significantly)
Contents of System Master Disk
The DOS 3.1 System Master disk, unlike its successors, has a very austere suite of programs on it. Aside from the MASTER.CREATE and RAWDOS files described above, the following files are found on the System Master disk:
- HELLO, an Integer BASIC program that displays the introductory text shown when booting a DOS 3.1 disk.
- ANIMALS, a BASIC demonstration of the use of disk files.
- COLOR DEMOS, a display hack originally distributed on cassette tape.
- APPLESOFT, a copy of the Applesoft BASIC interpreter with an Integer BASIC loader. To use Applesoft with DOS, the command FP must be run instead of RUN APPLESOFT.
- COPY, which copied files between DOS disks.
Miscellany
A second version of DOS 3.1 was quietly released by Apple that fixed several bugs. A bug in MASTER.CREATE that made creating new master disks more difficult was fixed, but the most important fix was to allow DOS commands from Applesoft BASIC programs after line 255.
The reason why this first version of Apple DOS was numbered 3.1 was due to the way Paul Laughton, the author of the upper two layers of DOS, kept track of builds during development. He started with Revision 0.1 and incremented the number by 0.1 for each build. The final version delivered to Apple was Rev. 2.8, but Apple management decided that they couldn't ship a DOS 2.8 and incremented it to Rev. 3.0. Bugs were discovered in Rev. 3.0 during beta testing and so the final shipping version was version 3.1
Major resources: apple2history.org and emulated Apple DOS 3.1 System Master disk.
(CC)
This writeup is copyright 2003 D.G. Roberge and is released under the Creative Commons Attribution-NonCommercial-ShareAlike licence. Details can be found at http://creativecommons.org/licenses/by-nc-sa/2.0/ .