On 23 Mar 2014, at 20:00, allison <ajp166 at verizon.net> wrote:
[...]
What I need to verify or know is what drives smaller
than 2GB or better yet
smaller than 1GB that support LBA. I don't want to use CHS and while I can
that means I have to write my own LBA to CHS and sine I may also use SD
and CF it would be nice to stay in LBA all the way.
I concur that LBA is the way forwards when it comes to the data structures in your
operating system, but sadly CHS is very much more common in small drives and you?re just
going to have to put up with it if you need to support small disks. I recently went
through all of my old disks and did wonder why I was having trouble reading some of them.
It turned out that my USB-PATA bridge couldn?t cope with disks that didn?t support LBA,
which turned out to be all of my tiny disks. I concluded that I don?t want to bother with
small disks any more.
At a guess, you want to avoid CHS because divmod operations are extremely expensive on the
Z80 and also a chore to implement from scratch. However, in the specific cases of division
by 255 and 63, it?s not quite as horrific as it sounds, as you can do fixed-point
multiplications by 1/255 and 1/63. The binary value of 1/255 is a particularly pleasing
0x0.010101... and thus quite cheap. However disks presenting as 63 sectors and 255 heads
will be relatively large and probably also support LBA, making such an approach moot.
I have a large (greater than 50kilos) collection of
IDE/ATA interface
drives
from 20mb all the way to 4.3GB (larger is not being considered) to pick
from.
Why are you discounting large drives? If you?ve got a design limitation in your code, just
ignore sectors beyond that point. Your tools that probe the drive?s capacity (i.e. the
partitioner and/or mkfs) need to be aware that they may see a size beyond the limit and
thus need to truncate it, but other than that you can ignore the extra space.
4.3GB is also a curious figure: it?s roughly 2**32 bytes which is how the Amiga ended up
with that limitation. It?s also the number of sectors that would fit into a signed 24 bit
int, but if you?re writing this from scratch, you can easily make that unsigned or extend
to 32 bits to let you address drives up to 8MiB and 2TiB respectively. (Although you can?t
get PATA drives anything like as large as 2TiB, and if you?re using LBA28 commands, you?ll
not see space beyond 128GiB anyway.)
[...]
Obviously I'd like to use up a smaller drive, just
because, no good reason.
I want to do a bit of playing with OS creation or heavy modification.
If you are trying to avoid both CHS and large disks because it?s too hard to implement,
you are going to get some unpleasant surprises from other hardware as well. Were you
planning to drive a printer or serial device? ;)