// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // 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-2020 Natalia Portillo // ****************************************************************************/ using System.Runtime.InteropServices; using DiscImageChef.Decoders.Floppy; namespace DiscImageChef.DiscImages { public partial class Cpcdsk { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CpcDiskInfo { /// /// Magic number, "MV - CPC" in old files, "EXTENDED CPC DSK File" in extended ones /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)] public byte[] magic; /// /// Second part of magic, should be "\r\nDisk-Info\r\n" in all, but some emulators write spaces instead. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] public byte[] magic2; /// /// Creator application (can be null) /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] creator; /// /// Tracks /// public byte tracks; /// /// Sides /// public 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 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 byte[] tracksizeTable; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CpcTrackInfo { /// /// Magic number, "Track-Info\r\n" /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] magic; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] carriageReturn; /// /// Padding /// public uint padding; /// /// Track number /// public byte track; /// /// Side number /// public byte side; /// /// Controller data rate /// public byte dataRate; /// /// Recording mode /// public byte recordingMode; /// /// Bytes per sector /// public IBMSectorSizeCode bps; /// /// How many sectors in this track /// public byte sectors; /// /// GAP#3 /// public byte gap3; /// /// Filler /// public byte filler; /// /// Informatino for up to 32 sectors /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public CpcSectorInfo[] sectorsInfo; } /// /// Sector information /// [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CpcSectorInfo { /// /// Track number from address mark /// public byte track; /// /// Side number from address mark /// public byte side; /// /// Sector ID from address mark /// public byte id; /// /// Sector size from address mark /// public IBMSectorSizeCode size; /// /// ST1 register from controller /// public byte st1; /// /// ST2 register from controller /// public 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 ushort len; } } }