public Byte[] diskBuffer; // Buffer used to store the entire disk public OricDisk() { // Initialise settings diskLoaded = false; diskModified = false; noOfSides = 0; tracksPerSide = 0; sectorsPerTrack = 0; noOfFiles = 0; dosFormat = DOSFormats.Unknown; dosVersion = DOSVersions.Unknown; diskType = DiskTypes.Unknown; }
private void IdentifyDosFormat(ref DOSFormats format, ref DOSVersions version) { // Identify the DOS format and version of the currently loaded disk format = DOSFormats.Unknown; version = DOSVersions.Unknown; // Firstly lets see if it's a SedOric disk format = GetDOSFormat(0, 1, ref version, 0x00); if (format == DOSFormats.Unknown) { format = GetDOSFormat(0, 2, ref version, 0xD1); if (format == DOSFormats.Unknown) { format = GetDOSFormat(4, 17, ref version, 0x00); if (format == DOSFormats.Unknown) { format = GetDOSFormat(2, 11, ref version, 0xC8); if (format == DOSFormats.Unknown) { format = GetDOSFormat(0, 1, ref version, 0x22); if (format == DOSFormats.Unknown) { // Check if it is a TDOS disk Byte[] DosID = ReadSector(20, 1); if (DosID[0xF6] == 0x80 && DosID[0xF7] == 0x80) { format = DOSFormats.TDOS; version = DOSVersions.TDOS_V3_2; } } } } } } }
public OricDisk(String diskPathname) { // Initialise settings diskLoaded = false; diskModified = false; noOfSides = 0; tracksPerSide = 0; sectorsPerTrack = 0; noOfFiles = 0; dosFormat = DOSFormats.Unknown; dosVersion = DOSVersions.Unknown; diskType = DiskTypes.Unknown; if (!LoadDisk(diskPathname)) { diskLoaded = false; } else { diskLoaded = true; } }
private DOSFormats GetDOSFormat(Byte track, Byte sector, ref DOSVersions version, Byte offset) { DOSFormats format = DOSFormats.Unknown; Byte[] sectorData = ReadSector(track, sector); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(sectorData, 0, sectorData.Length); System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(memoryStream); // Move to where the version string starts if (offset == 0x00) { memoryStream.Seek(0x40, SeekOrigin.Begin); } else { memoryStream.Seek(offset, SeekOrigin.Begin); } Byte[] dosFormat = new Byte[8]; dosFormat = binaryReader.ReadBytes(8); String dosFormatString = AsciiEncoder.GetString(dosFormat).Trim(); if (dosFormatString.Equals("SEDORIC")) { format = DOSFormats.SedOric; // Now get the version string dosFormat = binaryReader.ReadBytes(6); char[] delimiters = new char[3]; delimiters[0] = '\r'; delimiters[1] = '\n'; delimiters[2] = ' '; String dosVersionString = AsciiEncoder.GetString(dosFormat).Trim(delimiters); switch (dosVersionString) { case "V1.004": version = DOSVersions.SedOric_V1_004; break; case "V1.005": version = DOSVersions.SedOric_V1_005; break; case "V1.006": version = DOSVersions.SedOric_V1_006; break; case "V1.007": version = DOSVersions.SedOric_V1_007; break; case "V2.1": version = DOSVersions.SedOric_V2_1; break; case "V3.0": version = DOSVersions.SedOric_V3_006; break; case "V3.006": version = DOSVersions.SedOric_V3_006; break; default: version = DOSVersions.Unknown; break; } } else if (dosFormatString.Equals("Oric DOS")) { format = DOSFormats.OricDOS; version = DOSVersions.OricDOS_V1_13; } else if (dosFormatString.Equals("STRATSED")) { format = DOSFormats.StratSed; version = DOSVersions.Stratsed_V2_0_c; } else if (dosFormatString.StartsWith("XL DOS")) { format = DOSFormats.XLDos; version = DOSVersions.XLDos_V0_6; } return(format); }