This document explains the format of the MDB files. MDB files store the actual contents of a database record. The MDB file begins with a variable length header describing the overall database configuration. The header is followed by one or more variable length records. Every MDB file must have (generally as its first record, though it is not clear if this location is a requirement) a null record. This record is used by parent databases, if they exist, to specify a null value for one of their access keys.
The names given in the table below are sometimes used in implementations, but are not normative in any way.
Name | Word Offset | Size (words) | Description |
---|---|---|---|
LengthOfHeader | 0 | 1 | Length of header in words, including this word. |
Attributes | 1 | 1 | Attribute bits:
Records in a removable DB can be deleted even if there are records in the parent DB still referring to them. In a non-removable DB, this is not allowed. |
Status | 2 | 1 | Status bits:
|
NumOfKeys | 3 | 1 | 1 + the number of access keys, sometimes called "rules," per record. Essentially, the primary data field is being counted here, even though it is not an access key. (M) |
NumOfFieldsPerRecord | 4 | 1 | Number of Fields per record. Includes the primary data field, access keys, and extra info fields. |
RecordStart | 5 | 2 | Word pointer to start of first record in this file |
pXIM | 7 | 2 | Word pointer to the XIM data |
Reserved | 9 | 6 | Reserved |
DB_ID | 15 | 1 | Database ID assigned by device DB server |
pDB_Name | 16 | 2 | Word pointer to DB name |
pParentDBFilename | 18 | 2 | Word pointer to DB filename |
pRuleName1 | 20 | 2 | Word pointer to name of access key #1 |
pRuleFilename1 | 22 | 2 | Word pointer to filename of child MDB for access key #1 |
... | ... | ... | ... |
pRuleNameM | 20+4*(M-1) | 2 | Word pointer to name of access key #M |
pRuleFilenameM | 22+4*(M-1) | 2 | Word pointer to filename of child MDB for access key #M |
... | ... | ... | ... |
DB_Name | Variable | DB name (dd format) | |
ParentDBFilename | Variable | DB filename (sz format) | |
RuleName1 | Variable | Name of access key #1 (dd format) | |
RuleFilename1 | 22 | Variable | Filename of child MDB file for access key #1 (sz format) |
... | ... | ... | ... |
pRuleNameM | Variable | Name of access key #M (dd format) | |
pRuleFilenameM | Variable | Filename of child MDB for access key #M (sz format) | |
... | ... | ... | ... |
XIM | Variable | XIM data | |
... | ... | ... | ... |
Signature | LengthOfHeader - 2 | 2 | Signature, "WOID" |
XIM data is used to control the menu system on the Neuros. Various databases are often associated with particular menus, and the XIM data stored in the MDB header controls what menu options are available and what they do. This documentation does not cover the structure of the XIM data block.
MDB Records are composed of three types of fields (always occuring in this order):
The number of each of these fields is fixed by the MDB header. There is one primary data field, (NumOfKeys - 1) access keys, and (NumOfFieldsPerRecord - NumOfKeys) extra info fields.
Fields are permitted to be multi-valued. This is used to support fields like "Playlist" in the audio database, which can have several values if a track is in multiple playlists.
Since fields can have variable length, some method must be used to mark where each field begins and ends. The method used in the MDB format is special delimiter words:
An example record in a database with all three types of fields, but without any multivalued fields, would have the following form:
Record Flag - 16-bit flag
|
Primary Record Data (sz format) |
0x0023, Field delimiter |
Access Key #1 (pointer) |
0x0023, Field delimiter |
Access Key #2 (pointer) |
0x0023, Field delimiter |
Extra Info #1 (integer) |
0x0023, Field delimiter |
Extra Info #2 (sz data) |
0x0025, End of Record |
An example record in a database with all three types of fields, but with a multivalued fields, would have the following form:
Record Flag |
Primary Record Data (sz format) |
0x0023, Field delimiter |
Access Key #1, Value #1 (pointer) |
0x0024, Bag delimiter |
Access Key #1, Value #2 (pointer) |
0x0023, Field delimiter |
Access Key #2 (pointer) |
0x0023, Field delimiter |
Extra Info #1 (integer) |
0x0023, Field delimiter |
Extra Info #2 (sz data) |
0x0025, End of Record |
Most child databases only have a primary data field, so they look like:
Record Flag |
Primary Record Data (sz format) |
0x0025, End of Record |
Every database is required to have a null record, generally the first record. This is a degenerate record with no fields used to represent null values in child databases. A parent will point to this record when the associated access key has a null (or empty) value:
0x8000, Record Flag (this record must not be deleted) |
0x0025, End of Record |