Year Of The Disc Feature

How Discs Work

Volume 2

Number 01

January 1984

Dig that mixed up square disc - find out what makes it tick

By Mike Cook

THE words disc and disc drive are often used when talking about computers, but I wonder how many people really know what makes a disc drive work?

By understanding the physical nature of discs and disc drives you will be more able to cope with the situation when things start to go wrong.

A disc storage system is a fast and convenient way to store programs and data.

The large mainframe computers (and some expensive small computers) use hard discs.

These are made of rigid aluminium and require a very precise drive mechanism as well as very clean air to operate in.

Most micros use flexible or floppy discs. These have a much smaller capacity for storing data and are much slower.

Generally they are more than adequate for the single user, as they are cheaper and require less finicky conditions than the hard discs.

The first point to strike a newcomer when looking at discs is the unmistakable fact that they are SQUARE! A moment's inspection will reveal that, inside the square envelope, there is a round disc made of a thin plastic (milar).

Coated on the plastic is a dark brown (sometimes black) layer of magnetic material. This is usually some form of metal oxide, ferric being the most common.

The coating is just like the one you get on tapes, so you can see a disc is a cross between a long playing record and a tape.

Do you remember the old riddle: "How many grooves are there on a long playing record?"

The answer, of course, is two one on the front and one on the back.

For a floppy disc however, there are no physical grooves. Data is stored as a series of tracks (see Figure I).


Figure I: The structure of a formatted disc

The tracks are concentric rings of data. All tracks hold the same amount of data despite those on the outside being longer than those on the inside.

Some computers do have different amounts of data on different tracks but most are like the BBC Micro and have the same.

This simplifies the disc filing system and, as outer tracks tend to be more frequently used, it also slightly increases reliability.

Normally only one side of a floppy disc is used, but you can get drives that will use both sides.

The disc drive is the "record player", a device to read and write data. The components of one are shown in Figure II.


Figure II: Major mechanical components of a disc drive. The drive motor has been omitted for clarity.

Basically it consists of a drive motor to rotate the disc inside its envelope. It does this by gripping the centre of the disc.

Some discs have a thin plastic re-inforcing hub at the centre to improve the grip and give a longer disc life.

Once the disc is spinning the read/write head is moved across the surface to position itself over the correct track.

The head is usually moved by means of a stepping motor. This is a motor that moves through a small angle, usually 7.5 degrees, every time it receives a pulse.

The rotational movement of the motor is converted into lateral head movement by a helical worm gear.

Thus the head can be moved with precision over the surface of the disc.

However, when the drive is switched on the head can be in any position, so there must be some way of finding precisely where it is.

This is usually done by a small micro switch which is tripped by the head when it is over track zero. The computer will keep issuing pulses to step the head backwards until this switch is tripped. This is known as restoring the head.

In order for the computer to find a precise position on any track, it must be given a signal at a fixed point on every disc rotation. This is provided by the small index hole near the rim of the disc.

Once every revolution this hole allows light through from an LED to a photoelectric sensor. This sends a pulse to the computer to indicate the start of the track.

Another photo sensor detects a notch on the outside of the disc's envelope. This is the write protect notch, and it can be covered up if you do not want to write onto the disc.

This will prevent accidents, as the software always looks at the signal from these sensors before performing any write operation.

There is also a head load actuator, a small lever controlled by an electromagnet. On the end of the lever is a small felt pad which pushes the disc against the read/write head.

This reduces disc wear by ensuring the disc is in contact with the head only when it needs to be.

On some disc units this actuator is very noisy and it may be heard clunking away while the disc is being accessed. This is not however a sign of a bad drive, merely a characteristic of the design.

In addition to the mechanical parts, a disc drive contains the electronics required to turn the motors on and off as well as reading and writing to the disc.

These electronics communicate with the computer over the disc bus. A bus is just a series of signal wires used to connect several devices together.

Most disc drives stick to a standard bus layout on the edge connector at the back of the drive. This means that manufacturers can have their own design of disc drive electronics and still be compatible with other people's products.

The standard disc bus is shown in Table I. As more than one disc drive can be connected to a bus each drive must be assigned a number. This is done by making a link on the electronics board.

STANDARD DISC DRIVE BUS

Pin

Use

2

Not connected

4

Not connected

6

Not connected

8

Index pulse (start of a track)

10

Drive select 1

12

Drive select 2

14

Drive select 3 (not used on BBC)

16

Motor on (spin disc)

18

R/W Head direction select

20

Step (a pulse causes head movement)

22

Data to be written

24

Write gate (enables data to be written)

26

Track zero switch

28

Write protect notch is covered

30

Mixed data and clock read from the disc

32

Surface select (for double sided drives)

34

Not connected

Note all the odd numbers are on the other side of the edge connector and carry the signal ground (or earth).

Table I

Each drive on the bus must have a unique number to prevent more than one drive being active at any one time.

The signals on the bus marked SELECT will therefore activate only one drive. The other signals convey information we have already covered.

At the computer end of the disc bus there is the disc controller chip.

This is a very complex device. It accepts command numbers from the computer's microprocessor and generates the sequence of pulses on the disc bus to enable the disc drive to carry out the required action.

This is because the microprocessor is not fast enough to perform these actions by itself.

For example, the microprocessor can simply issue a command to move the read/write head to track 10. The disc controller chip then looks to see where the head is, and works out how many steps, and in what direction they will be needed to get to track 10.

It then issues that number of head step pulses.

Finally, when the head is in position it reads the track identification number to confirm it is at the correct track. Having completed the task it then reports back to the microprocessor that the move has been made successfully.

If the move was not a success this fact is reported and it is up to the disc filing system software to take appropriate action.

Usually the head is restored (moved to track zero) and another attempt is made. Several such attempts may be made before the disc filing system signals an error.

Just then I mentioned the track identification number. This is information that is put onto the disc during the formatting procedure which every disc has to go through before it can be used. This writes on the disc track and sector information.

We have already seen that a track is a ring of data stored on the disc, but this is too large a chunk of storage to be convenient. This is because disc storage would have to be allocated in tracks, thus wasting a lot of space.

To remedy this, each track is broken down into a number of sectors. A sector is the smallest unit of storage the disc holds, and all data transfer to and from the disc is done with sectors of data.

In the BBC Micro each track contains 10 sectors and each sector can hold 256 bytes (characters) of data.

Each sector has a few bytes of sector identification information before the actual data. This is shown in Figure III.


Figure III: The composition of a sector

The CRC information is a Cyclic Redundancy Check, a simple method of testing the data for errors.

When data is written onto a track the disc controller chip calculates a 16 bit number from this data. This occupies the two CRC bytes and is written after the data.

When reading back the data the CRC is also calculated and compared with the CRC originally written with the data. If these are the same it is assumed there is no error.

However, if they are different then there has definitely been an error. The method used by the disc controller chip to calculate the CRC value is shown on page 399 of the User Guide.

In order for the start of a sector to be uniquely identified, a special code is written on the track - it is known as a mark. You will see in Figure III that there is an identification mark and a data mark.

In order for us to understand exactly what a mark is, we must first see how normal data is stored on the disc.

It is stored in serial form just like the cassette tape system. But instead of the logic zeros and ones being represented by audio tones they are represented by a system of pulses.

Each pulse is represented by a magnetic field placed on the disc by the read/write head. Figure IV shows the form that one byte takes. Note that, unlike the tape system, there are no start and stop bits.


Figure IV: Data encoding

This is known as synchronous data, as opposed to the tape's asynchronous system and it allows more data to be packed into a limited space.

However, before we can make any sense of data in this form the disc controller chip needs to synchronise to it.

This is easily achieved by using clock pulses in every byte of data. The pulses are also needed due to the nature of magnetism - if they were not included the data could not always be correctly recovered.

Each bit starts with a clock pulse and if the bit is a logic one there is a data pulse in the middle of the bit time. There is a limit as to how fast these pulses can be put onto the disc so the capacity of the disc is fixed.

The electronics surrounding the disc controller chip separate the clock pulses and the data pulses from the mixed stream which is read back off the disc.

A mark byte is a byte where some clock pulses are missing.

If you consider the clock component in a normal byte to be &FF (that is all ones, a clock pulse every time) then a mark will have a different number associated with the clock component.

There are a number of standard mark signals and these are shown in Table II. Remember that for normal data the clock component is always &FF. It just differs for the marks.

STANDARD MARKS

Clock pattern

Data pattern

Type of mark

(Hex)

(Hex)

 

D7

FC

Index mark indicates sector start

C7

FE

Sector ID mark

C7

FB

Data mark

C7

F8

Deleted data mark

Table II

The disc controller automatically copes with the marks when finding a specific sector.

There are two types of data marks. The first indicates there is data in the sector and the second indicates the data in the sector has been deleted.

This means to delete data you just have to change the data mark and not the data. The disc controller chip has special commands for reading data and deleted data. So sometimes, if you have the right software tools, it is possible to recover a deleted file.

The index mark is used at the start of each track and is placed just after the index hole has passed the detector.

Before each block of information there are the "sync bytes" that synchronise the decoder inside the disc controller chip. These six bytes are always data bytes with a hex value of 00.

This method of coding the bits in terms of pulses is not particularly efficient. Its main advantage, however, is that it is easy to separate data pulses and clock pulses, and also marks are easy to generate.

There is another way of encoding bits using fewer pulses and, as there are fewer, more bits can be put on any one track.

It is known as double density encoding and must not be confused with double track density, which is merely the result of the tracks being closer together.

The disc controller chip in the BBC Micro will not cope with double density encoding. However plug-in boards are available which allow the BBC Micro to cope with it. The method of double density encoding is shown in Figure V.


Figure V: Double-density data format

It might seem a little difficult at first to see what is going on. Normally the clock pulse is missing and only the data pulse is present.

However, when the bit is a logic zero AND the previous bit was also a logic zero there is a clock pulse at the start of the bit time.

This keeps up the minimum number of pulses needed to keep the magnetic material happy.

You can see that in any one bit there are half the number of pulses, and so we have double the density.

Separation of the data from the clock pulses is complex and requires the use of a circuit known as a phase locked loop. This circuit would require a whole article just to explain, so we are better off skipping that!

If you remember that discs store data in the form of magnetic pulses you can probably predict how to handle them.

Basically, don't touch the magnetic surface of the disc, as the grease from your finger will damage the head.

Don't put the disc near any magnetic fields as this will remove the magnetic pulses. Someone I know had a loudspeaker perched on top of his disc drive with the effect that most of the data was rubbed out when the drive made its first rotation.

Discs should not be subjected to extremes of temperature, and although they are floppy it does not mean they should be flopped.

Particles of smoke, not to mention cigarette ash, are also quite lethal to a disc.

Given reasonable care a disc should last at least five years of normal use, and some manufacturers guarantee their products for a lifetime. (The lifetime of what they do not say the disc, perhaps?)