diff --git a/DiscImageChef.Decoders/ChangeLog b/DiscImageChef.Decoders/ChangeLog index 065e485f8..a06dbe404 100644 --- a/DiscImageChef.Decoders/ChangeLog +++ b/DiscImageChef.Decoders/ChangeLog @@ -1,3 +1,16 @@ +2015-10-19 Natalia Portillo + + * Floppy/ISO.cs: + * Floppy/Amiga.cs: + * Floppy/Enums.cs: + * Floppy/Apple2.cs: + * Floppy/System34.cs: + * Floppy/Commodore.cs: + * Floppy/AppleSony.cs: + * Floppy/System3740.cs: + * Floppy/Perpendicular.cs: + Rename fields, methods and structs to more adequate names. + 2015-10-19 Natalia Portillo * Floppy/ISO.cs: diff --git a/DiscImageChef.Decoders/Floppy/Amiga.cs b/DiscImageChef.Decoders/Floppy/Amiga.cs index 6f1bea831..ffc4ec82a 100644 --- a/DiscImageChef.Decoders/Floppy/Amiga.cs +++ b/DiscImageChef.Decoders/Floppy/Amiga.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -44,7 +45,7 @@ namespace DiscImageChef.Decoders.Floppy /// public static class Amiga { - public struct CommodoreAmigaSector + public struct Sector { /// /// Set to 0x00 diff --git a/DiscImageChef.Decoders/Floppy/Apple2.cs b/DiscImageChef.Decoders/Floppy/Apple2.cs index 7147b5dc3..e80f51dcd 100644 --- a/DiscImageChef.Decoders/Floppy/Apple2.cs +++ b/DiscImageChef.Decoders/Floppy/Apple2.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -47,24 +48,24 @@ namespace DiscImageChef.Decoders.Floppy /// /// GCR-encoded Apple ][ GCR floppy track /// - public struct AppleOldGCRRawSectorRawTrack + public struct RawTrack { /// /// Track preamble, set to self-sync 0xFF, between 40 and 95 bytes /// public byte[] gap; - public AppleOldGCRRawSector[] sectors; + public RawSector[] sectors; } /// /// GCR-encoded Apple ][ GCR floppy sector /// - public struct AppleOldGCRRawSector + public struct RawSector { /// /// Address field /// - public AppleOldGCRRawAddressField addressField; + public RawDataField addressField; /// /// Track preamble, set to self-sync 0xFF, between 5 and 10 bytes /// @@ -72,7 +73,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Data field /// - public AppleOldGCRRawDataField dataField; + public RawDataField dataField; /// /// Track preamble, set to self-sync 0xFF, between 14 and 24 bytes /// @@ -82,7 +83,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// GCR-encoded Apple ][ GCR floppy sector address field /// - public struct AppleOldGCRRawAddressField + public struct RawAddressField { /// /// Always 0xD5, 0xAA, 0x96 @@ -127,7 +128,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// GCR-encoded Apple ][ GCR floppy sector data field /// - public struct AppleOldGCRRawDataField + public struct RawDataField { /// /// Always 0xD5, 0xAA, 0xAD diff --git a/DiscImageChef.Decoders/Floppy/AppleSony.cs b/DiscImageChef.Decoders/Floppy/AppleSony.cs index 1a904bce7..723152d52 100644 --- a/DiscImageChef.Decoders/Floppy/AppleSony.cs +++ b/DiscImageChef.Decoders/Floppy/AppleSony.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -50,24 +51,24 @@ namespace DiscImageChef.Decoders.Floppy /// /// GCR-encoded Apple Sony GCR floppy track /// - public struct AppleSonyGCRRawSectorRawTrack + public struct RawTrack { /// /// Track preamble, set to self-sync 0xFF, 36 bytes /// public byte[] gap; - public AppleSonyGCRRawSector[] sectors; + public RawSector[] sectors; } /// /// GCR-encoded Apple Sony GCR floppy sector /// - public struct AppleSonyGCRRawSector + public struct RawSector { /// /// Address field /// - public AppleSonyGCRRawAddressField addressField; + public RawAddressField addressField; /// /// Track preamble, set to self-sync 0xFF, 6 bytes /// @@ -75,7 +76,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Data field /// - public AppleSonyGCRRawDataField dataField; + public RawDataField dataField; /// /// Track preamble, set to self-sync 0xFF, unknown size /// @@ -85,7 +86,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// GCR-encoded Apple Sony GCR floppy sector address field /// - public struct AppleSonyGCRRawAddressField + public struct RawAddressField { /// /// Always 0xD5, 0xAA, 0x96 @@ -122,7 +123,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// GCR-encoded Apple ][ GCR floppy sector data field /// - public struct AppleSonyGCRRawDataField + public struct RawDataField { /// /// Always 0xD5, 0xAA, 0xAD @@ -130,7 +131,7 @@ namespace DiscImageChef.Decoders.Floppy [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue; /// - /// Spare, usually + /// Spare, usually /// public byte spare; /// diff --git a/DiscImageChef.Decoders/Floppy/Commodore.cs b/DiscImageChef.Decoders/Floppy/Commodore.cs index 7de147064..27f320e00 100644 --- a/DiscImageChef.Decoders/Floppy/Commodore.cs +++ b/DiscImageChef.Decoders/Floppy/Commodore.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -47,7 +48,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Decoded Commodore GCR sector header /// - public struct CommodoreSectorHeader + public struct SectorHeader { /// /// Always 0x08 @@ -78,7 +79,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Decoded Commodore GCR sector data /// - public struct CommodoreSectorData + public struct SectorData { /// /// Always 0x07 diff --git a/DiscImageChef.Decoders/Floppy/Enums.cs b/DiscImageChef.Decoders/Floppy/Enums.cs index d909338f9..baa1d6746 100644 --- a/DiscImageChef.Decoders/Floppy/Enums.cs +++ b/DiscImageChef.Decoders/Floppy/Enums.cs @@ -39,8 +39,6 @@ using System; namespace DiscImageChef.Decoders.Floppy { - #region Public enumerations - /// /// In-sector code for sector size /// @@ -107,7 +105,5 @@ namespace DiscImageChef.Decoders.Floppy /// MacDoubleSide = 0xD9 } - - #endregion Public enumerations } diff --git a/DiscImageChef.Decoders/Floppy/ISO.cs b/DiscImageChef.Decoders/Floppy/ISO.cs index f3a57b314..2d7492bbe 100644 --- a/DiscImageChef.Decoders/Floppy/ISO.cs +++ b/DiscImageChef.Decoders/Floppy/ISO.cs @@ -37,6 +37,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -58,7 +59,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// ISO floppy track, also used by Atari ST and others /// - public struct ISOFloppyTrack + public struct Track { /// /// Start of track, 32 bytes set to 0x4E @@ -68,12 +69,106 @@ namespace DiscImageChef.Decoders.Floppy /// /// Track sectors /// - public IBMMFMSector[] sectors; + public Sector[] sectors; /// /// Undefined size /// public byte[] gap; } + + /// + /// Raw demodulated format for IBM System 34 floppies + /// + public struct Sector + { + /// + /// Sector address mark + /// + public AddressMark addressMark; + /// + /// 22 bytes set to 0x4E, set to 0x22 on Commodore 1581 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] + public byte[] innerGap; + /// + /// Sector data block + /// + public DataBlock dataBlock; + /// + /// Variable bytes set to 0x4E, ECMA defines 54 + /// + public byte[] outerGap; + } + + /// + /// Sector address mark for IBM System 34 floppies, contains sync word + /// + public struct AddressMark + { + /// + /// 12 bytes set to 0 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] zero; + /// + /// 3 bytes set to 0xA1 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] aone; + /// + /// Set to + /// + public IBMIdType type; + /// + /// Track number + /// + public byte track; + /// + /// Side number + /// + public byte side; + /// + /// Sector number + /// + public byte sector; + /// + /// + /// + public IBMSectorSizeCode sectorSize; + /// + /// CRC16 from to end of + /// + public UInt16 crc; + } + + /// + /// Sector data block for IBM System 34 floppies + /// + public struct DataBlock + { + /// + /// 12 bytes set to 0 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] zero; + /// + /// 3 bytes set to 0xA1 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] aone; + /// + /// Set to or to + /// + public IBMIdType type; + /// + /// User data + /// + public byte[] data; + /// + /// CRC16 from to end of + /// + public UInt16 crc; + } } } diff --git a/DiscImageChef.Decoders/Floppy/Perpendicular.cs b/DiscImageChef.Decoders/Floppy/Perpendicular.cs index 6a0d13b36..55e7c929e 100644 --- a/DiscImageChef.Decoders/Floppy/Perpendicular.cs +++ b/DiscImageChef.Decoders/Floppy/Perpendicular.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -57,16 +58,16 @@ namespace DiscImageChef.Decoders.Floppy /// /// Perpendicular floppy track /// - public struct PerpendicularFloppyTrack + public struct Track { /// /// Start of track /// - public IBMMFMTrackPreamble trackStart; + public TrackPreamble trackStart; /// /// Track sectors /// - public PerpendicularFloppySector[] sectors; + public Sector[] sectors; /// /// Undefined size /// @@ -76,12 +77,12 @@ namespace DiscImageChef.Decoders.Floppy /// /// Raw demodulated format for perpendicular floppies /// - public struct PerpendicularFloppySector + public struct Sector { /// /// Sector address mark /// - public IBMMFMSectorAddressMark addressMark; + public AddressMark addressMark; /// /// 41 bytes set to 0x4E /// @@ -90,12 +91,114 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector data block /// - public IBMMFMSectorDataBlock dataBlock; + public DataBlock dataBlock; /// /// Variable-sized inter-sector gap, ECMA defines 83 bytes /// public byte[] outerGap; } + + /// + /// Start of IBM PC MFM floppy track + /// Used by IBM PC, Apple Macintosh (high-density only), and a lot others + /// + public struct TrackPreamble + { + /// + /// Gap from index pulse, 80 bytes set to 0x4E + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] + public byte[] gap; + /// + /// 12 bytes set to 0x00 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] zero; + /// + /// 3 bytes set to 0xC2 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] ctwo; + /// + /// Set to + /// + public IBMIdType type; + /// + /// Gap until first sector, 50 bytes to 0x4E + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] + public byte[] gap1; + } + + /// + /// Sector address mark for IBM System 34 floppies, contains sync word + /// + public struct AddressMark + { + /// + /// 12 bytes set to 0 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] zero; + /// + /// 3 bytes set to 0xA1 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] aone; + /// + /// Set to + /// + public IBMIdType type; + /// + /// Track number + /// + public byte track; + /// + /// Side number + /// + public byte side; + /// + /// Sector number + /// + public byte sector; + /// + /// + /// + public IBMSectorSizeCode sectorSize; + /// + /// CRC16 from to end of + /// + public UInt16 crc; + } + + /// + /// Sector data block for IBM System 34 floppies + /// + public struct DataBlock + { + /// + /// 12 bytes set to 0 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] zero; + /// + /// 3 bytes set to 0xA1 + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] aone; + /// + /// Set to or to + /// + public IBMIdType type; + /// + /// User data + /// + public byte[] data; + /// + /// CRC16 from to end of + /// + public UInt16 crc; + } } } diff --git a/DiscImageChef.Decoders/Floppy/System34.cs b/DiscImageChef.Decoders/Floppy/System34.cs index 3b58be02c..0debf6bc5 100644 --- a/DiscImageChef.Decoders/Floppy/System34.cs +++ b/DiscImageChef.Decoders/Floppy/System34.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -58,16 +59,16 @@ namespace DiscImageChef.Decoders.Floppy /// Track format for IBM System 34 floppy /// Used by IBM PC, Apple Macintosh (high-density only), and a lot others /// - public struct IBMMFMTrack + public struct Track { /// /// Start of track /// - public IBMMFMTrackPreamble trackStart; + public TrackPreamble trackStart; /// /// Track sectors /// - public IBMMFMSector[] sectors; + public Sector[] sectors; /// /// Undefined size /// @@ -78,7 +79,7 @@ namespace DiscImageChef.Decoders.Floppy /// Start of IBM PC MFM floppy track /// Used by IBM PC, Apple Macintosh (high-density only), and a lot others /// - public struct IBMMFMTrackPreamble + public struct TrackPreamble { /// /// Gap from index pulse, 80 bytes set to 0x4E @@ -109,12 +110,12 @@ namespace DiscImageChef.Decoders.Floppy /// /// Raw demodulated format for IBM System 34 floppies /// - public struct IBMMFMSector + public struct Sector { /// /// Sector address mark /// - public IBMMFMSectorAddressMark addressMark; + public AddressMark addressMark; /// /// 22 bytes set to 0x4E, set to 0x22 on Commodore 1581 /// @@ -123,7 +124,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector data block /// - public IBMMFMSectorAddressMark dataBlock; + public DataBlock dataBlock; /// /// Variable bytes set to 0x4E, ECMA defines 54 /// @@ -133,7 +134,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector address mark for IBM System 34 floppies, contains sync word /// - public struct IBMMFMSectorAddressMark + public struct AddressMark { /// /// 12 bytes set to 0 @@ -166,7 +167,7 @@ namespace DiscImageChef.Decoders.Floppy /// public IBMSectorSizeCode sectorSize; /// - /// CRC16 from to end of + /// CRC16 from to end of /// public UInt16 crc; } @@ -174,7 +175,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector data block for IBM System 34 floppies /// - public struct IBMMFMSectorDataBlock + public struct DataBlock { /// /// 12 bytes set to 0 diff --git a/DiscImageChef.Decoders/Floppy/System3740.cs b/DiscImageChef.Decoders/Floppy/System3740.cs index 4815c811e..465dd1d54 100644 --- a/DiscImageChef.Decoders/Floppy/System3740.cs +++ b/DiscImageChef.Decoders/Floppy/System3740.cs @@ -36,6 +36,7 @@ // ****************************************************************************/ // //$Id$ using System; +using System.Runtime.InteropServices; namespace DiscImageChef.Decoders.Floppy { @@ -57,16 +58,16 @@ namespace DiscImageChef.Decoders.Floppy /// /// Track format for IBM System 3740 floppy /// - public struct IBMFMTrack + public struct Track { /// /// Start of track /// - public IBMFMTrackPreamble trackStart; + public TrackPreamble trackStart; /// /// Track sectors /// - public IBMFMSector[] sectors; + public Sector[] sectors; /// /// Undefined size /// @@ -76,7 +77,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Start of IBM PC FM floppy track /// - public struct IBMFMTrackPreamble + public struct TrackPreamble { /// /// Gap from index pulse, 80 bytes set to 0xFF @@ -102,12 +103,12 @@ namespace DiscImageChef.Decoders.Floppy /// /// Raw demodulated format for IBM System 3740 floppies /// - public struct IBMFMSector + public struct Sector { /// /// Sector address mark /// - public IBMFMSectorAddressMark addressMark; + public AddressMark addressMark; /// /// 11 bytes set to 0xFF /// @@ -116,7 +117,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector data block /// - public IBMFMSectorAddressMark dataBlock; + public DataBlock dataBlock; /// /// Variable bytes set to 0xFF /// @@ -126,7 +127,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector address mark for IBM System 3740 floppies, contains sync word /// - public struct IBMFMSectorAddressMark + public struct AddressMark { /// /// 6 bytes set to 0 @@ -162,7 +163,7 @@ namespace DiscImageChef.Decoders.Floppy /// /// Sector data block for IBM System 3740 floppies /// - public struct IBMFMSectorDataBlock + public struct DataBlock { /// /// 12 bytes set to 0