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 : Constants.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Disk image plugins.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Contains constants 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
|
|
2023-10-06 01:16:28 +01:00
|
|
|
|
namespace Aaru.Images;
|
2022-11-15 15:58:43 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
|
|
|
|
|
public sealed partial class TeleDisk
|
2018-07-23 23:25:43 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// "TD" as little endian uint.
|
|
|
|
|
|
const ushort TD_MAGIC = 0x4454;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// "td" as little endian uint. Means whole file is compressed (aka Advanced Compression)
|
|
|
|
|
|
const ushort TD_ADV_COMP_MAGIC = 0x6474;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// DataRates
|
|
|
|
|
|
const byte DATA_RATE_250_KBPS = 0x00;
|
|
|
|
|
|
const byte DATA_RATE_300_KBPS = 0x01;
|
|
|
|
|
|
const byte DATA_RATE_500_KBPS = 0x02;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// TeleDisk drive types
|
|
|
|
|
|
const byte DRIVE_TYPE_525_HD_DD_DISK = 0x00;
|
|
|
|
|
|
const byte DRIVE_TYPE_525_HD = 0x01;
|
|
|
|
|
|
const byte DRIVE_TYPE_525_DD = 0x02;
|
|
|
|
|
|
const byte DRIVE_TYPE_35_DD = 0x03;
|
|
|
|
|
|
const byte DRIVE_TYPE_35_HD = 0x04;
|
|
|
|
|
|
const byte DRIVE_TYPE_8_INCH = 0x05;
|
|
|
|
|
|
const byte DRIVE_TYPE_35_ED = 0x06;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Stepping
|
|
|
|
|
|
const byte STEPPING_SINGLE = 0x00;
|
|
|
|
|
|
const byte STEPPING_DOUBLE = 0x01;
|
|
|
|
|
|
const byte STEPPING_EVEN_ONLY = 0x02;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// If this bit is set, there is a comment block
|
|
|
|
|
|
const byte COMMENT_BLOCK_PRESENT = 0x80;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// CRC polynomial
|
|
|
|
|
|
const ushort TELE_DISK_CRC_POLY = 0xA097;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Sector sizes table
|
|
|
|
|
|
const byte SECTOR_SIZE_128 = 0x00;
|
|
|
|
|
|
const byte SECTOR_SIZE_256 = 0x01;
|
|
|
|
|
|
const byte SECTOR_SIZE_512 = 0x02;
|
2021-08-17 21:23:10 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Flags
|
|
|
|
|
|
// Address mark repeats inside same track
|
|
|
|
|
|
const byte FLAGS_SECTOR_DUPLICATE = 0x01;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Sector gave CRC error on reading
|
|
|
|
|
|
const byte FLAGS_SECTOR_CRC_ERROR = 0x02;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Address mark indicates deleted sector
|
|
|
|
|
|
const byte FLAGS_SECTOR_DELETED = 0x04;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Sector skipped as FAT said it's unused
|
|
|
|
|
|
const byte FLAGS_SECTOR_SKIPPED = 0x10;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// There was an address mark, but no data following
|
|
|
|
|
|
const byte FLAGS_SECTOR_DATALESS = 0x20;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// There was data without address mark
|
|
|
|
|
|
const byte FLAGS_SECTOR_NO_ID = 0x40;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Data block encodings
|
|
|
|
|
|
// Data is copied as is
|
|
|
|
|
|
const byte DATA_BLOCK_COPY = 0x00;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Data is encoded as a pair of len.value uint16s
|
|
|
|
|
|
const byte DATA_BLOCK_PATTERN = 0x01;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// Data is encoded as RLE
|
|
|
|
|
|
const byte DATA_BLOCK_RLE = 0x02;
|
2018-07-23 23:25:43 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
const int BUFSZ = 512;
|
2023-10-03 23:34:59 +01:00
|
|
|
|
|
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
|
const byte SECTOR_SIZE_1K = 0x03;
|
|
|
|
|
|
const byte SECTOR_SIZE_2K = 0x04;
|
|
|
|
|
|
const byte SECTOR_SIZE_4K = 0x05;
|
|
|
|
|
|
const byte SECTOR_SIZE_8K = 0x06;
|
|
|
|
|
|
|
|
|
|
|
|
// ReSharper restore InconsistentNaming
|
2018-07-23 23:25:43 +01:00
|
|
|
|
}
|