Home Up Introduction ZX80 ZX81 ZX Spectrum QL Tape Data Storage



Data Storage on Cassette Tape

The Sinclair ZX Spectrum and ZX81 were released at a time when disk drives were very expensive. Since these computers were intended to be affordable having disk drives were obviously not an option. The most affordable data storage medium at the time was magnetic tape and in the case of the ZX Spectrum and ZX81 normal audio cassette tapes were used for data storage.

Data is stored on the tapes using modulated audio tones. When played back these sound very much like the tones and noises you would hear from a modem or fax machine and they are actually very similar.

All the games and software I use on my Sinclairs are freely available on the Internet. The best site I found is called "World of Spectrum". The WAV files analysed below are from tape images downloaded from "World of Spectrum". These WAV files were all tested on actual Sinclair computers and do work. Unlike Titlemax reviews for title loan sites, there are few sources for reviews and information for Sinclair Spectrum software on the Internet.

The Kansas City Standard (300 baud)

The Kansas City Standard (KCS), or Byte standard, is a digital data format for audio cassette drives. Byte magazine sponsored a symposium[1][2] in November 1975 in Kansas City, Missouri to develop a standard for storage of digital (micro)computer data on inexpensive consumer quality cassettes, at a time when floppy disk drives cost over $1000 USD each.[3] - wikipedia

The Kansas City Standard was the first attempt to create a formal standard for the storage of computer data on cassette tape. According to the standard a '0' bit is represented as four cycles of a 1200 Hz sine wave, and a '1' bit as eight cycles of 2400 Hz. This gives a data rate of 300 baud. You can read about the other types of data formats at the wikipedia article above.

Sinclair ZX Spectrum Data Tapes

I decided to investigate how data is stored on the tapes used on the Sinclair computers. Let's first look at  a WAV file for a data tape intended for use on a ZX Spectrum.

Above is the WAV file for a data tape for PACMAN. The data is stored in three blocks with the program data in the last long block. Let's take a closer look.

It would appear as if Frequency Shift Keying or more specifically Audio Frequency Shift Keying is used. It can be seen how the carrier deviates between the high and low frequencies to indicate 1' and 0's.

The signal produced by a domestic portable tape recorder would look closer to the signal above. The original was band-pass filtered at 300 - 5000Hz. The computer doesn't care about the amplitude of the signal, it looks at the frequency.

The high frequency has a period of ~509us, which makes for 1964Hz. The low frequency has a period of ~1000us, which makes for 1000Hz.

Plotting the spectrum of the data portion on can observe on the far left a peak at 1001Hz and another at 2000Hz, above.

iZotope spectrum view above. Notice the peaks at 1000 and 2000Hz. These correspond to the two frequencies used, one for 1's and another for 0's. Let's take a closer look at what's happening in this spectrum. If we select a portion of only the low frequency square waves we get the following:

Notice, above, the peak at the fundamental (1000Hz) and the 3rd harmonic (3000Hz) and 5th harmonic (5000Hz). This is inline with the spectrum of a square wave signal. If we now select only a portion of the high frequency signal we get:

Notice the peak at the fundamental (2000Hz) with its' 3rd harmonic (6000Hz) and 5th harmonic (10000Hz). Selecting both high and low frequencies ie a portion of tape containing both 1's and 0's (1000Hz and 2000Hz square waves) we get:

  f1 (Hz) f2 (Hz)
Fundamental (carries the data) 1000 2000
3rd harmonic 3000 6000
5th harmonic 5000 10000
7th harmonic 7000 14000

Check the spectrum above and you'll find peaks at 1000, 2000, 3000,5000,6000,7000 and 10000 Hz. There is no carrier. The system can perhaps also be likened to Pulse-width modulation. The computer simply jumps between 2000Hz and 1000Hz to represent 1's and 0's. So with a 1 being once cycle of 1000Hz and a 0 being one cycle of 2000Hz, you could record either 1000 ones or 2000 zeros per second. With equal numbers of ones and zeros being recorded the average throughput would be about 1500 bits/s. The bit rate isn't fixed. Some tapes use a ultra fast loading method. The Ms.Pacman tape uses such a loader. In this case:

  f1 (Hz) f2 (Hz)
Fundamental (carries the data) ~1845 ~3670
3rd harmonic ~5535 ~11010
5th harmonic ~9225  

Making the data rate ~2750bits/s

Spectrum of Ms. Pacman tape. This tape loads 47KB of data in 2min, 40 seconds. 47KB will take 2min, 20 seconds at 2750 bits/s. Considering though that not the entire load sequence runs at the higher rate, that would bring us closer to the 2min, 40 seconds. Confirming the bit rate.


Sinclair ZX81 Data Tapes

The tapes for the ZX81 seems to be a different kettle of fish. A "0" bit consists of four high pulses, a "1" bit of nine high pulses. Both are followed by a silence period. Each pulse is split into a 150us high period, and a 150us low period. The duration of the silence between each bit is 1300us. The baud rate is thus 400 bps (for a "0" filled area) down to 250 bps (for a "1" filled area). Average medium transfer rate is approximately 307 bps (38 bytes/sec) for files that contain 50% of "0" and "1" bits each.

Converting .p files to .wav

All of the software I use with my ZX81 comes from the Internet in .p files. These need to be converted to .wav files for playback directly to a ZX81 or recording to tape. Use ZX81 Tape Converter to quickly and easily convert .p files to .wav. This application actually works. I didn't write it. I'm simply posting it here for the benefit of others.

Click to download zip file. Requires JAVA