10

I am now programming on a 8 bits Z80 computer with CP/M 2.2, (as a hobby) and the floppy disk format is IBM, 40 tracks, 8 sectors per track, 512 bytes per sector. free space is 154 Ko on each face of the disk.

Why the sectors are indexed 1 to 8 (and not zero to seven, as usually is seen with computers)?

The catalog of the floppy disk is on the track 1 (sector 1 to 4, 64 entries).

I'm wondering is the catalog on track zero?

Is the zero track reserved to included a system (as track 0 & 1 are reserved to the system on a CP/M floppy disk, and catalog is on track 2)?


I asked this because for example, on APPLE II, sectors start at zero (0 to F).

The computer I use is an AMSTRAD CPC 6128 (1985). It is a 8 bits with Zilog Z-80, with CP/M OS 2.2 and 3.0 available.

The floppy disk format is pretty rare : 3 inches. (not 3 1/2).

3 FORMATS are available : -CP/M : 40 tracks (0 to 39) 9 sectors per track (named &41 to &49) 169 Ko on each face. -DATA : 40 tracks (0 to 39) 9 sectors per track (named &C1 to &C9) 178 Ko on each face. -IBM : 40 tracks (0 to 39) 8 sectors per track (named 1 to 8) 154 Ko free space on each face.

A 3 inch floppy disk is différent of a 3 1/2 floppy disk. To read the side B: I have to eject the diskette and turn it myself then put it again in the disk drive! but it works very well.

The tracks start at 0 to 39. I am just curious to know why sectors start at 1, and why the track 0 is not use for the directory on the IBM format...

For example, CP/M format is very simple : directory on track 2, system CP/M on track 0 and 1.

I am an experienced assembly programmer, and I think it would be logic that sectors start at zero, as tracks do. The AMSTRAD CPC computer can accept a 5 1/4 disk drive too. I bought one yesterday. But tracks,sectors and formats will be the same of course on 5 1/4 disquettes.

Olivier.

p.s: sorry for my english, it is not my native language. ^^

5
  • Sometimes something is the way it is because that's the way it is. (And keep in mind that the floppy format goes back some very early partly electromechanical key-to-disk data entry systems. Which is to say that mechanical engineers had as big a hand in the design as EEs.) Apr 1, 2012 at 22:57
  • 40 tracks are you sure? That would be a single-sided 5.25" diskette. Or do you mean 40 cylinders and double-sided diskettes? BTW CP/M typically supported both 8" and 5.25" floppies, single and double sided diskettes, single and double density recording formats, and an assortment of sector sizes (256, 512 and 1024 were common). IBM's PC-DOS supported both SS and DS 5.25" floppies, and help standardize 512 bytes per sector.
    – sawdust
    Apr 2, 2012 at 0:25
  • 1
    The question in your title is not tied to "IBM floppy disk", but goes back to the "standard" floppy disk controllers from the IBM 3740 and IBM System 34, which became the standards for single and double density recording formats. The numbering schemes were designed by hardware engineers and implemented for command sequences, and not designed by software engineers or programmers.
    – sawdust
    Apr 2, 2012 at 0:38
  • 2
    There is now a Retro Computing Stack Exchange for questions like this.
    – CJ Dennis
    Jul 30, 2017 at 10:05
  • See also: superuser.com/questions/974952/… May 6, 2020 at 10:59

2 Answers 2

6

I think you have a misconception that things regarding computers start at zero.

While this is the case with all C based languages (C, C++, C#, Java, etc) it is NOT true for some languages that are as old, or older than C (like FORTRAN and COBOL).

Since the Z80 was introduced before ANSI C, it was expected to be running much more COBOL and FORTRAN than Lisp (which is also very old, but has zero based indexing).

As such, the one based indexing makes sense.

3
  • 2
    The Zilog Z80 microprocessor and any programming languages it might have supported have nothing to do the floppy controller standards. Floppies were invented before the Z80 showed up.
    – sawdust
    Apr 2, 2012 at 0:09
  • 1
    @sawdust, it has much more to do with standards in general at the time. Since at the time many things were expected to be one indexed, floppys were too.
    – soandos
    Apr 2, 2012 at 0:33
  • 4
    Your "explanation" does not account for the fact that the cylinder number and head number are numbered from zero, not one.
    – sawdust
    Apr 2, 2012 at 0:45
3

The first specification on floppy disks was made by IBM with the appearance of the IBM 3740 and does not mention that there are sectors reserved for the system. The only reservation for the system is track 00, which stores only the "Data Set Labels" that identify the type of information stored in tracks 01 to 76. It clearly defines that the first sector is SECTOR 1. This is not a coincidence but a matter of natural numeration against the numbering of the computer.

We can observe that when a human begins to count anything, it does not begin with zero but one. For example, imagine that there are 135 students in a classroom. Counting the number would be something like that: One, two, three ... one hundred thirty four, one hundred and thirty five.

Its numerical representation would be thus: 1, 2, 3, ... 134, 135 So far we agree, right?

Now let's put the digits that are not represented by being 0. It would look like this: 001, 002, 003, ..., 015, 016, ..., 099, 100, ..., 133, 134, 135

This is what happens with CHS: 0,0,1 - 0,0,2 - 0,0,3...

It is significant that the rows in the Excel sheets or the auto-numeric fields in a database begin by 1 and not by 0 and nobody has said anything about this.

Did David J. Bradley schedule the BIOS that way?

Yes, but he wasn't out side.

Definitely there is no technical reason why SECTOR 0 can not be used unless it is reserved and hidden from users for other reasons. In principle everything points to it is a matter of natural numbering.

GA21-9152-2 File No. 3740-00,15
IBM 3740 Data Entry System

page 12
DISK INITIALIZATION
...Each disk contains two spare tracks to replace any irregular tracks. In addition, the initialization feature provides a means of altering the sequence of sector address on the diskette. Normally, the sequence of sectors is in numeric order (1, 2, 3, ... 25,26)
.

page 24
DATA LABELING ON THE DISKETTE
During initialization, the data set label for a data set is magnetically recorded on the index track (track 00) of the diskette. The primary purpose of this label is to show the location of the data set on the diskette

This was in 1973. It recorded data on an 8" diskette. The IBM PC 5150 was born on August 12, 1981... and we can not forget that they had to maintain some compatibility with the previous devices.

There was definitely no technical reason.

Not the answer you're looking for? Browse other questions tagged .