Why did the Sinclair ZX-Spectrum use edges for its standard tape storage routines?

I can see that frequency modulation was likely necessary in order to account for the inaccurate timings when running off the lower 16Kbs in the lower-end models.

However, as I understand it, EAR/MIC I/O was level based. Analog tapes also appear to have been based on amplitude modulation.

Given that both elements are amplitude based, it seems unnecessary if not dangerous to rely on edges when levels would appear to be fine after applying some chattering removal.

Was it related to the polarity of the tape recorders or something else entirely?

  • 1
    My understanding was that it enabled the use of cheaper circuitry - although at the expense of accuracy.
    – Chenmunka
    Feb 7, 2017 at 12:49
  • 2
    I'm not sure you could call the tape input "edge-based" - The input signal is apparently sampled with the CPU clock, not with the tape signal's edge. At least the Harlequin schematics look like that.
    – tofro
    Feb 7, 2017 at 15:01

3 Answers 3


I'm not sure what you mean with "EAR/MIC I/O was level based". In the ZX Spectrum, the EAR input is a digital input, so it can only be 1 or 0. You cannot measure the input level beyond that.

The main reason to use edges is for the system to work independently of the audio source. Other systems, such as the Commodore 64, need the datasette to supply a signal with the correct polarity, or the program won't load (this is because the CIA only detects falling edges and starts measuring time from those). The ZX Spectrum doesn't matter if it is a rising or falling edge. It just has to be an edge.

Working with levels in a polarity independent way may require more complex code, and one distinctive feature of the ZX Spectrum ROM loader is that it doesn't require any memory location to hold temporary variables while it is executing. Everything (byte being loaded, bit being added to the current byte, time constants, counters, checksum, length of data to load, current address to store the loaded byte to, etc, are held in registers. Only the stack is used as the routine calls several sub-routines. A more complex code might break that.

"it seems unnecessary if not dangerous to rely on edges when levels would appear to be fine after applying some chattering removal". Chattering removal would need a better input filter, and/or a hysteresis driven input. None of that is present in the ZX Spectrum.

Of course, an edge based loader has the inconvenient of triggering load errors if an edge is read when it shouldn't. The ZX Spectrum tries to minimize the effect of spureous signals by forcing the user to use a volume setting of about 70-75%, which is pretty loud.

  • Anything over about 0.7V is a 1, right? What I don't understand is why a "1" could be a read as a "0" and vice-versa. Is it a property of the tape recorder, the tape itself or the input circuit?
    – user4433
    Feb 7, 2017 at 21:16
  • If you are writting a tape loader that is based on levels, and do care about polarity (note that the problem here is not levels per se, but polarity), then your loader may expect to read a positive semiwave (1) followed by another one negative (0). It would measure its period and would deduce that the complete wave encodes a 0 or a 1. Feb 7, 2017 at 21:30
  • 1
    But if your tape player inverts the audio signal respect to the polarity it reads from the tape head (on audio, polarity inversion is not an issue so the tape amplifier may do just that), the effect is that the complete signal is shifted half period, and what should be a 0 may be turn to 1. Feb 7, 2017 at 21:30
  • Indeed, if a tape format uses a long high and long low for a "1", and a short high and short low for a "0", then the time between consecutive rising edges will be long for a 1 and short for a 0, regardless of preceding bits, but an intermediate amount of time will appear between consecutive falling edges that occur between 0 and 1 bits or vice versa.
    – supercat
    Mar 19, 2021 at 20:25

It's the normal way to do it. In fact floppies and hard drives work this way too.

In an analog signal recording on a magnetic media:

  • Amplitude is unreliable since the chemistry of the tape, the recording bias, the read/write head amp, the length of the cable, the output volume, etc can all affect amplitude.

  • Frequency, on the other hand, has only the tape speed as a variable.

As tylisim hinted in a comment above, there is another factor which is due to the nature of the head: the signal needs to be cycled regularly, otherwise the surface of the head will resist change and playback will be altered.

Recordings on magnetic media therefore encode data as flux reversal over time. This is very convenient since time is quite reliable, and edge changes are much easier to deal with, from an electronics' perspective, than amplitude levels.

This also allows to encode synchronization marks into the signal so that the timing loop knows the actual speed of the tape and can re-calibrate itself at regular interval during the read operation.

The most common format for floppies was MFM, where 50% of the data actually written on the disk was to keep the head from staying too long in the same state, and also synchronize the controller with the actual read speed. Apple used another format called GCR but it was an exception.

Tapes do not have the same density as floppies and the heads have a larger mass, so they do not need flux reversal as often, but the theory is the same.

  • I don't think tape or disk heads would necessarily care about flux reversals on the tape, but if one only has a single tape head and e.g. tries to store UART-format data, it may be hard to distinguish between 1000000111 and 100000001111. On a nine-track tape, it's necessary that at least one track has a phase transition for every recorded byte, but any individual track might go an arbitrary amount of time without any phase transitions.
    – supercat
    Mar 18, 2021 at 16:43
  • @supercat 9 tracks tapes are quite specific, the hardware is built specifically for this and the tapes were never cheap. With home computers, you had to deal with consumer grade tape players and low quality media. Floppy heads are very small so there is definitely a question of lag without reversal. On tapes, it’s more questionable but with cheap and random hardware it remains a safe option.
    – Thomas
    Mar 18, 2021 at 18:35
  • It's easier to design an audio amplifier circuit which operates at a range of positive voltages above ground than one which can operate at both positive and negative voltages, so most practical audio amplifiers use capacitively-coupled input and output stages. That's true not just of tape recording and playback devices, but most audio equipment in general. As for floppy drives, they often have automatic gain control circuitry, which will be prone to dial itself up too much given a significant interval without any incoming pulses, but audio signals are loud enough not to need such boosting.
    – supercat
    Mar 18, 2021 at 19:13
  • that's interesting; I always thought, from what I was reading, that head construction and issues with the induced currents were the limiting factor. But now it looks like similar systems are used in non magnetic devices (like dvds, etc) and synchronization may be the bigger issue. I think it would be interesting to open a question, maybe on the electronics site, to see how much of the issue is really head related vs. just sync problems with media speed, thermal expansion, etc.
    – Thomas
    Mar 19, 2021 at 17:29
  • 1
    Many tape players do indeed have a bandpass filter which effectively behaves as an integrator with a bleed-off. If one avoids having low-frequency components in the signal, and observes zero crossings, one can get by with a single level sensor to detect positive and negative edges. If low-frequency components might be present, that may build up a bias on the cap which may skew the relative timings of rising and falling edges.
    – supercat
    Apr 19, 2021 at 20:17

Physical magnetic media doesn't deal well with DC (or near DC) signals, which a long string of 0s or 1s would be if they were level sampled (there is a minimum frequency the tape can store). Edge triggering forces the signal to transition at a suitable rate to store on tape because both zeroes and ones include transitions.

  • This explains why they didn't just record unstructured data. However, a UART-like protocol with start/end bits would also switch at switch at least at 120Hz assuming the same baud-rate as the standard loader, is that not viable with magnetic tapes?
    – user4433
    Feb 14, 2017 at 11:26
  • 2
    I'm not entirely sure what the limit is for regular tape, but with floppies the general rule is that you shouldn't have more than 2 or 3 bits without flux reversal.
    – tylisirn
    Feb 14, 2017 at 13:54
  • 1
    @jbcreix - I wouldn't want to rely on it. Even some modern, high quality tape decks have lower quality than optimal reproduction on frequencies around that range (this one, for example), so would imagine that a lot of the cheap old tape decks we used to use back in the 80s had serious issues with this ... particularly the kind that had a small integrated speaker, which would likely vibrate badly if driven too hard at this kind of frequency, so may well have used a high pass filter to avoid that.
    – Jules
    Oct 31, 2017 at 15:46
  • Magnetic media wouldn't mind DC signals if one had a means of measuring distances which was independent of the signal perceived by any particular head. On a nine-track tape, every byte must have a phase transition on at least one track, but any particular track might be written with a single phase for an arbitrarily long time.
    – supercat
    Mar 18, 2021 at 16:46

You must log in to answer this question.