2017-07-19 16:31:08 +01:00
|
|
|
|
// /***************************************************************************
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : ProDOS.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Apple ProDOS filesystem plugin.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Identifies the Apple ProDOS filesystem and shows information.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2016-07-28 18:13:49 +01:00
|
|
|
|
// ****************************************************************************/
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
using System;
|
2016-07-21 17:16:08 +01:00
|
|
|
|
using System.Collections.Generic;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
using System.Linq;
|
2017-07-19 16:31:08 +01:00
|
|
|
|
using System.Text;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using Claunia.Encoding;
|
2017-07-19 16:31:08 +01:00
|
|
|
|
using DiscImageChef.CommonTypes;
|
2015-10-18 22:04:03 +01:00
|
|
|
|
using DiscImageChef.Console;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.DiscImages;
|
|
|
|
|
|
using Schemas;
|
|
|
|
|
|
using Encoding = System.Text.Encoding;
|
2015-10-18 22:04:03 +01:00
|
|
|
|
|
2016-07-21 16:15:39 +01:00
|
|
|
|
namespace DiscImageChef.Filesystems
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
2016-07-28 22:25:26 +01:00
|
|
|
|
// Information from Apple ProDOS 8 Technical Reference
|
2016-07-21 16:15:39 +01:00
|
|
|
|
public class ProDOSPlugin : Filesystem
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
2017-12-22 08:43:22 +00:00
|
|
|
|
const byte EMPTY_STORAGE_TYPE = 0x00;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// A file that occupies one block or less
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2017-12-22 08:43:22 +00:00
|
|
|
|
const byte SEEDLING_FILE_TYPE = 0x01;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// A file that occupies between 2 and 256 blocks
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2017-12-22 08:43:22 +00:00
|
|
|
|
const byte SAPLING_FILE_TYPE = 0x02;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// A file that occupies between 257 and 32768 blocks
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2017-12-22 08:43:22 +00:00
|
|
|
|
const byte TREE_FILE_TYPE = 0x03;
|
|
|
|
|
|
const byte PASCAL_AREA_TYPE = 0x04;
|
|
|
|
|
|
const byte SUBDIRECTORY_TYPE = 0x0D;
|
|
|
|
|
|
const byte SUBDIRECTORY_HEADER_TYPE = 0x0E;
|
|
|
|
|
|
const byte ROOT_DIRECTORY_TYPE = 0x0F;
|
|
|
|
|
|
|
|
|
|
|
|
const byte VERSION1 = 0x00;
|
|
|
|
|
|
|
|
|
|
|
|
const uint YEAR_MASK = 0xFE000000;
|
|
|
|
|
|
const uint MONTH_MASK = 0x1E00000;
|
|
|
|
|
|
const uint DAY_MASK = 0x1F0000;
|
|
|
|
|
|
const uint HOUR_MASK = 0x1F00;
|
|
|
|
|
|
const uint MINUTE_MASK = 0x3F;
|
|
|
|
|
|
|
|
|
|
|
|
const byte DESTROY_ATTRIBUTE = 0x80;
|
|
|
|
|
|
const byte RENAME_ATTRIBUTE = 0x40;
|
|
|
|
|
|
const byte BACKUP_ATTRIBUTE = 0x20;
|
|
|
|
|
|
const byte WRITE_ATTRIBUTE = 0x02;
|
|
|
|
|
|
const byte READ_ATTRIBUTE = 0x01;
|
|
|
|
|
|
const byte RESERVED_ATTRIBUTE_MASK = 0x1C;
|
|
|
|
|
|
|
|
|
|
|
|
const byte STORAGE_TYPE_MASK = 0xF0;
|
|
|
|
|
|
const byte NAME_LENGTH_MASK = 0x0F;
|
|
|
|
|
|
const byte ENTRY_LENGTH = 0x27;
|
|
|
|
|
|
const byte ENTRIES_PER_BLOCK = 0x0D;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2015-10-05 20:04:05 +01:00
|
|
|
|
public ProDOSPlugin()
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
|
|
|
|
|
Name = "Apple ProDOS filesystem";
|
2017-12-22 08:43:22 +00:00
|
|
|
|
PluginUuid = new Guid("43874265-7B8A-4739-BCF7-07F80D5932BF");
|
2017-12-21 14:30:38 +00:00
|
|
|
|
CurrentEncoding = new LisaRoman();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-12 23:54:02 +01:00
|
|
|
|
public ProDOSPlugin(Encoding encoding)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "Apple ProDOS filesystem";
|
2017-12-22 08:43:22 +00:00
|
|
|
|
PluginUuid = new Guid("43874265-7B8A-4739-BCF7-07F80D5932BF");
|
2017-10-12 23:54:02 +01:00
|
|
|
|
// TODO: Until Apple ][ encoding is implemented
|
2017-12-21 14:30:38 +00:00
|
|
|
|
CurrentEncoding = new LisaRoman();
|
2017-10-12 23:54:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
public ProDOSPlugin(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
2016-07-27 13:32:45 +01:00
|
|
|
|
{
|
|
|
|
|
|
Name = "Apple ProDOS filesystem";
|
2017-12-22 08:43:22 +00:00
|
|
|
|
PluginUuid = new Guid("43874265-7B8A-4739-BCF7-07F80D5932BF");
|
2017-07-26 12:25:18 +01:00
|
|
|
|
// TODO: Until Apple ][ encoding is implemented
|
2017-12-21 14:30:38 +00:00
|
|
|
|
CurrentEncoding = new LisaRoman();
|
2016-07-27 13:32:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(partition.Length < 3) return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
// Blocks 0 and 1 are boot code
|
2017-07-19 16:37:11 +01:00
|
|
|
|
byte[] rootDirectoryKeyBlock = imagePlugin.ReadSector(2 + partition.Start);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
bool APMFromHDDOnCD = false;
|
|
|
|
|
|
|
2017-12-26 02:51:10 +00:00
|
|
|
|
if(imagePlugin.ImageInfo.SectorSize == 2352 || imagePlugin.ImageInfo.SectorSize == 2448 ||
|
|
|
|
|
|
imagePlugin.ImageInfo.SectorSize == 2048)
|
2017-07-20 13:14:12 +01:00
|
|
|
|
{
|
|
|
|
|
|
byte[] tmp = imagePlugin.ReadSectors(partition.Start, 2);
|
|
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}.Where(offset =>
|
|
|
|
|
|
BitConverter
|
|
|
|
|
|
.ToUInt16(tmp,
|
|
|
|
|
|
offset) ==
|
|
|
|
|
|
0 &&
|
|
|
|
|
|
(byte)
|
|
|
|
|
|
((tmp[offset + 0x04] &
|
|
|
|
|
|
STORAGE_TYPE_MASK) >>
|
|
|
|
|
|
4) ==
|
|
|
|
|
|
ROOT_DIRECTORY_TYPE &&
|
|
|
|
|
|
tmp[offset + 0x23] ==
|
|
|
|
|
|
ENTRY_LENGTH &&
|
|
|
|
|
|
tmp[offset + 0x24] ==
|
|
|
|
|
|
ENTRIES_PER_BLOCK))
|
|
|
|
|
|
{
|
2017-12-21 07:08:26 +00:00
|
|
|
|
Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200);
|
|
|
|
|
|
APMFromHDDOnCD = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-07-20 13:14:12 +01:00
|
|
|
|
}
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2016-07-28 22:25:26 +01:00
|
|
|
|
ushort prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0);
|
2016-09-12 01:13:39 +01:00
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "prePointer = {0}", prePointer);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(prePointer != 0) return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
byte storageType = (byte)((rootDirectoryKeyBlock[0x04] & STORAGE_TYPE_MASK) >> 4);
|
|
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "storage_type = {0}", storageType);
|
|
|
|
|
|
if(storageType != ROOT_DIRECTORY_TYPE) return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
byte entryLength = rootDirectoryKeyBlock[0x23];
|
|
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "entry_length = {0}", entryLength);
|
|
|
|
|
|
if(entryLength != ENTRY_LENGTH) return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
byte entriesPerBlock = rootDirectoryKeyBlock[0x24];
|
|
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "entries_per_block = {0}", entriesPerBlock);
|
|
|
|
|
|
if(entriesPerBlock != ENTRIES_PER_BLOCK) return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
ushort bitMapPointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27);
|
|
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "bit_map_pointer = {0}", bitMapPointer);
|
|
|
|
|
|
if(bitMapPointer > partition.End) return false;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
ushort totalBlocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29);
|
|
|
|
|
|
if(APMFromHDDOnCD) totalBlocks /= 4;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", totalBlocks, partition.End,
|
|
|
|
|
|
partition.Start, totalBlocks <= partition.End - partition.Start + 1);
|
|
|
|
|
|
return totalBlocks <= partition.End - partition.Start + 1;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
|
|
|
|
|
StringBuilder sbInformation = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
// Blocks 0 and 1 are boot code
|
2017-07-19 16:37:11 +01:00
|
|
|
|
byte[] rootDirectoryKeyBlockBytes = imagePlugin.ReadSector(2 + partition.Start);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-07-20 13:14:12 +01:00
|
|
|
|
bool APMFromHDDOnCD = false;
|
|
|
|
|
|
|
2017-12-26 02:51:10 +00:00
|
|
|
|
if(imagePlugin.ImageInfo.SectorSize == 2352 || imagePlugin.ImageInfo.SectorSize == 2448 ||
|
|
|
|
|
|
imagePlugin.ImageInfo.SectorSize == 2048)
|
2017-07-20 13:14:12 +01:00
|
|
|
|
{
|
|
|
|
|
|
byte[] tmp = imagePlugin.ReadSectors(partition.Start, 2);
|
|
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00}.Where(offset =>
|
|
|
|
|
|
BitConverter
|
|
|
|
|
|
.ToUInt16(tmp,
|
|
|
|
|
|
offset) ==
|
|
|
|
|
|
0 &&
|
|
|
|
|
|
(byte)
|
|
|
|
|
|
((tmp[offset + 0x04] &
|
|
|
|
|
|
STORAGE_TYPE_MASK) >>
|
|
|
|
|
|
4) ==
|
|
|
|
|
|
ROOT_DIRECTORY_TYPE &&
|
|
|
|
|
|
tmp[offset + 0x23] ==
|
|
|
|
|
|
ENTRY_LENGTH &&
|
|
|
|
|
|
tmp[offset + 0x24] ==
|
|
|
|
|
|
ENTRIES_PER_BLOCK))
|
|
|
|
|
|
{
|
2017-12-21 07:08:26 +00:00
|
|
|
|
Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200);
|
|
|
|
|
|
APMFromHDDOnCD = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-07-20 13:14:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
ProDOSRootDirectoryKeyBlock rootDirectoryKeyBlock =
|
|
|
|
|
|
new ProDOSRootDirectoryKeyBlock {header = new ProDOSRootDirectoryHeader()};
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
rootDirectoryKeyBlock.zero = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x00);
|
|
|
|
|
|
rootDirectoryKeyBlock.next_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x02);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.storage_type =
|
2017-12-22 08:43:22 +00:00
|
|
|
|
(byte)((rootDirectoryKeyBlockBytes[0x04] & STORAGE_TYPE_MASK) >> 4);
|
|
|
|
|
|
rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & NAME_LENGTH_MASK);
|
|
|
|
|
|
byte[] temporal = new byte[rootDirectoryKeyBlock.header.name_length];
|
2015-03-22 07:32:40 +00:00
|
|
|
|
Array.Copy(rootDirectoryKeyBlockBytes, 0x05, temporal, 0, rootDirectoryKeyBlock.header.name_length);
|
2017-06-06 21:23:20 +01:00
|
|
|
|
rootDirectoryKeyBlock.header.volume_name = CurrentEncoding.GetString(temporal);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
rootDirectoryKeyBlock.header.reserved = BitConverter.ToUInt64(rootDirectoryKeyBlockBytes, 0x14);
|
|
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
ushort tempTimestampLeft = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1C);
|
|
|
|
|
|
ushort tempTimestampRight = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1E);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
|
|
|
|
|
bool dateCorrect;
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2017-12-22 08:43:22 +00:00
|
|
|
|
uint tempTimestamp = (uint)((tempTimestampLeft << 16) + tempTimestampRight);
|
|
|
|
|
|
int year = (int)((tempTimestamp & YEAR_MASK) >> 25);
|
|
|
|
|
|
int month = (int)((tempTimestamp & MONTH_MASK) >> 21);
|
|
|
|
|
|
int day = (int)((tempTimestamp & DAY_MASK) >> 16);
|
|
|
|
|
|
int hour = (int)((tempTimestamp & HOUR_MASK) >> 8);
|
|
|
|
|
|
int minute = (int)(tempTimestamp & MINUTE_MASK);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
year += 1900;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(year < 1940) year += 100;
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_left = 0x{0:X4}", tempTimestampLeft);
|
|
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_right = 0x{0:X4}", tempTimestampRight);
|
|
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp = 0x{0:X8}", tempTimestamp);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin",
|
|
|
|
|
|
"Datetime field year {0}, month {1}, day {2}, hour {3}, minute {4}.", year,
|
|
|
|
|
|
month, day, hour, minute);
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
|
|
|
|
|
rootDirectoryKeyBlock.header.creation_time = new DateTime(year, month, day, hour, minute, 0);
|
|
|
|
|
|
dateCorrect = true;
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
catch(ArgumentOutOfRangeException) { dateCorrect = false; }
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
rootDirectoryKeyBlock.header.version = rootDirectoryKeyBlockBytes[0x20];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.min_version = rootDirectoryKeyBlockBytes[0x21];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.access = rootDirectoryKeyBlockBytes[0x22];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.entry_length = rootDirectoryKeyBlockBytes[0x23];
|
|
|
|
|
|
rootDirectoryKeyBlock.header.entries_per_block = rootDirectoryKeyBlockBytes[0x24];
|
|
|
|
|
|
|
|
|
|
|
|
rootDirectoryKeyBlock.header.file_count = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x25);
|
|
|
|
|
|
rootDirectoryKeyBlock.header.bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x27);
|
|
|
|
|
|
rootDirectoryKeyBlock.header.total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x29);
|
|
|
|
|
|
|
2017-07-20 13:14:12 +01:00
|
|
|
|
if(APMFromHDDOnCD)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sbInformation.AppendLine("ProDOS uses 512 bytes/sector while devices uses 2048 bytes/sector.")
|
|
|
|
|
|
.AppendLine();
|
2017-07-20 13:14:12 +01:00
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
if(rootDirectoryKeyBlock.header.version != VERSION1 || rootDirectoryKeyBlock.header.min_version != VERSION1)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
{
|
|
|
|
|
|
sbInformation.AppendLine("Warning! Detected unknown ProDOS version ProDOS filesystem.");
|
|
|
|
|
|
sbInformation.AppendLine("All of the following information may be incorrect");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if(rootDirectoryKeyBlock.header.version == VERSION1)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("ProDOS version 1 used to create this volume.");
|
|
|
|
|
|
else
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sbInformation.AppendFormat("Unknown ProDOS version with field {0} used to create this volume.",
|
|
|
|
|
|
rootDirectoryKeyBlock.header.version).AppendLine();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if(rootDirectoryKeyBlock.header.min_version == VERSION1)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("ProDOS version 1 at least required for reading this volume.");
|
|
|
|
|
|
else
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sbInformation
|
|
|
|
|
|
.AppendFormat("Unknown ProDOS version with field {0} is at least required for reading this volume.",
|
|
|
|
|
|
rootDirectoryKeyBlock.header.min_version).AppendLine();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
sbInformation.AppendFormat("Volume name is {0}", rootDirectoryKeyBlock.header.volume_name).AppendLine();
|
2017-07-20 13:14:12 +01:00
|
|
|
|
if(dateCorrect)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sbInformation.AppendFormat("Volume created on {0}", rootDirectoryKeyBlock.header.creation_time)
|
|
|
|
|
|
.AppendLine();
|
|
|
|
|
|
sbInformation.AppendFormat("{0} bytes per directory entry", rootDirectoryKeyBlock.header.entry_length)
|
|
|
|
|
|
.AppendLine();
|
|
|
|
|
|
sbInformation
|
|
|
|
|
|
.AppendFormat("{0} entries per directory block", rootDirectoryKeyBlock.header.entries_per_block)
|
|
|
|
|
|
.AppendLine();
|
|
|
|
|
|
sbInformation.AppendFormat("{0} files in root directory", rootDirectoryKeyBlock.header.file_count)
|
|
|
|
|
|
.AppendLine();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendFormat("{0} blocks in volume", rootDirectoryKeyBlock.header.total_blocks).AppendLine();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
sbInformation.AppendFormat("Bitmap starts at block {0}", rootDirectoryKeyBlock.header.bit_map_pointer)
|
|
|
|
|
|
.AppendLine();
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & READ_ATTRIBUTE) == READ_ATTRIBUTE)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("Volume can be read");
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & WRITE_ATTRIBUTE) == WRITE_ATTRIBUTE)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("Volume can be written");
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & RENAME_ATTRIBUTE) == RENAME_ATTRIBUTE)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("Volume can be renamed");
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & DESTROY_ATTRIBUTE) == DESTROY_ATTRIBUTE)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("Volume can be destroyed");
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & BACKUP_ATTRIBUTE) == BACKUP_ATTRIBUTE)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
sbInformation.AppendLine("Volume must be backed up");
|
|
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
if((rootDirectoryKeyBlock.header.access & RESERVED_ATTRIBUTE_MASK) != 0)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("ProDOS plugin", "Reserved attributes are set: {0:X2}",
|
|
|
|
|
|
rootDirectoryKeyBlock.header.access);
|
2015-03-22 07:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
information = sbInformation.ToString();
|
|
|
|
|
|
|
2017-12-22 08:43:22 +00:00
|
|
|
|
XmlFsType = new FileSystemType();
|
|
|
|
|
|
XmlFsType.VolumeName = rootDirectoryKeyBlock.header.volume_name;
|
2017-07-20 13:14:12 +01:00
|
|
|
|
if(dateCorrect)
|
2015-12-06 05:09:31 +00:00
|
|
|
|
{
|
2017-12-22 08:43:22 +00:00
|
|
|
|
XmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time;
|
|
|
|
|
|
XmlFsType.CreationDateSpecified = true;
|
2015-12-06 05:09:31 +00:00
|
|
|
|
}
|
2017-12-22 08:43:22 +00:00
|
|
|
|
XmlFsType.Files = rootDirectoryKeyBlock.header.file_count;
|
|
|
|
|
|
XmlFsType.FilesSpecified = true;
|
|
|
|
|
|
XmlFsType.Clusters = rootDirectoryKeyBlock.header.total_blocks;
|
|
|
|
|
|
XmlFsType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize /
|
|
|
|
|
|
(ulong)XmlFsType.Clusters);
|
|
|
|
|
|
XmlFsType.Type = "ProDOS";
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-07-21 17:16:08 +01:00
|
|
|
|
public override Errno Mount()
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-07-22 00:43:22 +01:00
|
|
|
|
public override Errno Mount(bool debug)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-07-21 17:16:08 +01:00
|
|
|
|
public override Errno Unmount()
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno GetAttributes(string path, ref FileAttributes attributes)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno ListXAttr(string path, ref List<string> xattrs)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno Read(string path, long offset, long size, ref byte[] buf)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno ReadDir(string path, ref List<string> contents)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno StatFs(ref FileSystemInfo stat)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno Stat(string path, ref FileEntryInfo stat)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Errno ReadLink(string path, ref string dest)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Errno.NotImplemented;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// ProDOS directory entry, decoded structure
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
struct ProDOSEntry
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Type of file pointed by this entry
|
|
|
|
|
|
/// Offset 0x00, mask 0xF0
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte storage_type;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Length of name_length pascal string
|
|
|
|
|
|
/// Offset 0x00, mask 0x0F
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte name_length;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Pascal string of file name
|
|
|
|
|
|
/// Offset 0x01, 15 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string file_name;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Descriptor of internal structure of the file
|
|
|
|
|
|
/// Offset 0x10, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte file_type;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Block address of master index block for tree files.
|
|
|
|
|
|
/// Block address of index block for sapling files.
|
|
|
|
|
|
/// Block address of block for seedling files.
|
|
|
|
|
|
/// Offset 0x11, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort key_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Blocks used by file or directory, including index blocks.
|
|
|
|
|
|
/// Offset 0x13, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort blocks_used;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Size of file in bytes
|
|
|
|
|
|
/// Offset 0x15, 3 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public uint EOF;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// File creation datetime
|
|
|
|
|
|
/// Offset 0x18, 4 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTime creation_time;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Version of ProDOS that created this file
|
|
|
|
|
|
/// Offset 0x1C, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte version;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Minimum version of ProDOS needed to access this file
|
|
|
|
|
|
/// Offset 0x1D, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte min_version;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// File permissions
|
|
|
|
|
|
/// Offset 0x1E, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte access;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// General purpose field to store additional information about file format
|
|
|
|
|
|
/// Offset 0x1F, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort aux_type;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// File last modification date time
|
|
|
|
|
|
/// Offset 0x21, 4 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTime last_mod;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Block address pointer to key block of the directory containing this entry
|
|
|
|
|
|
/// Offset 0x25, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort header_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSRootDirectoryHeader
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Constant 0x0F
|
|
|
|
|
|
/// Offset 0x04, mask 0xF0
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte storage_type;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Length of volume_name pascal string
|
|
|
|
|
|
/// Offset 0x04, mask 0x0F
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte name_length;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// The name of the volume.
|
|
|
|
|
|
/// Offset 0x05, 15 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string volume_name;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Reserved for future expansion
|
|
|
|
|
|
/// Offset 0x14, 8 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ulong reserved;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Creation time of the volume
|
|
|
|
|
|
/// Offset 0x1C, 4 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTime creation_time;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Version number of the volume format
|
|
|
|
|
|
/// Offset 0x20, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte version;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Reserved for future use
|
|
|
|
|
|
/// Offset 0x21, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte min_version;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Permissions for the volume
|
|
|
|
|
|
/// Offset 0x22, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte access;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Length of an entry in this directory
|
|
|
|
|
|
/// Const 0x27
|
|
|
|
|
|
/// Offset 0x23, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte entry_length;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Number of entries per block
|
|
|
|
|
|
/// Const 0x0D
|
|
|
|
|
|
/// Offset 0x24, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte entries_per_block;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Number of active files in this directory
|
|
|
|
|
|
/// Offset 0x25, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort file_count;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Block address of the first block of the volume's bitmap,
|
|
|
|
|
|
/// one for every 4096 blocks or fraction
|
|
|
|
|
|
/// Offset 0x27, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort bit_map_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Total number of blocks in the volume
|
|
|
|
|
|
/// Offset 0x29, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort total_blocks;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSDirectoryHeader
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Constant 0x0E
|
|
|
|
|
|
/// Offset 0x04, mask 0xF0
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte storage_type;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Length of volume_name pascal string
|
|
|
|
|
|
/// Offset 0x04, mask 0x0F
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte name_length;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// The name of the directory.
|
|
|
|
|
|
/// Offset 0x05, 15 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string directory_name;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Reserved for future expansion
|
|
|
|
|
|
/// Offset 0x14, 8 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ulong reserved;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Creation time of the volume
|
|
|
|
|
|
/// Offset 0x1C, 4 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTime creation_time;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Version number of the volume format
|
|
|
|
|
|
/// Offset 0x20, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte version;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Reserved for future use
|
|
|
|
|
|
/// Offset 0x21, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte min_version;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Permissions for the volume
|
|
|
|
|
|
/// Offset 0x22, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte access;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Length of an entry in this directory
|
|
|
|
|
|
/// Const 0x27
|
|
|
|
|
|
/// Offset 0x23, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte entry_length;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Number of entries per block
|
|
|
|
|
|
/// Const 0x0D
|
|
|
|
|
|
/// Offset 0x24, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte entries_per_block;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Number of active files in this directory
|
|
|
|
|
|
/// Offset 0x25, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort file_count;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Block address of parent directory block that contains this entry
|
|
|
|
|
|
/// Offset 0x27, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort parent_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Entry number within the block indicated in parent_pointer
|
|
|
|
|
|
/// Offset 0x29, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte parent_entry_number;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Length of the entry that holds this directory, in the parent entry
|
|
|
|
|
|
/// Const 0x27
|
|
|
|
|
|
/// Offset 0x2A, 1 byte
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public byte parent_entry_length;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSDirectoryKeyBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Always 0
|
|
|
|
|
|
/// Offset 0x00, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort zero;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Pointer to next directory block, 0 if last
|
|
|
|
|
|
/// Offset 0x02, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort next_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Directory header
|
|
|
|
|
|
/// Offset 0x04, 39 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ProDOSDirectoryHeader header;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Directory entries
|
|
|
|
|
|
/// Offset 0x2F, 39 bytes each, 12 entries
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ProDOSEntry[] entries;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSRootDirectoryKeyBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Always 0
|
|
|
|
|
|
/// Offset 0x00, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort zero;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Pointer to next directory block, 0 if last
|
|
|
|
|
|
/// Offset 0x02, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort next_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Directory header
|
|
|
|
|
|
/// Offset 0x04, 39 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ProDOSRootDirectoryHeader header;
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Directory entries
|
|
|
|
|
|
/// Offset 0x2F, 39 bytes each, 12 entries
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ProDOSEntry[] entries;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSDirectoryBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Pointer to previous directory block
|
|
|
|
|
|
/// Offset 0x00, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort zero;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Pointer to next directory block, 0 if last
|
|
|
|
|
|
/// Offset 0x02, 2 bytes
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort next_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Directory entries
|
|
|
|
|
|
/// Offset 0x2F, 39 bytes each, 13 entries
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ProDOSEntry[] entries;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSIndexBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Up to 256 pointers to blocks, 0 to indicate the block is sparsed (non-allocated)
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort[] block_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct ProDOSMasterIndexBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2017-12-24 02:37:41 +00:00
|
|
|
|
/// Up to 128 pointers to index blocks
|
2015-03-22 07:32:40 +00:00
|
|
|
|
/// </summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
|
public ushort[] index_block_pointer;
|
2015-03-22 07:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|