SJ Research MDFS Filesystem Structure ===================================== http://mdfs.net/Docs/Comp/Disk/Format/SJ/MDFS The MDFS uses 1024-bytes disk blocks. Blocks are counted with 16-bit numbers from &0000 at the start of the filesystem. Floppy disks are formatted to 2 sides, 80 tracks, 5 sectors, 1024 bytes, and tracks are interleaved, that is block=sector+side*5+track*10. Block zero is zero bytes from the start of the physical disk (ie, sector &0000). Hard drives have 512-byte sectors. Block zero is 1024 bytes from the start of the physical disk (ie sector &0002). Disk partitions are accessed by multiplying the partition number by the configured drive size. For example, blocks on a system configured to use 60M partitions are accessed at partition*60M+block+1 Block zero ---------- The first disk block contains information about the disk as a whole, where to find special objects such as "$" and "%PASSWORDS", and the printer types defined on that disk. 000-03F: Directory entry for "$". 040-056: "SJ Research MDFS disk " - string identifies this as a disk. 057-060: Disk title, terminated with if less than ten characters. 061 : ??? - usually set to &FF. 062-063: Disk size in blocks. Maximum disk size is &FFFF blocks, 1024 bytes less than 64M. 064-079: ??? 07A-07B: Sometimes set to disk creation date in standard format. 07C-07D: Sometimes set to disk creation time, Hours, Minutes. 07E-07F: ??? 080-0BF: Directory entry for "%PASSWORDS". 0C0-1BF: Sixteen 16-byte printer entries or eight 32-byte printer entries. 1C0-1FF: Directory entry for "%PRINTQ". 200-3FF: 256x16-bit account balances accounts for &000-&0FF If more than 256 accounts are used, then the account balances continue in blocks 1 onwards up to block 4. Printer Entries --------------- 16-byte printer entry: 000-005: Printer name, padded with spaces, or six spaces for none. 006 : ??? 007 : ??? 008 : ??? 009-00F: ??? - usually set to &00 32-byte printer entry: 000-005: Printer name, padded with spaces, or six spaces for none. 006 : ??? - port? 007 : ??? 008 : ??? 009-01F: Banner filename, terminated with Directories ----------- Directories contain a number of 64-byte entries. Entry zero is the directory header containing information about the directory. Directory entries are not stored in any particular order. Directory Header ---------------- 000-01F: Occupied entry bitmap. Each bit is set if the corresponding directory entry is used, up to 256 directory entries. Byte 0, bit 0 represents entry 0, byte 0, bit 1 represents entry 1, and so on. Entry zero is the directory header and will always be occupied. 020-03F: ??? Directory Entry --------------- 000 : Account number b0-b7. 001-00A: Object name, terminated by if less than ten characters. 00B : ??? - usually 00C-00F: Load address. 010-013: Exec address. If the object is a directory: 00C contains the default access. 00D contains largest number of entries directory has had - cycle number? 00E ??? 00F ??? 010 ??? 011 contains the number of entries. 014-016: Length. If object is a directory, length is zero. 017 : Access: Multiple:Private:Directory:Locked:OwnerW:OwnerR:PublicW:PublicR 018-019: Creation date in standard format. 01A-01B: Modification date in standard format. 01C-01D: Modification time, Hours, Minutes. 01E : Auxilary account number b0-b7. 01F : b0 :0=16xblock pointers, 1=16xAllocation block pointers b1-b3:account number b8-b10 b4-b6:auxilary account number b8-b10 b7 :? 020-03F: Allocation vector of sixteen 16-bit block numbers. If byte &01F bit 0 is zero, then the sixteen blocks pointed to by the allocation vector contain the object's data. The first pointer points to the object's first 1024 bytes, the second pointer to the second 1024 bytes, etc, up to 16K in total. If byte &01F bit 0 is one, then the sixteen blocks pointed to by the allocation vector each point to a block containing up to 512 block pointers that actually point to the objects contents. The first pointer points to a block that points to the data for the first 512K, the second pointer points to a block that points to the data for the second 512K, etc, up to 8M in total. A block number of zero indicaties that that part of the object has not been allocated any disk space. If the object is a directory, a vector of block numbers is used. Standard date format -------------------- Byte 0 b0-b4: day of month. b5-b7: (year-1981) bit 4-bit 6. Byte 1 b0-b3: month. b4-b7: (year-1981) bit 0-bit 3. Parent directory ---------------- The parent directory does not appear to be specified in the directory. It seems that the parent directory is found by scanning the filesystem for an object that points to the child directory. Version History --------------- 1.00 12-Sep-2004 First draft. 1.01 19-Apr-2007 Account balances, hard drive layout, disk creation date, 32-byte printer entries.