Exemplo n.º 1
0
        public unsafe void AssignLayout(TrackFormat layout, int track, int syncSectorNumber = int.MinValue, int firstIndex = 0)
        {
            int minSectorIndex  = 0;
            int minSectorNumber = int.MaxValue;

            for (int i = firstIndex; i < layout.Layout.Cnt; i++)
            {
                if (layout.Layout.Data[i].SectorNumber < minSectorNumber)
                {
                    minSectorNumber = layout.Layout.Data[i].SectorNumber;
                    minSectorIndex  = i;
                }
            }
            int len = Math.Max(0, layout.Layout.Cnt - firstIndex);

            Layout.EnsureCapacity(len);
            Layout.Cnt = len;
            for (int i = 0, j = minSectorIndex; i < len; i++)
            {
                Layout.Data[i] = layout.Layout.Data[j];
                if (syncSectorNumber != int.MinValue && Layout.Data[i].SectorNumber == syncSectorNumber)
                {
                    SyncByHeader(track, syncSectorNumber);
                }
                j++;
                if (j >= layout.Layout.Cnt)
                {
                    j = firstIndex;
                }
            }
            FormatName  = GetFormatName();
            SpinTime    = GetSpinTime();
            LayoutTrack = track;
        }
Exemplo n.º 2
0
 protected override void RefreshControlsCustom()
 {
     if (diskReader?.Params?.ReadMode == ReadMode.Fast && trackLayout != diskReader.Params.CurrentTrackFormat?.FormatName)
     {
         trackLayout        = diskReader.Params.CurrentTrackFormat.FormatName;
         trackLayoutLV.Text = trackLayout.ToString().Replace("TrDos", "");
     }
 }
Exemplo n.º 3
0
 public void Assign(TrackFormat source)
 {
     Layout.CopyArray(source.Layout);
     Timer.Assign(source.Timer);
     LayoutTrack     = source.LayoutTrack;
     LongSectorIndex = source.LongSectorIndex;
     syncSectorIndex = source.syncSectorIndex;
     syncTrack       = source.syncTrack;
     SpinTime        = source.SpinTime;
     FormatName      = source.FormatName;
 }
Exemplo n.º 4
0
 protected override bool ReadParametersCustom()
 {
     Params.UpperSideHead           = upperSide0.Checked ? UpperSideHead.Head0 : UpperSideHead.Head1;
     Params.UpperSideHeadAutodetect = upperSideAutodetect.Checked;
     if (Params.UpperSideHeadAutodetect)
     {
         upperSideString = "Autodetect";
     }
     else
     {
         upperSideString = Params.UpperSideHead == UpperSideHead.Head0 ? "Head = 0" : "Head = 1";
     }
     Params.CurrentTrackFormat.SetFormat(TrackFormatName.TrDosTurbo);
     Params.ReadMode = readModeStandard.Checked ? ReadMode.Standard : ReadMode.Fast;
     Params.TrackLayoutAutodetect = Params.ReadMode == ReadMode.Fast;
     trackLayout = TrackFormatName.NoHeaders;
     return(true);
 }
Exemplo n.º 5
0
 public TrackFormat(TrackFormatName formatName)
 {
     Layout = new MList <SectorInfo>(16);
     SetFormat(formatName);
 }
Exemplo n.º 6
0
 public TrackFormat(int sectorCnt)
 {
     Layout     = new MList <SectorInfo>(sectorCnt);
     FormatName = TrackFormatName.Unscanned;
 }
Exemplo n.º 7
0
        public void SetFormat(TrackFormatName formatName)
        {
            FormatName = formatName;
            SpinTime   = 200;
            switch (formatName)
            {
            case TrackFormatName.TrDosTurbo:
                Layout.EnsureCapacity(16);
                Layout.Cnt = 16;
                for (int i = 0; i < 16; i++)
                {
                    Layout.Data[i].SizeCode     = 1;
                    Layout.Data[i].SectorNumber = i + 1;
                    Layout.Data[i].TimeMs       = 11.88; // тайминги установлены неточно.
                }
                Layout.Data[0].TimeMs = 21.78;
                return;

            case TrackFormatName.TrDosSequential:
                Layout.EnsureCapacity(16);
                Layout.Cnt = 16;
                for (int i = 0; i < 16; i++)
                {
                    Layout.Data[i].SizeCode     = 1;
                    Layout.Data[i].SectorNumber = i + 1;
                    Layout.Data[i].TimeMs       = 12.5;
                }
                return;

            case TrackFormatName.TrDosInterleave:
                Layout.EnsureCapacity(16);
                Layout.Cnt = 16;
                for (int i = 0, j = 1, k = 9; i < 16; i += 2, j++, k++)
                {
                    Layout.Data[i].SizeCode         = 1;
                    Layout.Data[i].SectorNumber     = j;
                    Layout.Data[i].TimeMs           = 12.5;
                    Layout.Data[i + 1].SizeCode     = 1;
                    Layout.Data[i + 1].SectorNumber = k;
                    Layout.Data[i + 1].TimeMs       = 12.5;
                }
                return;

            case TrackFormatName.CpmSequential:
                Layout.EnsureCapacity(5);
                Layout.Cnt = 5;
                for (int i = 0; i < 5; i++)
                {
                    Layout.Data[i].SizeCode     = 3;
                    Layout.Data[i].SectorNumber = i + 1;
                    Layout.Data[i].TimeMs       = 40;
                }
                return;

            case TrackFormatName.IsDosSequential:
                Layout.EnsureCapacity(5);
                Layout.Cnt = 5;
                for (int i = 0; i < 5; i++)
                {
                    Layout.Data[i].SizeCode     = 3;
                    Layout.Data[i].SectorNumber = i < 4 ? i + 1 : 9;
                    Layout.Data[i].TimeMs       = 40;
                }
                return;

            case TrackFormatName.Unscanned:
                Layout.Cnt = 0;
                return;

            default:
                throw new Exception();
            }
        }