2017-09-21 21:20:53 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-09-21 21:20:53 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
2022-12-07 13:07:31 +00:00
|
|
|
|
// Filename : Structs.cs
|
2017-09-21 21:20:53 +01:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : MicroDOS filesystem plugin
|
2017-09-21 21:20:53 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-12-03 16:07:10 +00:00
|
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
2017-09-21 21:20:53 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
// ReSharper disable UnusedType.Local
|
|
|
|
|
|
// ReSharper disable UnusedMember.Local
|
|
|
|
|
|
|
2017-09-21 21:20:53 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Implements detection for the MicroDOS filesystem. Information from http://www.owg.ru/mkt/BK/MKDOS.TXT Thanks
|
|
|
|
|
|
/// to tarlabnor for translating it
|
|
|
|
|
|
/// </summary>
|
2022-12-07 13:07:31 +00:00
|
|
|
|
public sealed partial class MicroDOS
|
2017-09-21 21:20:53 +01:00
|
|
|
|
{
|
2023-10-03 23:22:08 +01:00
|
|
|
|
#region Nested type: Block0
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Followed by directory entries
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
readonly struct Block0
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>BK starts booting here</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
|
|
|
|
|
public readonly byte[] bootCode;
|
|
|
|
|
|
/// <summary>Number of files in directory</summary>
|
|
|
|
|
|
public readonly ushort files;
|
|
|
|
|
|
/// <summary>Total number of blocks in files of the directory</summary>
|
|
|
|
|
|
public readonly ushort usedBlocks;
|
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 228)]
|
|
|
|
|
|
public readonly byte[] unknown;
|
|
|
|
|
|
/// <summary>Ownership label (label that shows it belongs to Micro DOS format)</summary>
|
|
|
|
|
|
public readonly ushort label;
|
|
|
|
|
|
/// <summary>MK-DOS directory format label</summary>
|
|
|
|
|
|
public readonly ushort mklabel;
|
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
|
|
|
|
|
|
public readonly byte[] unknown2;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Disk size in blocks (absolute value for the system unlike NORD, NORTON etc.) that doesn't use two fixed values
|
|
|
|
|
|
/// 40 or 80 tracks, but i.e. if you drive works with 76 tracks this field will contain an appropriate number of blocks
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public readonly ushort blocks;
|
|
|
|
|
|
/// <summary> Number of the first file's block. Value is changable</summary>
|
|
|
|
|
|
public readonly ushort firstUsedBlock;
|
|
|
|
|
|
/// <summary>Unknown</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
|
|
|
|
|
public readonly byte[] unknown3;
|
|
|
|
|
|
}
|
2017-09-21 21:20:53 +01:00
|
|
|
|
|
2023-10-03 23:22:08 +01:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Nested type: DirectoryEntry
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
readonly struct DirectoryEntry
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>File status</summary>
|
|
|
|
|
|
public readonly byte status;
|
|
|
|
|
|
/// <summary>Directory number (0 - root)</summary>
|
|
|
|
|
|
public readonly byte directory;
|
|
|
|
|
|
/// <summary>File name 14. symbols in ASCII KOI8</summary>
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
|
|
|
|
|
public readonly byte[] filename;
|
|
|
|
|
|
/// <summary>Block number</summary>
|
|
|
|
|
|
public readonly ushort blockNo;
|
|
|
|
|
|
/// <summary>Length in blocks</summary>
|
|
|
|
|
|
public readonly ushort blocks;
|
|
|
|
|
|
/// <summary>Address</summary>
|
|
|
|
|
|
public readonly ushort address;
|
|
|
|
|
|
/// <summary>Length</summary>
|
|
|
|
|
|
public readonly ushort length;
|
|
|
|
|
|
}
|
2023-10-03 23:22:08 +01:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
2017-09-21 21:20:53 +01:00
|
|
|
|
}
|