Esempio n. 1
0
        /// <summary>
        /// Returns the sector skip bytes
        /// </summary>
        public override SectorList GetSectorList(int track)
        {
            SectorList list = new SectorList();
            int        sp   = 0;

            // set the sector lists IDAM table pointer
            list.IDAMTablePointer = track * TrackLength + DISK_HEADER_LEN;

            // walk each pointer pair in the IDAM table, find the sector, pull
            // the sectors number and record it in the list.
            for (int s = 0; s < 18; s++)
            {
                // read IDAM pointer values (little endian format)
                int idx = list.IDAMTablePointer + s * 2;
                int lsb = RawData [idx];
                int msb = RawData [idx + 1];

                // clear control bits
                msb &= 0x1f;

                // point at the sector header
                sp = (msb * 256) + lsb + list.IDAMTablePointer;

                // copy sector skip data
                // sp is the sector pointer
                // RawData [sp +3] gets the sectors logical number
                // s + 1 is the physical sector number
                list.Add(new SectorEntry(sp, RawData [sp + 3], s + 1));
            }

            return(list);
        }
Esempio n. 2
0
        /// <summary>
        /// Converts a track and sector to an index position in the raw data.  This index
        /// points to the start of the sector and includes the 45 byte sector header.
        /// </summary>
        /// <param name="track">0 to x</param>
        /// <param name="logicalSector">1 to 18</param>
        /// <returns></returns>
        protected virtual int MapTrackSectorToIndex(int track, int logicalSector)
        {
            SectorList  sectors = GetSectorList(track);
            SectorEntry sector  = sectors.Find(s => s.LogicalNumber == logicalSector);

            return(sector.SectorStart);
        }