Files
Aaru/Aaru.Images/TeleDisk/Structs.cs

130 lines
4.3 KiB
C#
Raw Normal View History

// /***************************************************************************
2020-02-27 12:31:25 +00:00
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains structures for Sydex TeleDisk disk images.
//
// --[ 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
// ****************************************************************************/
2022-03-06 13:29:38 +00:00
namespace Aaru.DiscImages;
public sealed partial class TeleDisk
{
2023-10-03 23:34:59 +01:00
#region Nested type: CommentBlockHeader
struct CommentBlockHeader
{
/// <summary>CRC of comment block after crc field</summary>
public ushort Crc;
/// <summary>Length of comment</summary>
public ushort Length;
public byte Year;
public byte Month;
public byte Day;
public byte Hour;
public byte Minute;
public byte Second;
}
#endregion
#region Nested type: DataHeader
struct DataHeader
{
/// <summary>Size of all data (encoded) + next field (1)</summary>
public ushort DataSize;
/// <summary>Encoding used for data block</summary>
public byte DataEncoding;
}
#endregion
#region Nested type: Header
2022-03-06 13:29:38 +00:00
struct Header
{
2022-03-06 13:29:38 +00:00
/// <summary>"TD" or "td" depending on compression</summary>
public ushort Signature;
/// <summary>Sequence, but TeleDisk seems to complaing if != 0</summary>
public byte Sequence;
/// <summary>Random, same byte for all disks in the same set</summary>
public byte DiskSet;
/// <summary>TeleDisk version, major in high nibble, minor in low nibble</summary>
public byte Version;
/// <summary>Data rate</summary>
public byte DataRate;
/// <summary>BIOS drive type</summary>
public byte DriveType;
/// <summary>Stepping used</summary>
public byte Stepping;
/// <summary>If set means image only allocates sectors marked in-use by FAT12</summary>
public byte DosAllocation;
/// <summary>Sides of disk</summary>
public byte Sides;
/// <summary>CRC of all the previous</summary>
public ushort Crc;
}
2023-10-03 23:34:59 +01:00
#endregion
2023-10-03 23:34:59 +01:00
#region Nested type: SectorHeader
2022-03-06 13:29:38 +00:00
struct SectorHeader
{
/// <summary>Cylinder as stored on sector address mark</summary>
public byte Cylinder;
/// <summary>Head as stored on sector address mark</summary>
public byte Head;
/// <summary>Sector number as stored on sector address mark</summary>
public byte SectorNumber;
/// <summary>Sector size</summary>
public byte SectorSize;
/// <summary>Sector flags</summary>
public byte Flags;
/// <summary>Lower byte of TeleDisk CRC of sector header, data header and data block</summary>
public byte Crc;
}
2023-10-03 23:34:59 +01:00
#endregion
#region Nested type: TrackHeader
struct TrackHeader
2022-03-06 13:29:38 +00:00
{
2023-10-03 23:34:59 +01:00
/// <summary>Sectors in the track, 0xFF if end of disk image (there is no spoon)</summary>
public byte Sectors;
/// <summary>Cylinder the head was on</summary>
public byte Cylinder;
/// <summary>Head/side used</summary>
public byte Head;
/// <summary>Lower byte of CRC of previous fields</summary>
public byte Crc;
}
2023-10-03 23:34:59 +01:00
#endregion
}