Subject: Re: [stella] AtariVox EEPROM file format|
From: "Eckhard Stolberg" <Eckhard_Stolberg@xxxxxx>
Date: Wed, 1 Dec 2004 22:05:45 +0100
That "elbow room" I mentioned earlier should keep characters from being represented by more than 6 bits, so 8.3 filenames could have a definitive maximum byte size. <<
This would help for programs with hardcoded filenames, since you know how much space your filename will take and how much space you have for your save data. But for programs that want to allow the user to select the filename freely, you'd have to design your data structure for the worst case where all characters take the maximum number of bytes. And then the space you gain by compressing the filename would have to remain unused.
What about a nice compact (not "compressed") 4-character name represented by 24 bits (3 bytes) plus one file type byte for a total of four bytes? I think 4 characters is plenty to uniquely identify a file. Simple, small, easy to read, easy to display. Naturally, we'd need to establish a Stella Filetypes clearinghouse or some sort of governing body to manage the filetypes... all 256 of them. :) <<
Short filenames would work well for programs that just want to provided numbered savestates or something where the filename is mostly chosen by the program itself. But for Paul's music sequencer for example most people would probably prefer to have somewhat descriptive filenames. And for that four character names might be a bit short.
The filenames mostly exist for the convenience of the users. If we wanted to get the most out of the saved files, we could just identify them by their number (there are only 128 blocks with a fixed length of 128 bytes each), and force the user to keep track of what data he saved to which block himself on a piece of paper or something. Then we could use the whole 128 bytes for data.
So what we need is a system that allows the user to easily identify what he saved to which block, but that still doesn't waste too much EEPROM space as well as RAM and ROM in the programs that support the AtariVox.
We use one byte per character. the font allows only the following 37 characters: " 0-9 A-Z _ ". "Illegal" characters with higher numbers should be displayed with an empty box in the file selection dialogs.
The first three bytes in the EEPROM block are the file type prefix. Also the MSB in the first byte specifies wether the block is used (0) or still empty (1).
The next 8 bytes contain the file name, but if any of these bytes has the MSB set to 1, this means that this is the last character of the filename, and that the following bytes will be used for data.
This will allow filenames between 4 and 11 characters. I think this is a good compromise between EEPROM space, descriptivenes of the filename and complexity of the support code.