2018-07-23 23:25:43 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2025-08-14 02:49:52 +01:00
|
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
|
namespace Aaru.DiscImages
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
2020-07-22 13:20:25 +01:00
|
|
|
|
public sealed partial class TeleDisk
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
2020-11-11 04:19:18 +00:00
|
|
|
|
struct Header
|
2018-07-23 23:25:43 +01: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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-11 04:19:18 +00:00
|
|
|
|
struct CommentBlockHeader
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-11 04:19:18 +00:00
|
|
|
|
struct TrackHeader
|
2018-07-23 23:25:43 +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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-11 04:19:18 +00:00
|
|
|
|
struct SectorHeader
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-11-11 04:19:18 +00:00
|
|
|
|
struct DataHeader
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>Size of all data (encoded) + next field (1)</summary>
|
|
|
|
|
|
public ushort DataSize;
|
|
|
|
|
|
/// <summary>Encoding used for data block</summary>
|
|
|
|
|
|
public byte DataEncoding;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|