The ZX Spectrum versus modern legislation

Last week, I finished my article on an uncharacteristically cruel cliffhanger. Before I let the results slip, I should qualify them a little. I have already said that we’re giving this ZX Spectrum a head start, firstly by disabling the TV modulator, and then by allowing the test setup to exclude a TV, cassette recorder, and associated cabling, as would normally be required by the rules.

December’s snow handed our test subject a third advantage. Traffic accidents caused by bad weather cost us two hours in the test chamber, and we were able to take only a reduced set of readings. Six complete frequency sweeps were taken, at three angles around the equipment in horizontal and vertical polarisations, with the antenna at a height of 1.5 metres.

This is the first stage of a radiated emissions test to EN55022. The next would require us to focus on the five most problematic-looking frequencies, determine the angle, antenna height, and polarisation for which these have maximum strength, and ensure that the signal is still beneath the pass line. This accounts for the isolated red crosses on last week’s graph. Such a test would take a couple of hours for us to perform completely.

What do we already know about a ZX Spectrum’s RF performance? Anecdotally, there are a couple of causes for concern. The first is that we can actually hear the machine chirping at us when it’s switched on. Here’s a recording of it (hosted off-site), with the computer loudspeaker playing a suitably Kamikaze tune before the computer resets itself. This demonstrates how horrendously loud this chirping is, and also how it modulates during reset.

The chirping is caused by the circuitry that generates the −5V power rail for the RAM chips. It works by switching current through a transformer coil several thousand times per second.  Because we can hear this, the switching frequency is too low to cause much hassle at radio frequencies. However, it implies that corners have been cut. The transformer has been wound fairly crudely and hasn’t been potted to prevent acoustic noise, and the control circuit changes its switching frequency to compensate for the fluctuating load when the RAM starts working. In fact, the whole system is likely to be amplifying and feeding its own mechanical vibrations, generating extra nastiness. No expense spent.

A bigger concern is that, when we look at the screen, we can clearly see the chip’s clock breaking through, manifesting as vertical stripes in the background of the image. This possibly occurs in the ULA chip whose purpose is to glue the screen, memory, cassette sockets, and processor together. It’s producing a fluctuation of a few tens of millivolts on the video signal, and this doesn’t look promising for signal integrity.

Stripy Spectrum

The circuit board has two layers, and ‘plated through’ holes that selectively join them together  – an unusually exacting specification in the early Eighties, but outdated practice today for a board like this. There is no internal copper plane for the power or ground connections as there would be now, so signal current must flow and return along tracks arranged in wide loops. Large loops are bad from a radiation point of view, because they constitute resonant systems.

It doesn’t seem great so far. As any engineer who knows this computer would suspect, it doesn’t measure very well either:

ZX Spectrum EMC

Final readings could easily be 10dB or more above the peaks on this graph, so it’s not just a failure; it’s an abject one. Even that fuzz just above 100MHz might prove problematic when we connect more cables and look more closely.

One of the two most problematic frequencies, 42MHz, we could have predicted. It is the third harmonic of the main crystal. The fundamental frequency of 14MHz finds its way into all sorts of places: it’s divided by four to generate the microprocessor’s master clock (3.5MHz); it paints pixels onto the television (14MHz / 625 PAL lines / 25Hz frame rate = 896 clock cycles per line); generally it also couples into large parts of the circuitry.

The 48.8MHz peak is attributable to a different problem. When the emissions were being measured, we observed that quite a lot of the radiation was vertically polarised. Because PCB tracks and components are horizontal, electromagnetic radiation that originates from the circuit board has hardly any vertical component. Vertically-polarised energy is an indicator that the power supply cable is radiating. The Spectrum’s cable is exactly 1.5m long, which causes it to resonate fairly effectively at about (0.95 × c)/(1.5 × 4) = 48MHz. This 48.8MHz peak is an upper harmonic of the PAL colour clock (4.4336MHz × 11) that just happens to hit the resonant frequency of the power cable. If the cable were a different length, it would just pick out a different harmonic, moving the spike upwards or downwards.

A: Invalid argument

I can’t simply slaughter a piece of computing history on a rotating altar and walk away. Let us perform a proper autopsy. How and why does the Spectrum fail, and what might we do today to improve its RF performance?

It’s a hard question to answer, firstly because I don’t want to test my computer destructively to find out; secondly because we just wouldn’t design a computer in the same way today. In 1982, Sinclair Research worked miracles in compressing the functionality of a home computer into just four main chips plus RAM.

As we have seen, though, the first thing we would have to change is the rather fishy power supply and cable.

ZX Spectrum PSU

As with almost every computer power supply today, its replacement would have to have a ferrite, and both conductors would run through a hollow shield to reduce radiation. Sinclair power supplies are moulded shut and I don’t want to destroy mine, but it is likely that this single step would provide a good deal of radio attenuation: perhaps ten or twenty decibels.

Where the DC jack enters the computer, we would add a common-mode inductor and some extra inductors and capacitors to clean up the power lines. We would need similar components to protect the TV and cassette cables. However, the data lines between chips probably don’t need slewing: presciently, the ULA included the facility for building suitable resistances into the chip itself. Given the high board density, even adding these few inductors and capacitors to fix individual radiation problems would entail a non-trivial redesign and there would be no guarantee of success. There is also the problem of cost: these components would probably add a pound to the material cost of the computer. By the time the customer saw it, though, the manufacturer, distributor and store would have added their margins, resulting in a retail price increase of three or four pounds. It doesn’t sound like much, but it would have made Sinclair’s eyes water: he sold millions of these based on low retail prices and high margins.

E: Out of DATA

As an epilogue, I shall consider what we might do if we were given a cleaner slate. Firstly, what would happen if we were asked to make a Sinclair-compatible clone that could legally be sold? Those RAM chips are now museum pieces and change hands for a few pounds each. The custom ULA, manufactured by Ferranti, is technically impossible to replace because Ferranti went spectacularly bust in the 1990s. Only the Z80 microprocessor and mask ROM remain obtainable in recognisable incarnations, but economies of scale nowadays render that kind of technology abysmal value for money.

speccyinside

The cheapest and safest solution would actually be to emulate the Z80 processor in software running on a more modern chip. Inside this chip, costing maybe £2.00 or less, would be encapsulated all the ROM and RAM that the Spectrum needs to function. The parts of the ULA that drive the screen and cassette would be designed around special input and output functions that are provided by these chips, although the video generation would still require an extra device of its own.

Meanwhile, the big heatsink and 7805 regulator (surrounding the loudspeaker in the bottom-right hand corner in the photograph above) would be replaced by a modern switch-mode regulator that dissipates barely any heat at all, and all that sheet metal would go. We wouldn’t need the -5V supply any more, and we wouldn’t fit a TV modulator: modern TVs cannot demodulate an analogue signal, and VGA or component video would suffice.

Using surface-mount technology, the circuit board would be shrunk to about a fifth of its existing area, so it would resemble a narrow strip along the back that holds the rear sockets, extra components for EMC, headers for the keyboard membrane, and the familiar edge connector which, if we were expecting our device to last for another thirty years, we might consider gold-plating.

The new design would require a four-layer board for electromagnetic reasons, increasing the cost slightly.  If we were making enough of these devices, we’d be able to sell the whole thing for about fifty pounds assembled, with a printed manual – less than half of the actual cost of a Spectrum in 1982 without allowing for inflation, and about the same price as a reasonable second-hand specimen today. We may still make a modest profit.

But I’m considering emulation, and emulation is cheating. Nevertheless, it is the cheapest and quickest way to build a Spectrum today. There are other ways that purists would appreciate more – see, for example, the labour of love that is the Harlequin Project – but these require more complex chips and hence more cost. We may, as an ironic twist, use an ARM chip: these are cheap, powerful, and started life in the offices of Sinclair’s arch rivals at the time, Acorn Computers.

One troublesome question would remain: we’ve built a compatible, but what we could do with all the unused power? With the ROM now held in electronically erasable memory, we could offer operating system upgrades. We could turn the clock speed up and increase the memory practically for free, so why shouldn’t we? We might no longer limit ourselves to emulating a particular 8-bit processor, or to emulating a foreign processor at all. This would allow us to use greedier screen modes, and so provide enhanced graphics. We could change the ROM to allow ourselves to program in a more modern language, attach an SD interface to load and save games quickly and reliably, improve the sound capabilities and the tape modulation scheme, add serial ports and MIDI and USB, even imitate other computers. And so on.

The end of this train of thought always matches the beginning. We’re engineers. We love ideas, and we love experimenting with computers. Were we to reissue the Spectrum today with our vastly improved resources and a commensurately pioneering spirit, we’d create a computer that is nothing like the Spectrum. What we would end up would look more similar to a Raspberry Pi, which was conceived with a similar spirit and restrictions and followed a fairly similar path. If we insisted on affixing a keyboard and screen, it would resemble a small laptop.

More likely, though, if we wanted to be the true successors to Sinclair’s aesthetics and vision, our new device would resemble a smartphone. These shrink-wrapped products represent the leading edge of power, versatility, convenience, and style. Supported by a burgeoning industry of home-grown applications, phones rather than personal computers now excite and engage young people. Some just use them to consume, but others have discovered that phone applications can be written using free software and then distributed for free to the world. This has started to democratise computing again in the same way that Sinclair did thirty years ago.

Sir Clive now states in interviews that he doesn’t own a mobile phone. He might wrinkle his nose at the dominance of the Asian hardware consortia and giant American software companies that so swiftly ate his lunch in the Eighties. He might fear the collective infantilisation and lack of peace of a society in which everybody is glued to a telephone. But he must, surely, approve of the renaissance of home-made software.

Advertisements
9 comments
  1. davidhembrow said:

    Very amusing. Anything about the Spectrum gets my attention because it was my entry-point into software development too. I can’t say I’m surprised that the Spectrum caused such RF emissions. However, I don’t think all machines from that time were the same. For example, I once took apart an Atari 400 and it was a struggle to find the PCB under all the metal cans. Hopefully these achieved something, though I’ve no idea if they also took care of such things as emissions from the power lead. I think the US relaxed their emissions standards some time in the early 80s.

  2. Interesting article, but I would like to point out that for a start the Sinclair power supply is only held together by screws so it would take less than 10 minutes to do the necessary, assuming you didn’t just want to swap it out for a switch-mode supply. It’s also a trivial procedure to bypass the modulator and reroute the composite video signal to the RCA connector instead, which virtually every television, including modern ones can handle.

    Replacing the 5V regulator is a no-brainer and is the first mod most people make to reduce power consumption and eliminate the heat that damages the keyboard membrane over time. Replacing the -5V and +/-12V supplies is a little more involved but doable in a similar fashion and will again help power consumption.

    It’s good of you to mention Chris Smith’s reverse-engineering of the ULA (the Harlequin Project) but perhaps you aren’t aware that there is a drop-in PCB based on this work which replaces the ULA with 74xx-series logic (http://trastero.speccy.org/cosas/JL/Harlequin/superfo1.html). It would also be interesting to see the effect if some internal shielding was added to the case.

    I hope I don’t come across as dismissive and I know you said you didn’t have much time on the test equipment, but it just seems like a missed opportunity so if you even do get the chance again I just wanted to point out a few of the things that could be done with not too much effort (and I would have no problem lending modified boards or a completed Harlequin board just for the hell of it! )

    The other option is to replace the whole innards with a Raspberry Pi and a bit of hardware to map the keyboard as a HID. 🙂

  3. Ben Supper said:

    Hello Kevin. The Superfo project is very interesting — somebody had time on their hands!

    Regarding your other comments, I kind of agree that this article isn’t as thorough as it might have been. Sometimes we have a couple of days in the chamber to test our products and, if we had such an arrangement in these circumstances, I would have tried performing a few modifications and re-testing. It’s not so easy to do this on site as our equipment and supplies are somewhat limited.

    I concede that it should be possible to make a ZX Spectrum pass EMC regulations with modification, and the TV modulator was disabled as you describe when the measurements were taken (otherwise you might expect to see radiation at 600MHz as well!) However, one of the tenets of this article is that EMC practice was not so mature in 1982. Whether this could have been done without increasing the retail price of the product and impacting on sales is, I would argue, a salient matter that many correspondents disregard as academic. That’s their priority; I design mass-market products and it’s important to me.

    We have had so much attention and so much response to this blog posting that it’s probably time for me to write a follow-up addressing individual issues.

  4. Hi Ben, thanks for the response, I was worried it might come across as being argumentative, I would really love to see a follow-up at some stage – I think one of the things I really love about the Spectrum is that it managed to do much with so little. It’s a great example of pushing minimal resources to their maximum capabilities and the more you look at it, the more you realise that things you always thought were weird or silly (like the screen memory layout) have a very logical and rational explanation within their context.

  5. There’s at least two or three FPGA implementations of the Spectrum now (Chris Smith having converted the Harlequin to FPGA, and there’s a couple of others – but the FPGA version of the Harlequin is probably the most accurate, since Chris reverse engineered the ULA by having a couple of them de-encapsulated, drawing the entire circuit to the transistor level). The FPGA clone is preferred because it´s NOT emulation by another CPU, it’s actual real hardware. You can do a Speccy in an FPGA effectively as a SoC (if you have enough block ram, without even requiring external memory). The ULA has also been implemented in HDL so plug-in replacements can be made using a CPLD, an accurate ULA design, complete with all the quirks of a 6000-series Spectrum ULA, fits almost exactly a Xilinx XC95144XL. I recommend you get Chris’s book if you like the Speccy. A handy Amazon link: http://www.amazon.co.uk/The-ZX-Spectrum-ULA-Microcomputer/dp/0956507107/ref=sr_1_1?ie=UTF8&qid=1357991226&sr=8-1

  6. Ben Supper said:

    I have the book already, having bought a copy a couple of years ago. It’s quite an accomplishment. Chris Smith is aware of this article.

  7. do you have nay clue about the fdd3000 and the micro command and the pds all had/have z80 in them
    can they decode the full port addresses? have more ram added? have ula+ added to them in a way that makes them compatible with ones added to the spectrum?

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: