Why does sector-number addressing in CHS start at sector 1 and not 0?
Before LBA was introduced, why does CHS start at 0,0,1
and not 0,0,0
?
hard-drive partitioning filesystems disk-space storage
add a comment |
Before LBA was introduced, why does CHS start at 0,0,1
and not 0,0,0
?
hard-drive partitioning filesystems disk-space storage
1
"Why does the sector count start at 1..." -- Actually you're referring to the sector number, not the sector count. Those are two distinct and different parameters used in a disk request. "Sector index" is also poor nomemclature for the sector number, as there is a distinct entity called the index in disk drives.
– sawdust
Sep 30 '15 at 1:39
add a comment |
Before LBA was introduced, why does CHS start at 0,0,1
and not 0,0,0
?
hard-drive partitioning filesystems disk-space storage
Before LBA was introduced, why does CHS start at 0,0,1
and not 0,0,0
?
hard-drive partitioning filesystems disk-space storage
hard-drive partitioning filesystems disk-space storage
edited Sep 30 '15 at 7:36
harrymc
257k14268568
257k14268568
asked Sep 18 '15 at 18:50
Jordan DavisJordan Davis
281312
281312
1
"Why does the sector count start at 1..." -- Actually you're referring to the sector number, not the sector count. Those are two distinct and different parameters used in a disk request. "Sector index" is also poor nomemclature for the sector number, as there is a distinct entity called the index in disk drives.
– sawdust
Sep 30 '15 at 1:39
add a comment |
1
"Why does the sector count start at 1..." -- Actually you're referring to the sector number, not the sector count. Those are two distinct and different parameters used in a disk request. "Sector index" is also poor nomemclature for the sector number, as there is a distinct entity called the index in disk drives.
– sawdust
Sep 30 '15 at 1:39
1
1
"Why does the sector count start at 1..." -- Actually you're referring to the sector number, not the sector count. Those are two distinct and different parameters used in a disk request. "Sector index" is also poor nomemclature for the sector number, as there is a distinct entity called the index in disk drives.
– sawdust
Sep 30 '15 at 1:39
"Why does the sector count start at 1..." -- Actually you're referring to the sector number, not the sector count. Those are two distinct and different parameters used in a disk request. "Sector index" is also poor nomemclature for the sector number, as there is a distinct entity called the index in disk drives.
– sawdust
Sep 30 '15 at 1:39
add a comment |
3 Answers
3
active
oldest
votes
Unfortunately, this is just how the CHS addressing scheme, popular at the time, was implemented and adopted into use. This was adopted as the official convention for IBM-compatible computers in the BIOS interrupts used for disk access, explaining why this convention is used to this day. From the ECMA-107 Standard,
Volume and File Structure of Disk Cartridges for Information Interchange (this is also mentioned in the original ATA-1 specification):
6.1.3 Logical Sector Number
Each sector on a volume shall be identified by a Logical Sector Number. [...] The Logical Sector Numbers shall be
assigned in an ascending sequence, beginning with 0, starting at sector 1, track 00, side 0, continuing onto track
00, side 1 (if FDC is recordable on both sides) and then to track 01, side 0, etc.
This issue is addressed in the specifications for some hard disks, where it is noted that a given logical CHS address differs from the physical CHS address location. This is further discussed in the Seagate ATA Interface Reference Manual, which contains this interesting narrative:
5.1 Logical block addressing
[...] the sectors on the drive are assumed to be linearly mapped, with an LBA 0 of cylinder 0 / head 0 / sector 1.
[...] For all translation modes, C=0, H=0, S=1 is equivalent to LBA=0. It is not possible to compute an equivalent CHS for all logical block addresses in all translation modes because this formula only works in one direction. This is because CHS addressing can’t access 1/256th of all of the possible sectors that logical block addressing can access, since there is no sector 0 in CHS.
Thus for logical CHS addressing, although the first cylinder/head indices start from a 0-based offset, and the first sector index starts from 1 (e.g. the minimum possible CHS address is 0/0/1), this does not change anything about the physical location of this sector. Think of it as the first physical sector on the disk being called "sector 1", occupying CHS 0/0/1. Indeed, the "first" element in most programming languages is 0-based, so the logical address of the sector at CHS address 0/0/1 is zero (0x00
).
This makes a lot more sense logically (namely, the "zeroth" logical address being the first physical sector), as we can address the disk device as any other memory device (as each sector has a unique linear address to map it to a physical sector), thus why it makes sense for LBA to start from zero. Indeed, if we translate the CHS address 0/0/1 to an LBA, the resulting LBA will be 0x00000000
(this is why 1 is subtracted from the sector index in most CHS to LBA calculations, and why 1 is added to the index for LBA to CHS calculations).
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used thezero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area
– Jordan Davis
Sep 23 '15 at 1:30
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value1
, I've still not found any information as to why (although I suspect it may have something to do with sector0
being reserved as an error flag). I will be sure to update you if I come across anything.
– Breakthrough
Sep 23 '15 at 5:47
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
|
show 7 more comments
I have tried to trace the history of CHS and the "starting with 1" sector
numbering fiasco, which has caused many complications for disk-drivers
writers and gave rapid rise to LBA.
CHS dates back to the days when personal computers ran on diskettes and
when the BIOS was invented. This is what Wikipedia says :
The term BIOS (Basic Input/Output System) was invented by Gary
Kildall and first appeared in the CP/M operating system in
1975, describing the machine-specific part of CP/M loaded
during boot time that interfaces directly with the hardware.
A research into the CP/M BIOS has found the document
CP/M information archive : BDOS system calls,
in which sector numbers start with zero.
The conclusion is that : earliest CHS schema actually used zero-based
sector addresses.
One-based sector addresses were first introduced with the first
IBP/PC. The document
INT 13 - Diskette BIOS Services specifically says :
Most disk BIOS calls use the following parameter scheme:
AH = function request number
AL = number of sectors (1-128 dec.)
CH = cylinder number (0-1023 dec.)
CL = sector number (1-17 dec.) <--------!!!
DH = head number (0-15 dec.)
DL = drive number (0=A:, 1=2nd floppy, 80h=drive 0, 81h=drive 1)
DL = drive number (0=A:, 1=2nd floppy, 80h=C:, 81h=D:)
Note that some programming references use (0-3) as the
drive number which represents diskettes only.
ES:BX = address of user buffer
So it was the IBM/PC that by a de-facto implementation of the BIOS has converted
sector-numbering from zero-based to one-based.
Of the twelve IBM engineers assigned to create the IBM Personal Computer (model 5150), David J. Bradley developed the code for its BIOS. So he's the one who, among all its other details, decided on the parameters for the disk
interrupts. We also owe to this guy together with Mel Hallerman the famous
CTRL+ALT+DEL.
So the answer to the question
Why does the sector count start at 1 and not 0 in CHS is :
Because David J. Bradley programmed the BIOS that way.
As to why he did it this way, this is best answered by himself.
If I had to guess, I would say that he left sector zero as an addressing
sector by which the driver could verify that the head was on the right
track.
As disks were actually engineered so as not to require such a
mechanism, and the engineers were not ready to waste one sector because of the BIOS, sector zero never came into existence. Thereafter, driver-writers were
left with the need to subtract-one and add-one to sector addresses for all
BIOS disk calls.
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
|
show 1 more comment
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.
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Take a look at This
– yass
Apr 11 '17 at 20:39
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f974952%2fwhy-does-sector-number-addressing-in-chs-start-at-sector-1-and-not-0%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Unfortunately, this is just how the CHS addressing scheme, popular at the time, was implemented and adopted into use. This was adopted as the official convention for IBM-compatible computers in the BIOS interrupts used for disk access, explaining why this convention is used to this day. From the ECMA-107 Standard,
Volume and File Structure of Disk Cartridges for Information Interchange (this is also mentioned in the original ATA-1 specification):
6.1.3 Logical Sector Number
Each sector on a volume shall be identified by a Logical Sector Number. [...] The Logical Sector Numbers shall be
assigned in an ascending sequence, beginning with 0, starting at sector 1, track 00, side 0, continuing onto track
00, side 1 (if FDC is recordable on both sides) and then to track 01, side 0, etc.
This issue is addressed in the specifications for some hard disks, where it is noted that a given logical CHS address differs from the physical CHS address location. This is further discussed in the Seagate ATA Interface Reference Manual, which contains this interesting narrative:
5.1 Logical block addressing
[...] the sectors on the drive are assumed to be linearly mapped, with an LBA 0 of cylinder 0 / head 0 / sector 1.
[...] For all translation modes, C=0, H=0, S=1 is equivalent to LBA=0. It is not possible to compute an equivalent CHS for all logical block addresses in all translation modes because this formula only works in one direction. This is because CHS addressing can’t access 1/256th of all of the possible sectors that logical block addressing can access, since there is no sector 0 in CHS.
Thus for logical CHS addressing, although the first cylinder/head indices start from a 0-based offset, and the first sector index starts from 1 (e.g. the minimum possible CHS address is 0/0/1), this does not change anything about the physical location of this sector. Think of it as the first physical sector on the disk being called "sector 1", occupying CHS 0/0/1. Indeed, the "first" element in most programming languages is 0-based, so the logical address of the sector at CHS address 0/0/1 is zero (0x00
).
This makes a lot more sense logically (namely, the "zeroth" logical address being the first physical sector), as we can address the disk device as any other memory device (as each sector has a unique linear address to map it to a physical sector), thus why it makes sense for LBA to start from zero. Indeed, if we translate the CHS address 0/0/1 to an LBA, the resulting LBA will be 0x00000000
(this is why 1 is subtracted from the sector index in most CHS to LBA calculations, and why 1 is added to the index for LBA to CHS calculations).
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used thezero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area
– Jordan Davis
Sep 23 '15 at 1:30
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value1
, I've still not found any information as to why (although I suspect it may have something to do with sector0
being reserved as an error flag). I will be sure to update you if I come across anything.
– Breakthrough
Sep 23 '15 at 5:47
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
|
show 7 more comments
Unfortunately, this is just how the CHS addressing scheme, popular at the time, was implemented and adopted into use. This was adopted as the official convention for IBM-compatible computers in the BIOS interrupts used for disk access, explaining why this convention is used to this day. From the ECMA-107 Standard,
Volume and File Structure of Disk Cartridges for Information Interchange (this is also mentioned in the original ATA-1 specification):
6.1.3 Logical Sector Number
Each sector on a volume shall be identified by a Logical Sector Number. [...] The Logical Sector Numbers shall be
assigned in an ascending sequence, beginning with 0, starting at sector 1, track 00, side 0, continuing onto track
00, side 1 (if FDC is recordable on both sides) and then to track 01, side 0, etc.
This issue is addressed in the specifications for some hard disks, where it is noted that a given logical CHS address differs from the physical CHS address location. This is further discussed in the Seagate ATA Interface Reference Manual, which contains this interesting narrative:
5.1 Logical block addressing
[...] the sectors on the drive are assumed to be linearly mapped, with an LBA 0 of cylinder 0 / head 0 / sector 1.
[...] For all translation modes, C=0, H=0, S=1 is equivalent to LBA=0. It is not possible to compute an equivalent CHS for all logical block addresses in all translation modes because this formula only works in one direction. This is because CHS addressing can’t access 1/256th of all of the possible sectors that logical block addressing can access, since there is no sector 0 in CHS.
Thus for logical CHS addressing, although the first cylinder/head indices start from a 0-based offset, and the first sector index starts from 1 (e.g. the minimum possible CHS address is 0/0/1), this does not change anything about the physical location of this sector. Think of it as the first physical sector on the disk being called "sector 1", occupying CHS 0/0/1. Indeed, the "first" element in most programming languages is 0-based, so the logical address of the sector at CHS address 0/0/1 is zero (0x00
).
This makes a lot more sense logically (namely, the "zeroth" logical address being the first physical sector), as we can address the disk device as any other memory device (as each sector has a unique linear address to map it to a physical sector), thus why it makes sense for LBA to start from zero. Indeed, if we translate the CHS address 0/0/1 to an LBA, the resulting LBA will be 0x00000000
(this is why 1 is subtracted from the sector index in most CHS to LBA calculations, and why 1 is added to the index for LBA to CHS calculations).
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used thezero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area
– Jordan Davis
Sep 23 '15 at 1:30
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value1
, I've still not found any information as to why (although I suspect it may have something to do with sector0
being reserved as an error flag). I will be sure to update you if I come across anything.
– Breakthrough
Sep 23 '15 at 5:47
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
|
show 7 more comments
Unfortunately, this is just how the CHS addressing scheme, popular at the time, was implemented and adopted into use. This was adopted as the official convention for IBM-compatible computers in the BIOS interrupts used for disk access, explaining why this convention is used to this day. From the ECMA-107 Standard,
Volume and File Structure of Disk Cartridges for Information Interchange (this is also mentioned in the original ATA-1 specification):
6.1.3 Logical Sector Number
Each sector on a volume shall be identified by a Logical Sector Number. [...] The Logical Sector Numbers shall be
assigned in an ascending sequence, beginning with 0, starting at sector 1, track 00, side 0, continuing onto track
00, side 1 (if FDC is recordable on both sides) and then to track 01, side 0, etc.
This issue is addressed in the specifications for some hard disks, where it is noted that a given logical CHS address differs from the physical CHS address location. This is further discussed in the Seagate ATA Interface Reference Manual, which contains this interesting narrative:
5.1 Logical block addressing
[...] the sectors on the drive are assumed to be linearly mapped, with an LBA 0 of cylinder 0 / head 0 / sector 1.
[...] For all translation modes, C=0, H=0, S=1 is equivalent to LBA=0. It is not possible to compute an equivalent CHS for all logical block addresses in all translation modes because this formula only works in one direction. This is because CHS addressing can’t access 1/256th of all of the possible sectors that logical block addressing can access, since there is no sector 0 in CHS.
Thus for logical CHS addressing, although the first cylinder/head indices start from a 0-based offset, and the first sector index starts from 1 (e.g. the minimum possible CHS address is 0/0/1), this does not change anything about the physical location of this sector. Think of it as the first physical sector on the disk being called "sector 1", occupying CHS 0/0/1. Indeed, the "first" element in most programming languages is 0-based, so the logical address of the sector at CHS address 0/0/1 is zero (0x00
).
This makes a lot more sense logically (namely, the "zeroth" logical address being the first physical sector), as we can address the disk device as any other memory device (as each sector has a unique linear address to map it to a physical sector), thus why it makes sense for LBA to start from zero. Indeed, if we translate the CHS address 0/0/1 to an LBA, the resulting LBA will be 0x00000000
(this is why 1 is subtracted from the sector index in most CHS to LBA calculations, and why 1 is added to the index for LBA to CHS calculations).
Unfortunately, this is just how the CHS addressing scheme, popular at the time, was implemented and adopted into use. This was adopted as the official convention for IBM-compatible computers in the BIOS interrupts used for disk access, explaining why this convention is used to this day. From the ECMA-107 Standard,
Volume and File Structure of Disk Cartridges for Information Interchange (this is also mentioned in the original ATA-1 specification):
6.1.3 Logical Sector Number
Each sector on a volume shall be identified by a Logical Sector Number. [...] The Logical Sector Numbers shall be
assigned in an ascending sequence, beginning with 0, starting at sector 1, track 00, side 0, continuing onto track
00, side 1 (if FDC is recordable on both sides) and then to track 01, side 0, etc.
This issue is addressed in the specifications for some hard disks, where it is noted that a given logical CHS address differs from the physical CHS address location. This is further discussed in the Seagate ATA Interface Reference Manual, which contains this interesting narrative:
5.1 Logical block addressing
[...] the sectors on the drive are assumed to be linearly mapped, with an LBA 0 of cylinder 0 / head 0 / sector 1.
[...] For all translation modes, C=0, H=0, S=1 is equivalent to LBA=0. It is not possible to compute an equivalent CHS for all logical block addresses in all translation modes because this formula only works in one direction. This is because CHS addressing can’t access 1/256th of all of the possible sectors that logical block addressing can access, since there is no sector 0 in CHS.
Thus for logical CHS addressing, although the first cylinder/head indices start from a 0-based offset, and the first sector index starts from 1 (e.g. the minimum possible CHS address is 0/0/1), this does not change anything about the physical location of this sector. Think of it as the first physical sector on the disk being called "sector 1", occupying CHS 0/0/1. Indeed, the "first" element in most programming languages is 0-based, so the logical address of the sector at CHS address 0/0/1 is zero (0x00
).
This makes a lot more sense logically (namely, the "zeroth" logical address being the first physical sector), as we can address the disk device as any other memory device (as each sector has a unique linear address to map it to a physical sector), thus why it makes sense for LBA to start from zero. Indeed, if we translate the CHS address 0/0/1 to an LBA, the resulting LBA will be 0x00000000
(this is why 1 is subtracted from the sector index in most CHS to LBA calculations, and why 1 is added to the index for LBA to CHS calculations).
edited Sep 23 '15 at 7:13
answered Sep 22 '15 at 21:50
BreakthroughBreakthrough
31.4k992138
31.4k992138
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used thezero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area
– Jordan Davis
Sep 23 '15 at 1:30
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value1
, I've still not found any information as to why (although I suspect it may have something to do with sector0
being reserved as an error flag). I will be sure to update you if I come across anything.
– Breakthrough
Sep 23 '15 at 5:47
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
|
show 7 more comments
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used thezero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area
– Jordan Davis
Sep 23 '15 at 1:30
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value1
, I've still not found any information as to why (although I suspect it may have something to do with sector0
being reserved as an error flag). I will be sure to update you if I come across anything.
– Breakthrough
Sep 23 '15 at 5:47
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
I figure the answer to this question already, but I guess the person I left the my comments displaying the answer deleted it... anyways the reason why I asked this question was due to the fact everyone and everything I read posted your basically your exact words for the most part. This answer of "it's just the way they made it..." really annoyed me because people don't just build something and not use it just because they don't want to use it... that logic doesn't make since at all...
– Jordan Davis
Sep 23 '15 at 1:27
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used the
zero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area– Jordan Davis
Sep 23 '15 at 1:30
Going through the history of CHR/CHS/LBA you find that before CHR which was variable length using MBBCCHHR used the
zero sector
for error codes, and bad blocks, etc.... transition to CHS and "fixed-block-architecture" you also had the transition of adding a controller (firmware) to the drive and the start of "logical" disk associations... the controller now is invisible but you can assume is uses it the same way... the term is now called "Host Protected Area" en.wikipedia.org/wiki/Fixed-block_architecture and en.wikipedia.org/wiki/Host_protected_area– Jordan Davis
Sep 23 '15 at 1:30
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value
1
, I've still not found any information as to why (although I suspect it may have something to do with sector 0
being reserved as an error flag). I will be sure to update you if I come across anything.– Breakthrough
Sep 23 '15 at 5:47
@JordanDavis in most cases, the host-protected area is at the end of the disk, not beginning. Indeed while the nomenclature for the first sector is returned as the value
1
, I've still not found any information as to why (although I suspect it may have something to do with sector 0
being reserved as an error flag). I will be sure to update you if I come across anything.– Breakthrough
Sep 23 '15 at 5:47
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
The Wikipedia link for FBA section overview, list being the zeroth record as ECC but that sounds good, I'll do the same if either comes across.
– Jordan Davis
Sep 23 '15 at 13:20
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
@JordanDavis I've added a bounty on this question, as I'd really like to hear some input from others - especially in regards to the why aspect.. Feel free to keep the question open/unanswered for the time being to give a chance for other answers.
– Breakthrough
Sep 25 '15 at 4:22
|
show 7 more comments
I have tried to trace the history of CHS and the "starting with 1" sector
numbering fiasco, which has caused many complications for disk-drivers
writers and gave rapid rise to LBA.
CHS dates back to the days when personal computers ran on diskettes and
when the BIOS was invented. This is what Wikipedia says :
The term BIOS (Basic Input/Output System) was invented by Gary
Kildall and first appeared in the CP/M operating system in
1975, describing the machine-specific part of CP/M loaded
during boot time that interfaces directly with the hardware.
A research into the CP/M BIOS has found the document
CP/M information archive : BDOS system calls,
in which sector numbers start with zero.
The conclusion is that : earliest CHS schema actually used zero-based
sector addresses.
One-based sector addresses were first introduced with the first
IBP/PC. The document
INT 13 - Diskette BIOS Services specifically says :
Most disk BIOS calls use the following parameter scheme:
AH = function request number
AL = number of sectors (1-128 dec.)
CH = cylinder number (0-1023 dec.)
CL = sector number (1-17 dec.) <--------!!!
DH = head number (0-15 dec.)
DL = drive number (0=A:, 1=2nd floppy, 80h=drive 0, 81h=drive 1)
DL = drive number (0=A:, 1=2nd floppy, 80h=C:, 81h=D:)
Note that some programming references use (0-3) as the
drive number which represents diskettes only.
ES:BX = address of user buffer
So it was the IBM/PC that by a de-facto implementation of the BIOS has converted
sector-numbering from zero-based to one-based.
Of the twelve IBM engineers assigned to create the IBM Personal Computer (model 5150), David J. Bradley developed the code for its BIOS. So he's the one who, among all its other details, decided on the parameters for the disk
interrupts. We also owe to this guy together with Mel Hallerman the famous
CTRL+ALT+DEL.
So the answer to the question
Why does the sector count start at 1 and not 0 in CHS is :
Because David J. Bradley programmed the BIOS that way.
As to why he did it this way, this is best answered by himself.
If I had to guess, I would say that he left sector zero as an addressing
sector by which the driver could verify that the head was on the right
track.
As disks were actually engineered so as not to require such a
mechanism, and the engineers were not ready to waste one sector because of the BIOS, sector zero never came into existence. Thereafter, driver-writers were
left with the need to subtract-one and add-one to sector addresses for all
BIOS disk calls.
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
|
show 1 more comment
I have tried to trace the history of CHS and the "starting with 1" sector
numbering fiasco, which has caused many complications for disk-drivers
writers and gave rapid rise to LBA.
CHS dates back to the days when personal computers ran on diskettes and
when the BIOS was invented. This is what Wikipedia says :
The term BIOS (Basic Input/Output System) was invented by Gary
Kildall and first appeared in the CP/M operating system in
1975, describing the machine-specific part of CP/M loaded
during boot time that interfaces directly with the hardware.
A research into the CP/M BIOS has found the document
CP/M information archive : BDOS system calls,
in which sector numbers start with zero.
The conclusion is that : earliest CHS schema actually used zero-based
sector addresses.
One-based sector addresses were first introduced with the first
IBP/PC. The document
INT 13 - Diskette BIOS Services specifically says :
Most disk BIOS calls use the following parameter scheme:
AH = function request number
AL = number of sectors (1-128 dec.)
CH = cylinder number (0-1023 dec.)
CL = sector number (1-17 dec.) <--------!!!
DH = head number (0-15 dec.)
DL = drive number (0=A:, 1=2nd floppy, 80h=drive 0, 81h=drive 1)
DL = drive number (0=A:, 1=2nd floppy, 80h=C:, 81h=D:)
Note that some programming references use (0-3) as the
drive number which represents diskettes only.
ES:BX = address of user buffer
So it was the IBM/PC that by a de-facto implementation of the BIOS has converted
sector-numbering from zero-based to one-based.
Of the twelve IBM engineers assigned to create the IBM Personal Computer (model 5150), David J. Bradley developed the code for its BIOS. So he's the one who, among all its other details, decided on the parameters for the disk
interrupts. We also owe to this guy together with Mel Hallerman the famous
CTRL+ALT+DEL.
So the answer to the question
Why does the sector count start at 1 and not 0 in CHS is :
Because David J. Bradley programmed the BIOS that way.
As to why he did it this way, this is best answered by himself.
If I had to guess, I would say that he left sector zero as an addressing
sector by which the driver could verify that the head was on the right
track.
As disks were actually engineered so as not to require such a
mechanism, and the engineers were not ready to waste one sector because of the BIOS, sector zero never came into existence. Thereafter, driver-writers were
left with the need to subtract-one and add-one to sector addresses for all
BIOS disk calls.
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
|
show 1 more comment
I have tried to trace the history of CHS and the "starting with 1" sector
numbering fiasco, which has caused many complications for disk-drivers
writers and gave rapid rise to LBA.
CHS dates back to the days when personal computers ran on diskettes and
when the BIOS was invented. This is what Wikipedia says :
The term BIOS (Basic Input/Output System) was invented by Gary
Kildall and first appeared in the CP/M operating system in
1975, describing the machine-specific part of CP/M loaded
during boot time that interfaces directly with the hardware.
A research into the CP/M BIOS has found the document
CP/M information archive : BDOS system calls,
in which sector numbers start with zero.
The conclusion is that : earliest CHS schema actually used zero-based
sector addresses.
One-based sector addresses were first introduced with the first
IBP/PC. The document
INT 13 - Diskette BIOS Services specifically says :
Most disk BIOS calls use the following parameter scheme:
AH = function request number
AL = number of sectors (1-128 dec.)
CH = cylinder number (0-1023 dec.)
CL = sector number (1-17 dec.) <--------!!!
DH = head number (0-15 dec.)
DL = drive number (0=A:, 1=2nd floppy, 80h=drive 0, 81h=drive 1)
DL = drive number (0=A:, 1=2nd floppy, 80h=C:, 81h=D:)
Note that some programming references use (0-3) as the
drive number which represents diskettes only.
ES:BX = address of user buffer
So it was the IBM/PC that by a de-facto implementation of the BIOS has converted
sector-numbering from zero-based to one-based.
Of the twelve IBM engineers assigned to create the IBM Personal Computer (model 5150), David J. Bradley developed the code for its BIOS. So he's the one who, among all its other details, decided on the parameters for the disk
interrupts. We also owe to this guy together with Mel Hallerman the famous
CTRL+ALT+DEL.
So the answer to the question
Why does the sector count start at 1 and not 0 in CHS is :
Because David J. Bradley programmed the BIOS that way.
As to why he did it this way, this is best answered by himself.
If I had to guess, I would say that he left sector zero as an addressing
sector by which the driver could verify that the head was on the right
track.
As disks were actually engineered so as not to require such a
mechanism, and the engineers were not ready to waste one sector because of the BIOS, sector zero never came into existence. Thereafter, driver-writers were
left with the need to subtract-one and add-one to sector addresses for all
BIOS disk calls.
I have tried to trace the history of CHS and the "starting with 1" sector
numbering fiasco, which has caused many complications for disk-drivers
writers and gave rapid rise to LBA.
CHS dates back to the days when personal computers ran on diskettes and
when the BIOS was invented. This is what Wikipedia says :
The term BIOS (Basic Input/Output System) was invented by Gary
Kildall and first appeared in the CP/M operating system in
1975, describing the machine-specific part of CP/M loaded
during boot time that interfaces directly with the hardware.
A research into the CP/M BIOS has found the document
CP/M information archive : BDOS system calls,
in which sector numbers start with zero.
The conclusion is that : earliest CHS schema actually used zero-based
sector addresses.
One-based sector addresses were first introduced with the first
IBP/PC. The document
INT 13 - Diskette BIOS Services specifically says :
Most disk BIOS calls use the following parameter scheme:
AH = function request number
AL = number of sectors (1-128 dec.)
CH = cylinder number (0-1023 dec.)
CL = sector number (1-17 dec.) <--------!!!
DH = head number (0-15 dec.)
DL = drive number (0=A:, 1=2nd floppy, 80h=drive 0, 81h=drive 1)
DL = drive number (0=A:, 1=2nd floppy, 80h=C:, 81h=D:)
Note that some programming references use (0-3) as the
drive number which represents diskettes only.
ES:BX = address of user buffer
So it was the IBM/PC that by a de-facto implementation of the BIOS has converted
sector-numbering from zero-based to one-based.
Of the twelve IBM engineers assigned to create the IBM Personal Computer (model 5150), David J. Bradley developed the code for its BIOS. So he's the one who, among all its other details, decided on the parameters for the disk
interrupts. We also owe to this guy together with Mel Hallerman the famous
CTRL+ALT+DEL.
So the answer to the question
Why does the sector count start at 1 and not 0 in CHS is :
Because David J. Bradley programmed the BIOS that way.
As to why he did it this way, this is best answered by himself.
If I had to guess, I would say that he left sector zero as an addressing
sector by which the driver could verify that the head was on the right
track.
As disks were actually engineered so as not to require such a
mechanism, and the engineers were not ready to waste one sector because of the BIOS, sector zero never came into existence. Thereafter, driver-writers were
left with the need to subtract-one and add-one to sector addresses for all
BIOS disk calls.
edited Sep 28 '15 at 9:41
answered Sep 26 '15 at 9:57
harrymcharrymc
257k14268568
257k14268568
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
|
show 1 more comment
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"I would say that he left sector zero as an addressing sector..." -- Illogical guess. Every sector has an Identification Record that includes the cylinder/head/sector address. The disk controller does not have to wait for the Index to come around to validate that the seek completed on the correct cylinder; the very next sector that rotates under the head is read for verification.
– sawdust
Sep 30 '15 at 0:55
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"CH = cylinder number (0-1023 dec.)" -- The original IBM PC BIOS uses CH for the "track" number. CH is an 8-bit register, so the maximum value is only 255.
– sawdust
Sep 30 '15 at 1:14
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
"I have tried to trace the history of CHS ... and gave rapid rise to LBA" -- To be clear, all these discussions about "LBA" only pertain to PC disk interfaces, especially the ATAPI specification. Otherwise CHS and LBA can coexist. E.G. I've written a few filesystems that used LBA internally, but converted the addressing to CHS to perform the actual disk I/O per the controller interface. "earliest CHS schema actually used zero-based sector addresses." -- True, but that happened way before CP/M.
– sawdust
Sep 30 '15 at 1:30
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
@sawdust: All I did was to cite IBM documents, which might even predate the assignment of registers for the PC BIOS interface. It's clear that Bradley was mistaken or misdirected by setting sector 0 as a reserved address, but we cannot be sure what for, since it never happened. It might be that he wasn't aware that the sector address-part also contained the track-number. Or maybe this spare sector was a property of diskettes that was carried over into Bradley's general BIOS interface. We only know that the IBM/PC BIOS was responsible for this change in CHS.
– harrymc
Sep 30 '15 at 5:47
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
As always in these matters, Ralph Brown's Interrupt List provides invaluable information. While it is true what @sawdust wrote about CH being an eight-bit register, that's not how CX was used. Instead, CX was bit-stuffed with both the cylinder number and sector number (but this extension apparently only applied to hard disks, not floppies; for floppies, CL held the sector number and CH held the cylinder number). Compare for example the specified interface for Int 13/AH=02h, BIOS - DISK - READ SECTOR(S) INTO MEMORY input parameters.
– a CVn
Sep 30 '15 at 7:54
|
show 1 more comment
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.
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Take a look at This
– yass
Apr 11 '17 at 20:39
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
add a comment |
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.
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Take a look at This
– yass
Apr 11 '17 at 20:39
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
add a comment |
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.
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.
edited Jan 1 at 9:55
answered Apr 11 '17 at 19:47
APO69APO69
414
414
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Take a look at This
– yass
Apr 11 '17 at 20:39
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
add a comment |
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Take a look at This
– yass
Apr 11 '17 at 20:39
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Its reserved for driver - I/O firmware interface, even in modern day SSD disk or flash have reserved space for I/O operations to read/write/copy/format etc..
– Jordan Davis
Apr 11 '17 at 19:52
Take a look at This
– yass
Apr 11 '17 at 20:39
Take a look at This
– yass
Apr 11 '17 at 20:39
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
Yes, but not SECTOR 0 but CYLINDER 0. From the first specification (IBM 3740) cylinder 0 is called "the Index cylinder" and stores multiple data specified in the "INDEX CYLINDER LAYOUT". On modern discs this cylinder is usually assigned as "CYLINDER NUMBER -1", yes "-1", and is only accessible by the controller. There is nothing to explain why sector 0 has not been used and although we can see it in some operating systems like CP/M, it is virtual since the hardware is still manufactured according to the IBM 3740. In other words, the first sector Is SECTOR 1. Why? "NATURAL NUMBERING"
– APO69
Apr 12 '17 at 18:33
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f974952%2fwhy-does-sector-number-addressing-in-chs-start-at-sector-1-and-not-0%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
"Why does the sector count start at 1..." -- Actually you're referring to the sector number, not the sector count. Those are two distinct and different parameters used in a disk request. "Sector index" is also poor nomemclature for the sector number, as there is a distinct entity called the index in disk drives.
– sawdust
Sep 30 '15 at 1:39