Pasti file Reader-Writer  1.0
Pasti files
PastiStruct.cs
Go to the documentation of this file.
1 
26 using System;
27 using System.Collections.Generic;
28 using System.Linq;
29 using System.Text;
30 using System.Threading.Tasks;
31 using System.Diagnostics;
32 using System.Windows.Media;
33 
34 
35 namespace Pasti {
40  public class FileDesc {
44  public string pastiFileId = "";
46  public ushort version;
52  public ushort tool;
54  public ushort reserved_1;
56  public byte trackCount;
61  public byte revision;
63  public uint reserved_2;
64 
69  public override string ToString() {
70  //return base.ToString();
71  return String.Format("Pasti file version {0}.{1} Image Tool={2:X2} - Number of tracks={3}",
72  version, revision, tool, trackCount);
73  }
74  } // FileDesc
75 
76 
79  public struct TrackDesc {
83  public uint recordSize;
87  public uint fuzzyCount;
92  public ushort sectorCount;
106  public ushort trackFlags;
108  public ushort trackLength;
110  public byte trackNumber;
112  public byte trackType;
113 
114  // Track descriptor flags
116  public const byte TRK_SYNC = 0x80;
118  public const byte TRK_IMAGE = 0x40;
120  public const byte TRK_PROT = 0x20;
122  public const byte TRK_SECT_DESC = 0x01;
123 
128  public override string ToString() {
129  //return base.ToString();
130  return String.Format("Track {0:D2}.{1:D1} {2} bytes {3} sect FuzBytes={4} Flag={5:X2} {6} {7} RecSize={8}",
131  trackNumber & 0x7F, (trackNumber & 0x80) >> 7, trackLength, sectorCount, (fuzzyCount == 0) ? "No" : String.Format("{0}", fuzzyCount), trackFlags,
132  ((trackFlags & TRK_IMAGE)) != 0 ? "TImage" : "",
133  ((trackFlags & TRK_SECT_DESC)) != 0 ? "SDesc" : "", recordSize);
134  }
135 
136  } // TrackDesc
137 
138 
141  public class IDField {
143  public byte track;
145  public byte side;
147  public byte number;
149  public byte size;
151  public ushort crc;
152 
157  public override string ToString() {
158  //return base.ToString();
159  return String.Format("T={0,-2} H={1} SN={2,-3} S={3} CRC={4:X4}",
160  track, side, number, size,crc);
161  }
162  } // IdField
163 
164 
173  public class SectorDesc {
179  public uint dataOffset;
182  public ushort bitPosition;
189  public ushort readTime;
191  public IDField id = new IDField();
211  public byte fdcFlags;
213  public byte reserved;
214 
215  // Useful FDC Read Sector Status bits
217  public const byte REC_TYPE = 0x20;
219  public const byte SECT_RNF = 0x10;
221  public const byte CRC_ERR = 0x08;
222 
223  // Pseudo FDC status bits used for other purpose
225  public const byte FUZZY_BITS = 0x80;
227  public const byte BIT_WIDTH = 0x01;
228 
233  public override string ToString() {
234  //return base.ToString();
235  return String.Format(" Sector {0} bitPos={1,-6} Time={2,-5} Flags={3:X2} {4}{5} Off={6,-6}",
236  id.ToString(), bitPosition, readTime, fdcFlags, ((fdcFlags & FUZZY_BITS) != 0) ? "F" : " ",
237  ((fdcFlags & BIT_WIDTH) != 0) ? "T" : " ", dataOffset);
238  }
239  } // SectDesc
240 
241 } // Pasti name space
Pasti File Track Descriptor
Definition: PastiStruct.cs:79
Pasti File Header Descriptor
Definition: PastiStruct.cs:40
override string ToString()
Override ToString() to display Track header information
Definition: PastiStruct.cs:128
override string ToString()
Override ToString() to display Address field information
Definition: PastiStruct.cs:157
ushort trackFlags
This field contain bit-mask flags that provide information about the content of the track record as f...
Definition: PastiStruct.cs:106
byte reserved
Reserved (should be 0x00)
Definition: PastiStruct.cs:213
ushort crc
CRC Value from address field
Definition: PastiStruct.cs:151
const byte TRK_PROT
track contains protections ? not used
Definition: PastiStruct.cs:120
override string ToString()
Override ToString() to display File header information
Definition: PastiStruct.cs:69
byte trackType
track image type (not used)
Definition: PastiStruct.cs:112
const byte FUZZY_BITS
Sector has Fuzzy Bits
Definition: PastiStruct.cs:225
const byte TRK_SYNC
2 bytes track_image header contains sync offset info
Definition: PastiStruct.cs:116
byte track
Track number from address field
Definition: PastiStruct.cs:143
ushort sectorCount
number of sectors in the track
Definition: PastiStruct.cs:92
uint fuzzyCount
number of bytes in the fuzzy mask
Definition: PastiStruct.cs:87
ushort readTime
This field contains either zero or the read time for the sector data block.
Definition: PastiStruct.cs:189
const byte TRK_SECT_DESC
The track record contains sectorCount SectDesc
Definition: PastiStruct.cs:122
ushort bitPosition
This field store the position in number of bits of this sector address block from the index...
Definition: PastiStruct.cs:182
Address Segment
Definition: PastiStruct.cs:141
byte size
Size value from address field
Definition: PastiStruct.cs:149
const byte REC_TYPE
Record Type (1 = deleted data)
Definition: PastiStruct.cs:217
const byte SECT_RNF
RNF or Seek error
Definition: PastiStruct.cs:219
const byte TRK_IMAGE
track record contains track_image
Definition: PastiStruct.cs:118
byte trackCount
Number of track records
Definition: PastiStruct.cs:56
ushort trackLength
length of the track in number of bytes. Usually around 6250 bytes.
Definition: PastiStruct.cs:108
ushort version
File version number: Should be equal to 3.
Definition: PastiStruct.cs:46
byte trackNumber
Bit 7 contains the side (0 or 1) and bits 6-0 contain the track number (usually 0 to 79)...
Definition: PastiStruct.cs:110
const byte CRC_ERR
CRC Error (in Data if RNF=0 else in ID)
Definition: PastiStruct.cs:221
Pasti File Sector Descriptor
Definition: PastiStruct.cs:173
override string ToString()
Override ToString() to display Pasti Sector descriptor information
Definition: PastiStruct.cs:233
byte number
Sector number from address field
Definition: PastiStruct.cs:147
ushort tool
Tool used to create image
Definition: PastiStruct.cs:52
uint recordSize
Total size of this track record.
Definition: PastiStruct.cs:83
byte revision
revision number of the file.
Definition: PastiStruct.cs:61
byte fdcFlags
This field contains a mixture of the FDC status, as it would have been read by the WD1772...
Definition: PastiStruct.cs:211
uint reserved_2
Reserved
Definition: PastiStruct.cs:63
string pastiFileId
Identify a Pasti file and should be equal to the null terminated string “RSY”
Definition: PastiStruct.cs:44
uint dataOffset
Offset of sector data inside the track record
Definition: PastiStruct.cs:179
byte side
Head number from address field
Definition: PastiStruct.cs:145
ushort reserved_1
Reserved
Definition: PastiStruct.cs:54
const byte BIT_WIDTH
Sector has bit width variation
Definition: PastiStruct.cs:227