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

L. Curtis Boyle curtisboyle at sasktel.net
Sun Jun 12 13:23:40 EDT 2022


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
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list