[Coco] OS-9 / NitrOS9 floppy disk directory layout.

gene heskett gheskett at shentel.net
Mon Jun 13 20:21:14 EDT 2022


On 6/13/22 16:46, coco at jechar.ca wrote:
>
> Thanks this is good one more question more specific this time, if you 
> have a 1.5 MB virtual OS9 disk and it is bootable are the boot track 
> and OS9Boot file all within the first 160K ?
>
> On 2022-06-12 13:23, L. Curtis Boyle wrote:
>> Where it will be will depend on the size of the disk (how many tracks,
>> sides and sectors per track). LSN0 (sector 0) contains this
>> information so that you can figure that out no matter which size of
>> disk you are dealing with. It also has the sector number that the root
>> directory starts at.
>> Floppy drives and hard drives use the same format; logical sector
>> numbers are all 24 bit numbers. On real large drives you may have to
>> deal with clusters as well (multiple sectors counting as a single
>> “block” as far as free space, etc are concerned. You are correct that
>> each directory entry is 32 bytes; 29 for the filename, and a 3 byte
>> sector number that points to a description of the file (or
>> sub-directory, they use the same structures). The file description
>> sector has file attributes, segment lists, etc and points to the
>> actual data in a file/directory. Each segment entry is 5 bytes; 3
>> bytes for sector number each segment starts at, and then 2 bytes for
>> how big that segment is. On a real Coco these segments max out at 2048
>> (due to how RBF internally uses memory to buffer things), but since
>> you have up to 48 segments per file, that’s still pretty large.
>> Maximum number of files per directory is the same for all directories,
>> root or otherwise, and is based on the segment lists above. 8 files
>> per sector, 2048 sectors per segment, 48 segments (multiply that all
>> together) means over 768,000 files. There are practical limitations
>> though, so would never get that high in real life. (Some are - disk
>> fragmentation from creating deleting files eventually means that you
>> can’t make full sized segments. The OS finding files in a directory
>> even with just a few thousand files would start to slow things down; I
>> can’t imagine what performance would be like with 10’s or 100’s of
>> thousands of files. So make subdirectories way before you start making
>> directories that big).
>>
>> Hopefully I didn’t go to overboard explaining this, but I think I
>> answered your questions. :-)
>>
>> Sent from my iPhone
>>
>>> On Jun 12, 2022, at 11:04 AM, coco at jechar.ca wrote:
>>>
>>> All
>>>
>>> I wanted to know where the directory for an OS-9 floppy is located, 
>>> I think it takes 32 Bytes per file entry could someone confirm this. 
>>> Also I was wondering if it is all on contiguous sectors and is there 
>>> a maximum number of files in the root directory or sub directory. Is 
>>> it identical to the OS-9 hard drive directory format or does that 
>>> follow different rules.
>>>
>>> Thanks Chatlie


The os9 directory's location is in lsn0. But the size of the FAT table of

any os9 disk depends both on the size of the disk and how many

clusters are represented by one bit of this FAT area. For floppy's that

area can be one or two sectors long, for bigger hard drives a cluster

is some power of 2 more than one.  I have 2 1gbyte drives on my now

dead coco, one is formatted so hdbdos and os9 can share with hdbdos

having the room above the nominally 500 meg os9 area(cluster size is

4 sectors per bit), room enough above that for several copies of all the

dos disks you can find in 256  single sided 35 track dos disks images.

IIRC about 7 banks of 256 disks each.


The 2nd 1gig disk was formatted for all os9 so one bit in the FAT is 16 
sectors.


So the directory track for the root of the tree can be as high as lsn0's

256 bytes plus another 65536 bytes, aka 64k, or starting the 258th

sector for the actual first director listing because the 257th sector is

the file descriptor sector for the next 7 sectors. The FAT is much smaller

on the floppy, still under 2 full sectors. So from LSN0, a pointer to the

FD sector and 7 more for the rest of that directory segment.

If you put more files than there is room for in that 7 sectors, then the 
FAT

is searched for enough space to create another segment, a size determined

by a byte in the disk descriptor, and the FD sector is modified to 
create a chain

leading to the new segment of this file called a directory. I had that 
byte in

the descriptor set for $20, as opposed to 8 for a floppy, mainly to keep

from filling up the FD's table, cuz if its full, interesting things happen.


I'm the one that put all that back into rbf.mn after Kevin took it out 
in one of

his alleged Christmas presents. Without that, the biggest hard drive you 
could

use all of was a scsi maxtor 7120. 128 megs.  But Boisy ignored my

recommendation to increase that byte in the descriptor, filled up the last

5 bytes in the FD descriptor, and i had used a bit in that last sector as a

"been backed up bit" so a file that had been backed up and hadn't been 
touched

since, which would clear that bit harmlessly. The intention was to skip 
that file

if it had already been backed up and hadn't been touched since but if 
that file

was deleted there was a chance lsn0 would be cleared in the FAT, by by the

whole disk in the next write in that event. And Boisy got bit. The blue 
smoke

from Iowa drifted all the way to WV.


So now you know a little bit more of the os9 vs big disks history.


Cheers, Gene Heskett.
-- 
"There are four boxes to be used in defense of liberty:
  soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
  - Louis D. Brandeis



More information about the Coco mailing list