private void SingleDensityBuilder(FloppyDisk floppyDisk, byte[] buffer) { for (var i = 0; i < 40; i++) { var track = new FloppyDiskTrack { TrackId = (ushort)i }; floppyDisk.Sides[0].Tracks.Add(track); for (var j = 0; j < 18; j++) { var sector = new FloppyDiskSector(128); sector.Encoding = FloppyDataEncoding.FMEncoding; Buffer.BlockCopy(buffer, (i * 18 + j) * 128 + 16, sector.Data, 0, 128); track.Sectors.Add(sector); } } }
private void EnhancedDensityBuilder(FloppyDisk floppyDisk, byte[] buffer) { for (var i = 0; i < 40; i++) { var track = new FloppyDiskTrack { TrackId = (ushort)i }; floppyDisk.Sides[0].Tracks.Add(track); for (var j = 0; j < 26; j++) { var sector = new FloppyDiskSector(256); sector.Encoding = FloppyDataEncoding.MFMEncoding; Buffer.BlockCopy(buffer, (i * 26 + j) * 256 + 16, sector.Data, 0, 256); track.Sectors.Add(sector); } } }
public override void VisitFloppyDisk(FloppyDisk floppyDisk) { total += floppyDisk.NetPrice(); }
private void InsertDisk(FloppyDisk disk) { _disk = disk; SetErrorOrState(state: disk.IsWriteProtected ? StateCode.ReadyWp : StateCode.Ready); }
private void EjectDisk() { _disk = null; SetErrorOrState(state: StateCode.NoMedia); }
public override void OnLoad(ConfigNode node) { uint version; if (UInt32.TryParse(node.GetValue(ConfigKeyVersion), out version) && version == 1) { float x; if (Single.TryParse(node.GetValue(ConfigKeyWindowPositionX), out x)) { _windowPosition.x = x; } float y; if (Single.TryParse(node.GetValue(ConfigKeyWindowPositionY), out y)) { _windowPosition.y = y; } _isWindowPositionInit = true; bool showWindow; if (Boolean.TryParse(node.GetValue(ConfigKeyShowWindow), out showWindow)) { _showWindow = showWindow; } ushort currentStateCode; if (UInt16.TryParse(node.GetValue(ConfigKeyCurrentStateCode), out currentStateCode)) { _currentStateCode = (StateCode)currentStateCode; } ushort lastErrorCode; if (UInt16.TryParse(node.GetValue(ConfigKeyLastErrorCode), out lastErrorCode)) { _lastErrorCode = (ErrorCode)lastErrorCode; } int currentTrack; if (Int32.TryParse(node.GetValue(ConfigKeyCurrentTrack), out currentTrack)) { _currentTrack = currentTrack; } var i = 0; while (node.HasNode(ConfigKeyDiskPrefix + i)) { var diskNode = node.GetNode(ConfigKeyDiskPrefix + i); var label = diskNode.GetValue(ConfigKeyLabel); bool isWriteProtected; Boolean.TryParse(diskNode.GetValue(ConfigKeyIsWriteProtected), out isWriteProtected); var data = diskNode.GetValue(ConfigKeyData); _allDisks.Add(new FloppyDisk(data) { Label = label, IsWriteProtected = isWriteProtected }); i++; } int diskIndex; if (Int32.TryParse(node.GetValue(ConfigKeyInsertedDiskIndex), out diskIndex)) { if (diskIndex >= 0) { _disk = _allDisks[diskIndex]; } } } }
public void VisitFloppyDisk(FloppyDisk floppyDisk) { this.TotalPrice.Value += floppyDisk.NetPrice().Value; }
private void DumpFloppySector(int cylinder, int head, int sector, string outFile) { int byteNum = 0; StringBuilder line = new StringBuilder(); line.AppendFormat("{0:x4}: ", 0); FloppyDisk disk = _system.IOP.FloppyController.Drive.Disk; if (cylinder < 0 || cylinder > 76) { WriteLine("Invalid cylinder spec."); return; } if (head < 0 || head > 1) { WriteLine("Invalid head spec."); return; } if (disk == null) { WriteLine("No disk loaded."); } else { Sector sectorData = disk.GetSector(cylinder, head, sector - 1); WriteLine(String.Format("Sector format {0}, length {1}", sectorData.Format, sectorData.Data.Length)); FileStream fs = null; if (outFile != null) { fs = new FileStream(outFile, FileMode.Create, FileAccess.Write); } for (int i = 0; i < sectorData.Data.Length; i++) { byte val = sectorData.Data[i]; line.AppendFormat("{0:x2} ", val); byteNum++; if ((byteNum % 16) == 0) { WriteLine(line.ToString()); line.Clear(); line.AppendFormat("{0:x4}: ", i + 1); byteNum = 0; } if (fs != null) { fs.WriteByte(val); } } if (byteNum > 0) { WriteLine(line.ToString()); } if (fs != null) { fs.Close(); } } }
public void VisitFloppyDisk(FloppyDisk d) => result += d.Price;
public abstract void VisitFloppyDisk(FloppyDisk floppyDisk);
private void InsertDisk(FloppyDisk disk) { _disk = disk; SetErrorOrState(state: disk.IsWriteProtected?StateCode.ReadyWp: StateCode.Ready); }
private void EjectDisk() { _disk = null; SetErrorOrState(state: StateCode.NoMedia); }
public override void OnLoad(ConfigNode node) { uint version; if (UInt32.TryParse(node.GetValue(ConfigKeyVersion), out version) && version == 1) { float x; if (Single.TryParse(node.GetValue(ConfigKeyWindowPositionX), out x)) { _windowPosition.x = x; } float y; if (Single.TryParse(node.GetValue(ConfigKeyWindowPositionY), out y)) { _windowPosition.y = y; } _isWindowPositionInit = true; bool showWindow; if (Boolean.TryParse(node.GetValue(ConfigKeyShowWindow), out showWindow)) { _showWindow = showWindow; } ushort currentStateCode; if (UInt16.TryParse(node.GetValue(ConfigKeyCurrentStateCode), out currentStateCode)) { _currentStateCode = (StateCode)currentStateCode; } ushort lastErrorCode; if (UInt16.TryParse(node.GetValue(ConfigKeyLastErrorCode), out lastErrorCode)) { _lastErrorCode = (ErrorCode)lastErrorCode; } int currentTrack; if (Int32.TryParse(node.GetValue(ConfigKeyCurrentTrack), out currentTrack)) { _currentTrack = currentTrack; } var i = 0; while (node.HasNode(ConfigKeyDiskPrefix + i)) { var diskNode = node.GetNode(ConfigKeyDiskPrefix + i); var label = diskNode.GetValue(ConfigKeyLabel); bool isWriteProtected; Boolean.TryParse(diskNode.GetValue(ConfigKeyIsWriteProtected), out isWriteProtected); var data = diskNode.GetValue(ConfigKeyData); _allDisks.Add(new FloppyDisk(data) { Label = label, IsWriteProtected = isWriteProtected }); i++; } int diskIndex; if (Int32.TryParse(node.GetValue(ConfigKeyInsertedDiskIndex), out diskIndex)) { if (diskIndex >= 0) { _disk = _allDisks[diskIndex]; } } } }