Apple II computers initially used audio cassette tapes for storage. How was the data stored? What was the maximum bit rate?
The Apple II recorded data as a frequency-modulated sine wave. A standard consumer cassette deck could be connected to the dedicated cassette port on the Apple ][, ][+, and //e. The //c, ///, and IIgs did not have this port.
A tape could hold one or more chunks of data, each of which had the following structure:
- Entry tone: 10.6 seconds of 770Hz (8192 cycles at 1300 usec/cycle). This let the human operator know that the start of data had been found.
- Tape-in edge: 1/2 cycle at 400 usec/cycle, followed by 1/2 cycle at 500 usec/cycle. This "short zero" indicated the transition between header and data.
- Data: one cycle per bit, using 500 usec/cycle for
0and 1000 usec/cycle for
There is no "end of data" indication, so it's up to the reader to specify the length of data. The last byte of data is followed by an XOR checksum, initialized to $FF, that can be used to check for success.
For machine-language programs, the length is specified on the monitor command line, e.g.
800.1FFFR would read $1800 (6144) bytes. For BASIC programs and data, the length is included in an initial header section:
- Integer BASIC programs have a two-byte (little-endian) length.
- Applesoft BASIC has a two-byte length, followed by a "run" flag byte.
- Applesoft shape tables (loaded with
SHLOAD) have a two-byte length.
- Applesoft arrays (loaded with
RECALL) have a three-byte header.
Note the header section is a full data area, complete with 10.6-second lead-in.
The storage density varies from 2000bps for a file full of
0 bits to 1000bps for a file full of
1 bits. Assuming an equal distribution of bits, you can expect to transfer about 187 bytes/second (ignoring the header).
An annotated 6502 assembly listing, as well as C++ code for deciphering cassette data in WAV files, can be found here. The code in the system monitor that reads and writes data is less then 200 bytes long.
An excellent description of the cassette storage format, along with the monitor and ROM codes that store and retrieve data, are outlined in Apple II Monitors Peeled (start at page 81): ftp://ftp.apple.asimov.net/pub/apple_II/documentation/misc/Apple%20II%20Monitors%20Peeled.pdf
The Apple II Circuit Description (W. Gayler) has a great technical breakdown as well (page 92): http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Books/W.%20Gayler%20-%20The%20Apple%20II%20Circuit%20Description.pdf,