flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > bytes per sector |
Author |
|
bogdanontanu 14 May 2005, 04:25
FLoppy disks are capable of:
128,256,512,1024,2048,8192 and some even 16384 of bytes per sector. Althoug aparently it should be usefull, it doesent make them any good. HDD only use 512bytes per sector. That is good for standardization. Internaly HDDs might and do use a diferent sector size/track layout but they all expose the same fixed 512bytes sector to the external world. |
|||
14 May 2005, 04:25 |
|
f0dder 14 May 2005, 14:00
Bogdan, is this also true for SCSI disks?
|
|||
14 May 2005, 14:00 |
|
crc 14 May 2005, 19:22
Quote: HDD only use 512bytes per sector. That is good for standardization. Not true! I've encountered more than one SCSI hard drive using 520 byte sectors. Others have mentioned a range of 512 - 528 bytes per sector on various SCSI drives. |
|||
14 May 2005, 19:22 |
|
smiddy 14 May 2005, 22:22
SCSI is a differnet animal in itself as are older HDD. You used to be able to low level format HDD which was recommended for aligning the heads to the tracks and sectors, especially if you were encountering bad tracks. Back then and for SCSI (depends on your interface too) you could specify secotor sizes based on multiples of 128 bytes. As you can imagine, 128 bytes is very inefficient because there is an additional 64 (not all are the same, some have more some have less) bytes per sector on the disk that identifies low level specifics of the sector which would be 1/3 data description 2/3 data. Which leads into the specifics of the physical layout and sector sizes. Most HD companies do not adhere to a 2^n format for bytes per sector. Some will say that 1MB is 1,000,000 bytes and not 1024^2. This is the difference between RAM and magnetic media, as RAM has address lines. Each address line is either a one or zero (high or low) and therefore each address line is more important in consideration than specific bytes. But with magnetic media it is laid out in a circular pattern and is far easier to work in decimal than in binary.
But this is all moot when you put most OS file formats on a disc. The file systems tend to format into specific buffer sizes to make things easier to manipulate. Also, most IDE drives these days will not allow you to do low level formating any longer and abstract a layer which makes it appear the disc is giving you a quasi standard of 512 bytes. So, to get back on topic and to answer the initial question. Floppies can be, as well as FAT 12 can be, 1024 bytes per sector. If you are to read those sectors they are physical sectors, thus you would read only those four sectors. However, a caveat, your boot sector, regardless of all the rest, has to be 512 bytes to be compatible with FAT 12 (16/32). |
|||
14 May 2005, 22:22 |
|
zhak 15 May 2005, 09:24
And what should I do if I have, for example, 2048 (or greater) BytesPerSector, but I need to read only 1024 (or 512, etc.) of them (with INT 13h) and I do not have a buffer to store the whole sector, only 1024 (or 512) bytes that I need? Or if I use 1024 (or 2048) BytesPerSector then I need at least 1024 (or 2048) and not less bytes of RAM to read this sector?
|
|||
15 May 2005, 09:24 |
|
bogdanontanu 15 May 2005, 10:35
fodder:
Nope the SCSI and the ATAPI counterparts use an aproximatively 2048 bytes per sector standard. But yes smiddy is right... the real sector stored on the physical media is greater that the usefull data payload and a lot of bytes are wasted with 128bytes sectors. Sector sizes of 2048 bytes or higher are faster and have more usefull data payload but do waste space with multiple very small size files. So the 512 bytes is the middle compromise that is always used by IDE HDDs. zhak: For the floppy I do not think that the BIOS supports non 512 bytes per sector. The FDC controller does but you would have to write your own drivers and talk directly to the floppy chip for this. HDD do not support this and honestly the floppy is no speed champion and I see no purpose into tweaking it... |
|||
15 May 2005, 10:35 |
|
smiddy 15 May 2005, 11:54
@zhak:
The BIOS, as bogdanontanu says requires your boot sector to be 512 bytes. Also a signature at the end of the 512 byte sector is needed: Code:
dw 0AA55h
My saying it was because of FAT 12 (16/32) was incorrect (whoops; its been a while). To answer your questions is a bit difficult because it means you have to do specific arbitration for potential situations. You would need to figure out the number of combinations and the number of permutations and all possible outcomes and code it accordingly for each case, that is if you wanted to do an intelligent design. You can always say that anything not of your design standard is not supported, which is what most OSes do. You can not predict or use all combinations and permutations as there are too many to deal with, especially within the boot sector requirement of 512 bytes of code. |
|||
15 May 2005, 11:54 |
|
zhak 15 May 2005, 15:58
So, smiddy, you suggest not to make boot-time support for non-standart disk formats and use only default 512 BytesPerSector? Maybe you're right, but it could make the solution more universal, I thought...
|
|||
15 May 2005, 15:58 |
|
smiddy 16 May 2005, 00:29
I did some experiments with different BytesPerSector. You can specify say 1024 when you format, however, at bytes 511 and 512 of that sector you will need a 55 AAh in each byte if you want to boot from it. There are a couple of FAT12 compatible formats, XDF and 2M. Here a link with more information: http://www.csa.iisc.ernet.in/resources/documentation/hypertext/fdutils/fdutils_7.html#SEC47
So, to answer your question more specifically, yes, use the default of 512 bytes, at least until you have a handle on your own file system. FAT12 discs are easily attained and help you during your debug process. Once you have developed your own file system for the floppy you can arrange it however you wish, except for the booting floppy as described above. |
|||
16 May 2005, 00:29 |
|
THEWizardGenius 17 Jun 2005, 04:32
Don't bother. 512 is just fine. Besides, most BIOS's that I know of will load a 512-byte bootsector regardless, so that won't be helpful in that area.
|
|||
17 Jun 2005, 04:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.