예제 #1
0
        public void format_HD()
        {
            for (int i = 0; i < this._diskImage.CylynderCount; i++)
            {
            //                Track[] trackArray = this._diskImage this._cylynderList[i];

                for (int m = 0; m < _diskImage.SideCount; m++)
                {
                    ArrayList sectorList = new ArrayList();
                    for (int n = 0; n < 0x12; n++)
                    {
                        SimpleSector sector = new SimpleSector(i, m, this.il[n], 2, new byte[0x200]);
                        for (int num4 = 0; num4 < 0x200; num4++)
                        {
                            sector.Data[num4] = 0;
                        }
                        sector.SetAdCrc(true);
                        sector.SetDataCrc(true);
                        sectorList.Add(sector);
                    }

                    _diskImage.GetTrackImage(i, m).AssignSectors(sectorList);
            //                    trackArray[m].AssignSectors(sectorList);
                }
            }
            _diskImage.ModifyFlag = ZXMAK2.Entities.ModifyFlag.None;
        }
예제 #2
0
        public void format_trdos()
        {
            // format empty disk...
            for (int cyl = 0; cyl < _cylynderList.Count; cyl++)
            {
                Track[] cylinder = (Track[])_cylynderList[cyl];
                for (int side = 0; side < cylinder.Length; side++)
                {
                    ArrayList sectorList = new ArrayList();
                    for (int sec = 0; sec < 16; sec++)	// 16 sectors per track
                    {
                        SimpleSector sector = new SimpleSector(cyl, 0, il[sec], 1, new byte[256]);
                        for (int i = 0; i < 256; i++)
                            sector.Data[i] = 0x00;
                        sector.SetAdCrc(true);
                        sector.SetDataCrc(true);
                        sectorList.Add(sector);
                    }
                    cylinder[side].AssignSectors(sectorList);
                }
            }

            // TRDOS level format: 2544 secs (80 cyls, 2 sides)
            byte[] trsec = new byte[256];
            for (int i = 0; i < trsec.Length; i++)
                trsec[i] = 0x00;

            trsec[0xE2] = 0x01; trsec[0xE3] = 0x16;
            trsec[0xE5] = 0xF0; trsec[0xE6] = 0x09;
            trsec[0xE7] = 0x10;
            for (int i = 0xEA; i <= 0xF2; i++)
                trsec[i] = 0x20;
            trsec[0xF5] = 0x5A;  // Z
            trsec[0xF6] = 0x58;  // X
            trsec[0xF7] = 0x4D;  // M
            trsec[0xF8] = 0x41;  // A
            trsec[0xF9] = 0x4B;  // K
            trsec[0xFA] = 0x32;  // 2
            trsec[0xFB] = 0x20;
            trsec[0xFC] = 0x20;
            writeLogicalSector(0, 0, 9, trsec);
            _modifyFlag = ModifyFlag.None;
        }
예제 #3
0
        private void loadFromStream(Stream stream)
        {
            int cylynderCount = ((int)stream.Length) / 0x4800;
            //            int ti;
            if ((stream.Length % 0x4800L) > 0L)
            {
                this._diskImage.SetPhysics(cylynderCount + 1, 2);
            }
            else
            {
                this._diskImage.SetPhysics(cylynderCount, 2);
            }
            //this._diskImage.format_trdos();
            //this._diskImage.Format(); //?
            //this._diskImage.SetPhysics(80, 2);
            //            this._diskImage.GetTrackImage(0,0).AssignSectors(
            //this.format_HD();
            for (int i = 0; i < this._diskImage.CylynderCount; i++)
            {
                for (int m = 0; m < _diskImage.SideCount; m++)
                {
                    ArrayList sectorList = new ArrayList();
                    for (int n = 0; n < 0x12; n++)
                    {
                        SimpleSector sector = new SimpleSector(i, m, this.il[n], 2, new byte[0x200]);
            //                        byte[] buffer = new byte[0x200];
                        stream.Read(sector.Data, 0, 0x200);
            //                        sector.Data = buffer;
                        sector.SetAdCrc(true);
                        sector.SetDataCrc(true);
                        sectorList.Add(sector);
                    }
                    _diskImage.GetTrackImage(i, m).AssignSectors(sectorList);
                    //_diskImage.GetTrackImage(i, m).
                }
            }
            _diskImage.ModifyFlag = ZXMAK2.Entities.ModifyFlag.None;

            /*            for (int i = 0; stream.Position < stream.Length; i += 0x200)
            {
                byte[] buffer = new byte[0x200];
                stream.Read(buffer, 0, 0x200);
                //this._diskImage.writeLogicalSector(i >> 13, (i >> 12) & 1, ((i >> 8) & 15) + 1, buffer);
                ti = i >> 9;
                //this._diskImage.writeLogicalSector(ti / 36, (ti / 18) & 1, (ti - ((ti / 18) * 18)) + 1,buffer);
                this._diskImage.writeLogicalSector(ti / 36, (ti / 18) & 1, (ti % 18) + 1, buffer);

            }*/
        }