80-Bus News |
Spring 1985 · Volume 4 · Issue 1 |
| Page 10 of 31 |
|---|
rotate, until some time later, the correct track/
Having got the data, control is passed back to CP/M
which now has to calculate the next track/
So we introduce ‘skew’ in to the format program, we alter the way the sectors are numbered on the disk, on a Gemini system, a ‘straight’ skew of:
| Sector number | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| becomes something like | ||||||||||
| Sector number | 1 | 6 | 2 | 7 | 3 | 8 | 4 | 9 | 5 | 10 |
I say something like this, as I haven’t bothered to
look at the actual Gemini skew, so I might have it
slightly out, but no matter. This is a ‘skew’ of 2, that
is the sectors appear in order in 2’s, read one, skip
one, and so on. See what happens, having read
sector 1, and then requiring sector 2, the longest
wait would be 20mS whilst sector 6 went past.
Plenty of time to calculate the next track/
Lets suppose that some program we have written is required to read the disk and actually does some preprocessing between sector reads, or that the system clock is running at 2MHz rather than 4MHz. Then things slow up again as even with a skew of 2, the 20mS between consecutively numbered sectors is not long enough. In that case, to restore the speed to something like normal, a skew of 3 may be required.
So by now the business of skewing the disk has been taken care off, the only remaining question is if this problem has been known for a long time, why didn’t Digital Research do something to CP/M to correct the situation instead of skewing the disks on formatting? The answer is that they did, right from the start. This is called ‘logical to physical sector translation’. Inside CP/M is the sector translation table. It assumes that the disk is formatted in 1, 2, 3, … order, and therefore the CP/M calculation to get a certain logical sector must be translated into the appropriate physical sector.
Lets take the case of a skew of 2 illustrated above. CP/M calculates it wants logical sector 1, so it goes to the ‘logical – physical sector translation’ table and looks up logical sector 1 which comes back as physical sector 1. For the next sector, it calculates logical sector 2 which is translated into physical sector 3, logical sector 3 becomes physical sector 5, and so on. There are a couple of good reasons for not using the ‘logical to physical sector translation’ one is that you can’t alter it easily. But worse, if the disk were transported to another machine with a different ‘translation’ the sectors would be read in the wrong order, so data would become garbage and programs would crash. The advantages of using physical disk skewing is that you have control of it and even if a disk were transported to a different machine and the skew were wrong, then the disk would read slowly, but it would get there eventually and get it right.
The very early
Henelec/
So, back to the beginning, how come my stupid copy routine took so long to write out its files to disk. Simple, the timing was all to pot. But not by the obvious skewing problem of the routine taking too much time between sectors. It was in fact a whole different can of worms called ‘sector deblocking’, something I’ll hold over until another time, but brief explanation is required.
CP/M was originally designed for use with 8″ systems conforming to IBM3740 spec. The disks had physical 128 byte sectors, so it was sensible to make CP/M work internally with 128 byte sectors.
| Page 10 of 31 |
|---|