Scor­pio News

  

January–March 1987 – Volume 1. Issue 1.











Page 25 of 63











Disk Formats and CP/M Disk Routines

by M.W.T. Waters

[Ed. – this article runs to some twenty plus pages in total. I have therefore split it up, and this is the first part, concentrating on the format that data is actually written onto disks in.]

Have you ever wondered about how CP/M stores away its data, how the directory records relate to the filed on disk, what determines the minimum and maximum file sizes or what determines disk size and the number of directory entries available?

There are several good books available about CP/M but none of them appear to cater for the dabbler in operating system software or for the type of ‘hacker’ best described as an 80-BUS user. The Digital Research handbooks contain all of the data required for a manufacturer to implement CP/M on a microcomputer but rarely explain WHY a particular disk paramer, say, is given s specific value or HOW it fits into the great scheme of things.

I should mention here that I was introduced to computers when hackers were (mainly) electronics enthusiasts who built computer systems from scratch and caught themselves programming by sheer hard work combined with more than a little trial and error. These days, hacking seems to apply to juveniles (generally) who illegally enter other peoples computer systems and create a bed name for home computer users.

Most of the information contained in this article is available to the average 80-BUS user who is armed with a disassembler, the CP/M manuals and lots of time and patience (or as someone else put it, “Stupidity and sheer bloody mindedness’).

Disks and disk formats

Before proceeding with an in-depth breakdown of CP/M, I shall describe, briefy, floppy disks and floppy disk formats and then go on to examine the data physically written to the disk surface during formatting. The examples given will be oriented towards the current Gemini 5.25″ disk formats but will be equally applicable to any IBM 3740 or IBM 34 type disk format (eg: Nascom)

A floppy disk consists of a disc of thin mylar (a flexible plastic) that has been coated on both sides with ferrous oxide; the same materiel that is used to coat magnetic recording tape. The disk surface itself is contained in and protected by a covering of some sort with cut-outs to allow access for the read/​write head(s) of the disk drive. Disks are available in four sizes: 8″, 5,25″, 3.5″ and 3″ with 5.25″ being the most commonly used by microcomputer manufacturers. In the case of 8 and 5.25″ disks, the covering (known a the envelope) is made of cardboard while the other two sizes are protected by a rigid plastic case.

In use, the disk is rotated, usually, at a uniform speed (the Sirius microcomputer being an exception) and data is written to or read from the disk by one or two read/​write heads similar to those used in tape recorders. Floppy disks may be either single or double sided. Disk drives that are designed for single sided operation only have one head while those designed for double sided operation have one head for each side of the disk. However, with early 3’ disk drives, to access the second side, it is necessary to remove it from the drive and physically turn it over. For most disk operating systems (D0S’s) this latter type of disk appears to be two separate disks joined back to back.

From this point on, I shall only refer to 5.25″ disks but the principles involved are very similar co the other types. The disk surface is divided up into a number of tracks at the time of formatting; the number of tracks depending upon the disk size and the physical characteristics of the disk drive. The read/​write head is permitted to access each track by stepping the head in or out under software control. The disk is given a reference point in terms of












Page 25 of 63