Writing a "retro" filing system

In another thread:

Ben,

There are dozens and dozens of books, papers, articles, and what not on this. Pick a disk size and go for it.

From the Forth idea where all you have is the bare-raw disk block (or typically enough chained together to make up 1KB). Create a manual index in block 0 that you can use to type in a filename and the number of the block and off you go…

Right up to something more modern that can support open/read/write/close/seek and directories…

Some more ideas: Read (it’s online) Beneath Apple DOS. Also Beneath Apple ProDOS. One of my retro filing systems was inspired by ProDOS - and it can handle up to 32MB directly, 64MB with some tweaking. That ought to be more than enough for a retro system.

Here is something much more simple: Go and look up the “Best Fit Algorithm” for writing a memory allocator. Now treat your disk drive as a linear array of bytes and implement that. This is not a million miles from several old filing systems - the ‘trick’ is to create a file with enough space in the first instance so you don’t overwrite the end of it. (but impose those checks in the driver code anyway) It’s very effective and not hard to do - just keep a separate few blocks at the start for the index/catalog. The rest is just a big linked list of files and files themselves are always consecutive sectors on the media. After some time you’ll need to write a “compact” utility that merges free space and optionally moves files, but that’s not a big deal.

Just do it.

-Gordon

3 Likes

I at the moment need to write in assembler, so I got stuck in the little details with the software
interface.
Hardware is still in a state of flux, as I have the bender bug.
I was happily dreaming of zeros and ones, and then a 2 showed up
Until I get that fixed,software is on hold.

Part of the problem is memory needed, The data format is the old IBM-1130 disc
pack that is larger than a floppy that most retro file system use. I am getting 2000
1kb blocks of 9 bit data. I may implement FORTH (threaded code) but I needed to find
a generic model to assemble.

Most of this is design issues not in coding. The ideas are well taken, thank you.
Ben.

1 Like