I'm looking for some feedback on an idea I've been experimenting with this week: extending the MMB format beyond 511 disks.
I'm genuinely unsure whether this is a good idea or not, given that MMFSv2 dispenses with the MMB container entirely and effectively allows an unlimited number of disk images to be supported, as seperate SSD/DSD files on the SD card. And SmartSPI allows the use of multiple MMB files (with manual switching between them).
But for one reason or another I find myself still using MMFSv1, mostly because I have a much better memory for disk numbers than for 8-character filenames. But partly because I have found MMFSv2 a bit slow with large numbers of disks.
So for this reason I've been experimenting with larger MMB files.
As a quick refresher, the original 511-disk MMB format is:
Code: Select all
<16 byte header specifying the power on drive mapping>
<511 x 16 bytes disk table, caching the disk title and status>
<511 x 200KB disk images>
So lets talk about two types of compatibility:
- Backardwards compatibility: the ability of new software / file systems to work with existing MMB files
- Forwardwards compatibility: the ability of existing software / file systems to work with new (larger) MMB files (or degrade gracefully)
Backwards compatability is the easier of these to achieve; it just requires that new software can reliably distinguish between the old and new MMB file formats.
The existing 16-byte MMB file header is:
Code: Select all
00: Default disk to load into drive 0 (low byte)
01: Default disk to load into drive 1 (low byte)
02: Default disk to load into drive 2 (low byte)
03: Default disk to load into drive 3 (low byte)
04: Default disk to load into drive 0 (high byte)
05: Default disk to load into drive 1 (high byte)
06: Default disk to load into drive 2 (high byte)
07: Default disk to load into drive 3 (high byte)
08-0F: Unused, normally written as 00
08: 00 indicates a 511 disk MMB file
A1 indicates a 1023 disk MMB file
A2 indicates a 2047 disk MMB file
A3 indicates a 4095 disk MMB file
A4 indicates a 8191 disk MMB file
anything else is reserved, but would be treated as a 511 disk file
[/code]
This allows new software to easily determine the MMB file size.
Forwards compatibility - the ability for existing software to work with new (larger) MMB files (or degrade gracefully) - is more of a challenge. By degrading gracefully, I mean still having access to the first 511 disks, and potentially being able to do a full range of file operations on those disks.
One way to implement a larger MMB file would be to simply make the drive table and disk image sections larger:
Code: Select all
<16 byte header specifying the power on drive mapping>
<4095 x 16 bytes disk table, caching the disk title and status>
<4095 x 200KB disk images>
Unfortunately this breaks forward compatibility. Existing software will be unable to make any sense of the MMB file, because the position of the disk images has shifted. Worse still, it's shifted by a fraction of a disk image. This is bad, because the disk catalogs are no longer aligned between the old and new formats. So anything trying to list the contents of the disks is going to return garbage.
Instead, I think it's better to try to extend the exiting MMB format by adding data onto the end:
Code: Select all
<16 byte header specifying the power on drive mapping>
<511 x 16 bytes disk table, caching the disk title and status>
<4095 x 200KB disk images>
<200KB reserved>
<3584 x 16 bytes disk table, caching the disk title and status>
There's a good chance that existing SD Card filesystems will access the first 511 disks, and will simply ignore the rest.
The only down side is that the disk table is now split into two sections, so any code that manages the disk table (e.g. *DCAT, *DRECAT, *DFREE, *TITLE, etc) gets a bit more complicated.
The reserved section has two purposes:
- provides a place for future expansion
- simplfies the calculation off the offset within the MMB file of a given disk table sector
I'm a bit less confident of how existing MMB archive management software will cope with the new format. I've tried a few:
- Stephen's Perl MMBUtils (which I use) work fine, and it's possible to read/write disks 0.510
- Robcfg's MMBExplorer rejects the file as invalid
- Gerald's DiskImageManager rejects the file as invalid
This is not entirely unexpected, as I think MMBExplorer and DiskImageManager load the entire MMB file into memory (a 8191 disk file is now 1.7GB!)
So where I have ended up with the new MMB format is:
Code: Select all
<16 byte header specifying the power on drive mapping, and a new MMB size byte>
<511 x 16 bytes disk table, caching the disk title and status>
<(2^N-1) x 200KB disk images>
<200KB reserved>
<(2^N-2^9) x 16 bytes disk table, caching the disk title and status>
I've had a go this week at implementing this in MMFS.
My main concern (for a while with MMFS) has been space, in that some of the builds are very tight indeed, with only a few spare bytes. Acorn did a pretty efficient job writing the core DFS code (on which MMFS is based), so there's not a lot of scope there for optimization. But during the week I've looked at the rest of MMFS, specifically the DUTILS commands (DCAT, DRECAT, DFREE, etc). With some effort, I've managed to claim back almost 200 bytes, without sacreificing any features.
I've been working in the [url=https://github.com/hoglet67/MMFS/commit ... mb_support]large_mmb_support[url] branch, and have added two new features (both optional at present)
- Large MMB support (exactly as outlined in this post), which cost 89 bytes of code
- *DONBOOT support, which costs 45 bytes of code
(The *DONBOOT command allows you to specify the default drive mapping. These are written back to the MMB file, and reloaded on a power up, and on a control-break. After using this for a while, I wish I'd added it sooner!)
Anyway, here are a few screen shots of it running (in b-em)...
As an experiment, I've manually built a 8191 entry MMB file, and added all 3,500 ~ish disk images from bbcmicro.co.uk onto it:
I'm looking for feedback on a few things:
- would anyone find larger MMB files useful?
- or would MMFS supporting multiple MMB files instead be more attractive (like SmartSPI does)?
- does the proposal in the post seem like a reasonble way to proceed?
- would any of the MMB Manager folk be interested in supporting larger MMB files (especially Stephen as I use MMBUtils daily)?
A can make a dev build of MMFS 1.4X available if anyone want to have a play. But be aware that current the only way to access disk images beyond 511 is from the Beeb.
Anyway, that's more than enough for now. I'm happy to talk about this more at the dev night tonight.
Dave