// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : AppleSony.cs // Author(s) : Natalia Portillo // // Component : Device structures decoders. // // --[ Description ] ---------------------------------------------------------- // // Decodes Apple/Sony floppy structures. // // --[ 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-2016 Natalia Portillo // ****************************************************************************/ using System; using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { // Information from: // Inside Macintosh, Volume II, ISBN 0-201-17732-3 /// /// Methods and structures for Apple Sony GCR floppy decoding /// public static class AppleSony { /// /// GCR-encoded Apple Sony GCR floppy track /// public struct RawTrack { /// /// Track preamble, set to self-sync 0xFF, 36 bytes /// public byte[] gap; public RawSector[] sectors; } /// /// GCR-encoded Apple Sony GCR floppy sector /// public struct RawSector { /// /// Address field /// public RawAddressField addressField; /// /// Track preamble, set to self-sync 0xFF, 6 bytes /// public byte[] innerGap; /// /// Data field /// public RawDataField dataField; /// /// Track preamble, set to self-sync 0xFF, unknown size /// public byte[] gap; } /// /// GCR-encoded Apple Sony GCR floppy sector address field /// public struct RawAddressField { /// /// Always 0xD5, 0xAA, 0x96 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// /// Encoded (decodedTrack & 0x3F) /// public byte track; /// /// Encoded sector number /// public byte sector; /// /// Encoded side number /// public byte side; /// /// Disk format /// public AppleEncodedFormat format; /// /// Checksum /// public byte checksum; /// /// Always 0xDE, 0xAA /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue; } /// /// GCR-encoded Apple ][ GCR floppy sector data field /// public struct RawDataField { /// /// Always 0xD5, 0xAA, 0xAD /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// /// Spare, usually /// public byte spare; /// /// Encoded data bytes. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)] public byte[] data; /// /// Checksum /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] checksum; /// /// Always 0xDE, 0xAA /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue; } } }