MASTERING MICRODRIVES
by David Janda
from Sinclair Answers #1 (1984)

The Microdrive system offers fast, efficient data storage & retrieval
- we show you how to get more out of it.


Although not the most outstanding backing store one could hope for,
the Microdrive does represent a leap forward in cheap mass storage.
Providing you already have an Interface 1, you can purchase extra
Microdrives for under 50 - and that's not at all bad.

So what do you get for your money, and what can you do with them? To
answer these questions it's necessary to compare the newcomer with the
traditional method of storing programs - the cassette. The reason why
cassette tape is not the best method of storing programs is because
they were not designed for the purpose in the first place. It is
sometimes argued that high-quality audio tape should be fine for
storing programs, but this not totally true. The fact is that program
tapes must have a more consistent layer of magnetic recording
material, rather than just noise reduction features.

The second problem with cassettes is that they are slow in operation.
The tape travels at three and a half inches per second, and to store
programs on cassette so that they load faster means that the program
has to be packed densely on the tape, as mentioned before, this can
cause problems.

The Microdrive system consists of three parts: the Spectrum, the
Interface 1 and the Microdrive itself. The Microdrive cartridge holds
about five meters of glossy video tape that is 1.5 mm wide. The whole
tape is in one continuous loop, and the mechanism within the
Microdrive cartridge is very similar to that of the now defunct
eight-track cartridges.

Before the Microdrive is used, there are some "don'ts" that should be
observed. First, the glossy tape can be easily smudged and damaged, so
don't touch the surface under any circumstances; also, keep the
cartridge away from any magnetic source: the TV or monitor, and to an
extent the Spectrum as well.

Cassette users will have no doubt come across the problem of tape that
comes loose within the casing. This can - and quite often does -
happen with the Microdrive cartridges, and the best way to protect
against this is to ensure they don't get knocked about.

If you find that the tape is loose and you get a read error trying to
load a program, do a couple of CATs, and this should tighten the tape
up a little. On the other hand, it is possible to have problems with
new cartridges. A microdrive cartridge can hold an average of up to
90K of program and data - 'can', because you sometimes get different
amounts when formatting a cartridge. One of the reasons for this is
because the tape in the new cartridge is stiff; formatting the same
cartridge a couple of times can help to increase the maximum number of
K per cartridge, and the program in Fig.1 should demonstrate this.

You will notice that the screen flickers violently when a format /
save / load is in operation; to avoid this, POKE the system variable
IOBORD (23750) with a number corresponding to the current PAPER
colour.

The main reason for buying a Microdrive is to load and save programs
and data faster than is possible with tape; you will, however,
probably find some problems in transferring programs from cassette to
Microdrive. If the programs you wish to transfer are your own, then
they will most likely be in Basic, and this shouldn't cause too many
problems. The only thing to remember is that programs that have more
than one part will need their LOAD statements amended to incorporate
the Microdrive syntax. Also note that ambiguous filenames "" are not
allowed, and you will have to replace these with real names.

The Spectrum manual warns people from incorporating machine code
within REM statements. This is good advice, because when an Interface
1 is attached to the Spectrum, it 'moves' the program area up in
memory. The matter is further complicated as channels and streams are
used; these move everything up further.

These facts are worth bearing in mind when developing software with
the Microdrive attached to the Spectrum. Using the program in Fig.2 as
a subroutine will print a memory map of the Spectrum, from the start
of the Microdrive maps to the end of the program area; it will also
give information on the amount of memory left, as well as what the
last device and stream was.

One of the major deficiencies with Microdrive file handling is that
there is no random access; worse, you cannot append to an existing
file, it has to be MOVEd to another. Simply producing a new file from
two existing ones by adding them together is not always the best
solution - this is especially so with data files that have to be in
order.

An example would be a couple of files that contained names and
addresses: the problem is to 'blend' these files together to make one
large file that is in order. This is called merging, and it can be
done with just one Microdrive.

To demonstrate this, create two files, DATA1 and DATA2. In each file
put some numbers that are in increasing order - both files can have
different numbers and amounts in them; make sure, however, that the
last number in each file is 99999. Next run the program in Fig.3.

The algorithm for merging the two DATA files can be expanded to
include more files. Also, it is possible to use strings and numeric
variables in a record.

Finally, after using a particular cartridge for some time, it is
noticeable that the access time grows. This is because programs and
data saved are scattered over the file, instead of being saved in one
block. The only way to remedy this situation is to transfer all
programs and data to another cartridge: save programs first, then data
and then arrays, which should speed up access time considerably.


--
Another Fine Product transcribed by:
Jim Grimwood (jimg@globalnet.co.uk), Weardale, England
--
