示例#1
0
        /// <summary>
        /// Saves BAM data to disk image
        /// </summary>
        /// <param name="disk">Disk image to write</param>
        public override void Save(BaseDisk disk)
        {
            byte[] data = BaseDisk.EmptySector();
            data[0]    = Directory.Track;
            data[1]    = Directory.Sector;
            data[2]    = (byte)DOSversion;
            data[0x14] = 0xA0;
            data[0x15] = 0xA0;
            data[0x16] = (byte)DiskId[0];
            data[0x17] = (byte)DiskId[1];
            data[0x18] = 0xA0;
            data[0x19] = (byte)DOStype[0];
            data[0x1A] = (byte)DOStype[1];
            data[0x1B] = 0xA0;
            data[0x1C] = 0xA0;
            Array.Copy(DiskLabel(), 0, data, 4, 16);
            disk.PutSector(Directory.Track, 0, data);

            data    = BAMsectorHeader();
            data[0] = Directory.Track;
            data[1] = 2;
            Array.Copy(RawMap(41, 80), 0, data, 16, 40 * EntrySize);
            disk.PutSector(Directory.Track, 1, data);

            data    = BAMsectorHeader();
            data[0] = 0;
            data[1] = 0xFF;
            Array.Copy(RawMap(1, 40), 0, data, 16, 40 * EntrySize);
            disk.PutSector(Directory.Track, 2, data);
        }
示例#2
0
        /// <summary>
        /// Saves BAM data to disk image
        /// </summary>
        /// <param name="disk">Disk image to write</param>
        public override void Save(BaseDisk disk)
        {
            SaveHeader(disk);

            byte[] data = BAMsector(1, 50);
            data[0] = BAMtrack;
            data[1] = 3;
            disk.PutSector(BAMtrack, 0, data);

            data    = BAMsector(51, 77);
            data[0] = Directory.Track;
            data[1] = Directory.Sector;
            disk.PutSector(BAMtrack, 3, data);
        }
示例#3
0
        /// <summary>
        /// Saves BAM data to disk image
        /// </summary>
        /// <param name="disk">Disk image to write</param>
        public override void Save(BaseDisk disk)
        {
            byte[] data = BaseHeader();
            Array.Copy(RawMap(), 0, data, 4, totalTracks * EntrySize);

            disk.PutSector(18, 0, data);
        }
示例#4
0
        /// <summary>
        /// Saves BAM data to disk image
        /// </summary>
        /// <param name="disk">Disk image to write</param>
        public override void Save(BaseDisk disk)
        {
            byte[] data = BaseHeader();
            Array.Copy(RawMap(), 0, data, 4, 35 * EntrySize);
            for (int j = 0; j < 35; ++j)
            {
                data[0xDD + j] = SectorsMap[35 + j].FreeSectors;
            }
            disk.PutSector(18, 0, data);

            data = BaseDisk.EmptySector();
            for (int j = 0; j < 35; ++j)
            {
                Array.Copy(SectorsMap[35 + j].flags, 0, data, j * 3, 3);
            }
            disk.PutSector(53, 0, data);
        }
示例#5
0
        /// <summary>
        /// Puts directory in disk sectors
        /// </summary>
        /// <param name="disk"></param>
        public void Save(BaseDisk disk)
        {
            disk.Header.FreeSectorsOnDirectoryTrack();
            List <byte[]> rawData  = ToRaw();
            byte          prevSect = disk.Header.Directory.Sector;

            if (rawData.Count > 0)
            {
                disk.PutSector(disk.Header.Directory.Track, prevSect, rawData[0]);
                for (int j = 1; j < rawData.Count; ++j)
                {
                    int sect = disk.Header.GetAFreeSector(disk.Header.Directory.Track);
                    if (sect > 0)
                    {
                        disk.GetSector(disk.Header.Directory.Track, prevSect)[0] = disk.Header.Directory.Track;
                        disk.GetSector(disk.Header.Directory.Track, prevSect)[0] = (byte)sect;
                        prevSect = (byte)sect;
                        disk.PutSector(disk.Header.Directory.Track, sect, rawData[j]);
                    }
                }
            }
        }
示例#6
0
 /// <summary>
 /// Writes disk header
 /// </summary>
 /// <param name="disk"></param>
 protected void SaveHeader(BaseDisk disk)
 {
     byte[] data = BaseDisk.EmptySector();
     data[0]    = BAMtrack;
     data[1]    = 0;
     data[2]    = (byte)DOSversion;
     data[0x17] = 0xA0;
     data[0x18] = (byte)DiskId[0];
     data[0x19] = (byte)DiskId[1];
     data[0x1A] = 0xA0;
     data[0x1B] = (byte)DOStype[0];
     data[0x1C] = (byte)DOStype[1];
     data[0x1D] = 0xA0;
     data[0x1E] = 0xA0;
     data[0x1F] = 0xA0;
     data[0x20] = 0xA0;
     Array.Copy(DiskLabel(), 0, data, 6, 16);
     disk.PutSector(Directory.Track, 0, data);
 }