// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Disk image plugins. // // --[ Description ] ---------------------------------------------------------- // // Contains structures for CPCEMU 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 . // // ---------------------------------------------------------------------------- // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ using System.Runtime.InteropServices; using Aaru.Decoders.Floppy; namespace Aaru.Images; public sealed partial class Cpcdsk { #region Nested type: DiskInfo [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct DiskInfo { /// Second part of magic, should be "Disk-Info\r\n" in all, but some emulators write spaces instead. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public readonly byte[] magic; /// Creator application (can be null) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public readonly byte[] creator; /// Tracks public readonly byte tracks; /// Sides public readonly byte sides; /// /// Size of a track including the 256 bytes header. Unused by extended format, as this format includes a table in /// the next field /// public readonly ushort tracksize; /// Size of each track in the extended format. 0 indicates track is not formatted and not present in image. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 204)] public readonly byte[] tracksizeTable; } #endregion #region Nested type: SectorInfo /// Sector information [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct SectorInfo { /// Track number from address mark public readonly byte track; /// Side number from address mark public readonly byte side; /// Sector ID from address mark public readonly byte id; /// Sector size from address mark public readonly IBMSectorSizeCode size; /// ST1 register from controller public readonly byte st1; /// ST2 register from controller public readonly byte st2; /// /// Length in bytes of this sector size. If it is bigger than expected sector size, it's a weak sector read /// several times. /// public readonly ushort len; } #endregion #region Nested type: TrackInfo [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct TrackInfo { /// Magic number, "Track-Info\r\n" [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public readonly byte[] magic; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public readonly byte[] carriageReturn; /// Padding public readonly uint padding; /// Track number public readonly byte track; /// Side number public readonly byte side; /// Controller data rate public readonly byte dataRate; /// Recording mode public readonly byte recordingMode; /// Bytes per sector public readonly IBMSectorSizeCode bps; /// How many sectors in this track public readonly byte sectors; /// GAP#3 public readonly byte gap3; /// Filler public readonly byte filler; /// Information for up to 32 sectors [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public readonly SectorInfo[] sectorsInfo; } #endregion }