SIMON N GOODWIN gives the definitive run-down on Spectrum storage techniques: cassettes, cartridges, wafers and disks
THE Spectrum has a cassette storage system that is remarkably reliable by micro standards, but still slow and inconvenient compared with more expensive systems. This article considers the pros and cons of cassette filing, and compares the alternatives.
Audio cassettes were not designed to store data, so the computer has to turn numbers in memory into sequences of tones so that they can be recorded on tape. Each file starts with a long, continuous tone, intended to make the tape recording circuitry settle down before valuable data is recorded. Normally it doesn’t matter if you start loading in the middle of this tone, but you mustn’t miss it completely.
After the long tone comes 17 bytes of ‘header’ data, holding the file name, type, length and other information needed to make sure that the body of the file ends up in the right place. Then comes a shorter tone, a pulse to distinguish the next block from a header, and as many data bytes as the header indicated.
The Spectrum writes files of three different types: PROGRAMs, CODE and DATA. Programmers can invent other file types, but most use schemes similar to the standard one.
When a program loads, the new code is sorted over the top of any BASIC you’d entered before, unless you typed MERGE, in which case the new file is temporarily stored after the existing code and then interleaved with the previous program after loading has finished. It can take quite a long time for the computer to sort out all the MERGEd lines of a large file.
You can speed up the saving and loading of a program considerably by typing CLEAR to discard arrays and variable values before you SAVE. Sometimes it’s convenient to keep these values with the lines in the file, but often they can be recreated (from DATA, for instance) and in those cases it’s usually a waste of time and tape to save both the values and the code to work them out.
CODE files are copies of the contents of an area of memory. Their header contains the address from which they were saved — which you can overrule later when you reload the file, if you wish — and a length in bytes. A SCREEN$ file is just a special case of a CODE file. SCREEN$ tells the Spectrum to use the area of memory from address 16384 to 23295 — the chunk of memory normally used to hold the dispiay.
DATA files are probably the least-used type of Spectrum file. Most computers store data as a stream of text, recorded and read sequentially on tape or, better still, disk. The Spectrum can’t easily do that, because it can’t turn the tape recorder motor on and off under computer control. Data would get spread all over a tape if it was output piecemeal as a program ran.
So the Spectrum lets you save arrays — tables of text or numbers — as if they were programs. You can reload these later, without upsetting your program, but you can only save one array at a time, and there’s no way to save single undimensioned strings, although the computer won’t stop you trying!
The pilot tones and header take a fair bit of time to pass the tape head, and contain lots of useful information, so software houses often create files without headers. These load more quickly and are more difficult for people to copy without permission: it’s necessary to look through the program that loads prior to the headerless file in order to find the exact machine code instructions that load it, so you can tell how long it is or where it should go.
The principle of storing data as tones is very flexible: the higher the pitch of the tone the more data you can store on tape, since higher pitches means faster pulses: normal recordings contains around 200 bytes a second.
So called ‘hyperload’ or ‘turbo’ cassette routines use non-standard tones to save and load 50% faster than normal, or even faster. This means they load more quickly and are harder to copy — for the manufacturers as well as would-be pirates! There’s a program to generate customised TURBO tape routines on the Crash Tech Tape.
The snag of faster loaders is that cheap cassettes can have trouble reproducing high-pitched tones accurately, and one mistake renders a whole file useless. The faster the data is recorded the less chance that some outside event — like radio or mains interference — will disturb the loading, but the greater the probability that something will be misrecorded or misread.
The Spectrum uses a blip 1/2000 of a second long to record a 0, and takes 1/1,000 of a second to record a 1. That means a 0 value occupies about a hundredth of a millimetre on tape, so even a tiny mechanical imperfection can stop a tape loading.
While a tape loads, the border colour is flashed as each bit is read or written. Narrow lines indicate 0 bits, while wider lines mark 1s. If the lines appear to shake up and down when loading, the tape is running at an uneven speed. In theory the system can cope with fluctuations of speed of up to 15% at any time, but in practice sudden small changes can throw it out of synchronisation.
If a tape is recorded unsteadily there’s not much you can do to rescue it, except reload it from a machine that runs steadily, so you don’t get two random errors added together. You won’t detect an uneven SAVE unless you check the recording afterwards — remember that no account of fiddling around will let you load a file that hasn’t been saved properly.
Empty memory is normally filled with 0s, so that it can be saved and loaded quickly: it you listen to a cassette you will hear the pitch of the recorded noise increase where empty areas are recorded. Small empty areas often crop up in files, because it’s easier and faster to let the computer play through them than it would be to split a file into separate sections, each with their own header.
A total value or ‘checksum’ stored with each block of data usually warns the computer if something has been misread from tape. You can’t rely on this: rare faults can mean that a program appears to load correctly but in fact contains mistakes introduced in the process of transfer to and from tape.
If you have trouble loading a cassette there are three things you can adjust in the hope of solving the problem: the level, the tone and the cassette recorder head alignment.
If the original recording was unusable there’s no way you can tweak a computer to reload correctly. It’s therefore a good idea to save vital files twice, on different tapes, and use the VERIFY command to check that they can be read after you’ve saved them.
VERIFY works like LOAD but it just compares the numbers read from tape with the values in memory. The message ‘verify failed’ indicates a mismatch. You should VERIFY immediately after saving important files but don’t change variable values or edit the program between the SAVE and the VERIFY, or you’re sure to cause a mismatch.
One of the problem with saving arid reloading screens is that the name of the file is normally displayed at the start of a VERIFY action, and that changes the display so that the check is sure to fail.
If you’re using a standard Spectrum without add-ons, you can disable the message in 48K BASIC by typing POKE 23736,181 before you VERIFY. This POKE doesn’t work if you’re using programs that load into the microdrive map area (like HiSoft BASIC) or it you’ve got a disk system connected; the correct address to POKE is two bytes into BASIC’s CHANS area, and some utilities move that area.
Normally the Spectrum is very tolerant of fluctuations in level. The best bet is to set your tape recorder to a point where replay is loud, but not distorted. Always use the output from a speaker or earphone socket — a line level output is usually too weak.
A dull tone helps the Spectrum to pick out the pulses it recorded and ignore the other neeks and farps that leak onto the tape accidentally at a lower level. However, you should not make the tone too dull, or the individual pulses will blur together.
Many people have trouble loading commercial tapes because of a difference in the azimuth of their tape recorder and the recording. The azimuth is the angle of the tape head to the tape — you can usually adjust it by turning a screw holding one side of the tape head. Do this carefully, though, or you could damage the recorder.
The azimuth angle makes a big difference to the accuracy of a recording: it’s most important that it should be the same when a tape is recorded and replayed, or some information may be lost. Set the azimuth by playing a professionally made music cassette and turning the screw until the tone is as bright and tinny as you can get it. You should find that one particular position sounds best, with a duller tone if you turn the screw away in either direction. It’s best to use a plastic prod to turn the screw, as a metal screwdriver can temporarily disturb the magnetic properties of the head. Use a blob of nail varnish — NOT superglue! — to stick the screw in place once you’ve set it correctly.
If you find that your own tapes load fine, but you often have trouble with commercial tapes, the azimuth setting of your machine may be wrong, but beware: any correction may stop the tapes you’ve already made from loading properly!
You may be best off using two tape recorders: keeping the old one to load your own tapes, and getting a new one to load prerecorded material. Record new tapes on the new machine — a machine that’s correctly set up will always be more reliable, even though it may not load wonky recordings.
The Spectrum +2 is often supplied with the tape head incorrectly set up. You can adjust the alignment by pressing PLAY and turning the screw that can be seen through a little hole between the tape controls and the cassette door. If the machine is new, don’t fiddle yourself — get it adjusted under guarantee.
You CAN connect an external tape recorder to the +2, even though it has no appropriate sockets. You have to open up the machine to add the extra wire, so again you should leave it alone unless you don’t care about the guarantee. Disconnect everything, then undo the screws in the base of the computer. Five wires connect the cassette drive to the circuit board: the red and black ones convey power to the drive, and you can sometimes reduce background interference in the TV sound by putting a switch in the red wire; turn the switch off (unless you’re using the internal drive) and you may find that the sound is clearer.
The blue wire carries the EAR signal, and should go to the tip of a plug connected to the EAR socket on an external tape recorder. Be sure to unplug this when trying to use the built-in drive. The white wire goes to the tip of the external MIC plug. The brown wire is the signal earth, which should be connected to the shaft of both jack plugs.
The +3 breaks with convention by using a stereo connector for both loading and saving, rather than two separate sockets. A stereo plug — such as a mini headphone plug — has an extra ring of metal, insulated from the tip and the shaft; the shaft Is the earth, as usual. The ring carries signals into the computer (from EAR) and the tip carries them out (to MIC).
DON’T try to make a mono plug work in this socket by jiggling it around — you’re almost certain to run into reliability problems. Get a proper lead made up, and curse Amstrad for not supplying one! The first 10,000 +3s appear to have a fault that makes them relatively unreliable when loading cassettes: the automatic level control circuit seems way out of alignment on many machines. I’m trying to find out what Amstrad are going to do about this, but so tar I’ve drawn a blank. Has anyone any further information?
There are two main alternatives to cassette recordings of data. Either you can opt for a continuous loop of tape, or a disk of magnetic material.
The tape loop approach is cheap but now unpopular — the drive is simple, as it only needs to move the tape at a steady speed in one direction, but access to data is slow because the entire loop must pass the head before you can be sure of loading any particular part. Tape loops tend to be expensive, and the larger their capacity the slower they work.
Two types of tape loop drive have been popular on the Spectrum: Sinclair’s own microdrives, which can store 85K of data on a tiny cartridge, and Rotronics Wafadrives, which record more slowly on larger tape cartridges, available in 16K, 32K and 64K lengths. Both are out of production, but still available.
Microdrives are very impressive when they work: they give a theoretical maximum access time of seven seconds, and can load 48K in four or five seconds on a good day. There are quite a few utility programs around that let you use microdrive files, but the drives are often extremely unreliable.
Microdrive tapes sell for between £1.50 and £2.00. There’s no shortage of them, as ICL and British Telecom use them as well as Spectrum and QL owners. Microdrive royalties are one of the main sources of revenue for what’s left of Sinclair Research — the firm that was left with little more than debts when Sir Clive sold his computer designs to Amstrad.
When buying tapes check that they have the words ‘Regd Design App’ printed on the part that plugs into the drive. Some tapes produced in the early days did not have this message, and tended to have loose plastic floating around inside the cartridge, which led to reliability problems.
Middle period tapes had a very thin copper spring at the front, pressing the tape against the head. These could work loose and cause more trouble. Modern production has a much fatter and more sturdy spring. Shop carefully, as all three sorts are still available.
The Microdrive needs an interface called Interface 1, which can cope with up to eight drives but only runs one at a time. Interface 1 also provides a simple network link, allowing several computers to share information, and includes a rather peculiar serial printer port.
The Rotronics Wafadrive is an all-in-one unit, containing two tape drives, plus serial and parallel printer ports. Wafadrive mechanisms are well engineered and have been dirt cheap since the manufacturers went bust, but the tapes, or ‘wafas’, are slow, hard to obtain and costly. The sole blank wafa manufacturer, based in the USA, has announced that prices will double this year — and 64K wafas already cost an extortionate £4 a throw.
A few good programs have been converted to work with the Wafadrive, but in general it is incompatible with most software: the drive grabs certain areas of memory and won’t let programs use them. I wrote a full discussion of the quirks of the Wafadrive in the Christmas Special. In brief, avoid it if you want to use a wide range of commercial software!
Disks work much like tapes, but record information in a series of concentric rings. The disk turns at a steady 300 RPM and a magnetic head can step in and out to read or write data in any ring, or ‘track’, so you can find any part within a second or so. Before you can use a new disk it must be ‘formatted’. This requires marking up into sections so that files can be kept apart.
Amstrad’s +3 uses cheap Hitachi drives that can only read and write 40 tracks on one side of the disk; you can take the disk out and turn it over to use the other side. The drives use unfashionable 3-inch diameter disks in hard plastic shells, which cost between £1.50 and £2.00 and hold 178K of information on each side.
The +3 disk system is slow compared with other disk drives, but fast compared with cassette. It can load or save a 48K file in about half a minute, whereas up-to-date disk systems run at about three times that speed. Disks can be formatted quickly, though, taking around 25 seconds to do so.
The +3 adds a parallel printer interface as well as a disk drive to the Spectrum hardware, but it has many internal differences from earlier Spectrums. Quite a few popular programs are incompatible with the new machine, or don’t play music because routines from earlier Spectrum 128s are missing. A list of +3 faults appeared in Issue 48.
It’s hard to write data-filing programs in BASIC on the +3 because there are no conventional filing commands built-in: you must pay extra for a package like BetaBASIC, Mallard BASIC or HISOFT BASIC.
The biggest snag of the +3 is that it’s extremely difficult to transfer cassette files to the disk. Most commercial programs use nonstandard cassette files, and the +3 just won’t let you copy them to disk at all. The only reliable way around this problem is to spend an extra £40 on a plug-in box called a Multiface 3, reviewed in this special.
Potentially, the good thing about the +3 is that commercial software for it may become available on disk. Unfortunately the software houses aren’t keen to do this: disks are expensive and hard to duplicate in bulk, compared with cassettes.
Other disk systems use very cheap 5.25-inch diameter disks, in thin floppy plastic wallets, or the new, tougher, but more expensive 3.5-inch disks designed by Sony.
Single-sided 40 track drives are still around for these disk sizes, but the most common format is 80 tracks, with two heads on the drive so that data can be read or written from both sides. This gives a capacity of 600-800K, depending upon the organisation of the data on the disk.
There have been lots of different types of Spectrum add-on disk system, but only three are still in production: the Disciple, Plus D and Swift Disc. All of them are about three times faster than the +3, although they do slow down slightly when there are lots of files on a disk.
All of them allow file-handling from ZX BASIC, and all of them let you transfer commercial programs to disk without any hassle. Disk formatting is slightly slower, even allowing for the difference in capacity, but you don’t have to do it so often since the disks can store more.
The Plus D, from Miles Gordon Technology, is the cheapest upgrade and works very well. An interface that lets you plug in a standard disk drive and a parallel printer sells for £50; the interface and a 780K 3.5-inch drive cost £130. The Plus D was reviewed in detail last month.
The Swift Disc system, from Sixword, costs £75 for a disk interface with Kempston ioystick and serial printer ports. £150 gets you a 640K drive as well. Both the Swift Disc and the Plus D come with similar 80 track double-sided drives, but the different organisation of data on the disk accounts for the variation in capacity.
The Swift Disc was reviewed in Crash issue 44. It has a ‘through port’ (unlike the Plus D). so you can plug in other add-ons while you’re using the Swift. The only way to do this with the Plus D is by a ‘splitter’ which divides the signals from the computer in two before they reach the interfaces.
The Swift Disc printer interface works, but it’s not as clever or flexible as the ones in the Plus D or the Disciple. Conversely, the Swift system has friendlier disk handling software, which lets you do just about anything, anytime.
Sixword have opted for total microdrive compatibility, so that anything designed to work with the microdrive will work with their disk system without alteration. They do, however, charge £12 extra for a ‘microdrive emulator’ that provides this perfect compatibility. The Swift Disc is also the only add-on disk system that works with microdrives plugged in at the same time.
The Disciple was designed by Miles Gordon but sold by Rockfort Products. It is the Plus D’s big brother and the interface alone sells for around £90. Besides most of the Plus D features it has a through port, two joystick ports and connections for a network that allows several computers to share disks and printers. There have been a number of problems with the built-in software in the Disciple, so you should get the latest version you can: versions 3B or 3C have been recommended to me. The Disciple was reviewed by Franco Frey in Crash issue 38.
‘Serious’ users often buy disk systems, so it’s important that filehandling utility programs are compatible, as well as games that just load and ignore the disk thereafter. Some good utilities are specially produced or adapted for the Disciple and Plus D, and many but not all microdrive programs will work with the MGT interfaces.
Next month Simon N Goodwin examines the pros and cons of the forthcoming CP/M and BASIC languages for the +3.