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. ^^

2 Answers2

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.

soandos
  • 24,600
  • 29
  • 105
  • 136
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.

APO69
  • 141