mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Sys = Cosmos.System;
|
|
using Cosmos.Debug.Kernel;
|
|
using Cosmos.Common.Extensions;
|
|
using Cosmos.Hardware.BlockDevice;
|
|
|
|
namespace BreakpointsKernel {
|
|
public class BreakpointsOS : Sys.Kernel {
|
|
public BreakpointsOS() {
|
|
ClearScreen = false;
|
|
}
|
|
|
|
protected override void BeforeRun() {
|
|
Console.WriteLine("Cosmos boot complete.");
|
|
}
|
|
|
|
protected void TestSB() {
|
|
var xSB = new StringBuilder();
|
|
xSB.Append("Hello");
|
|
xSB.Append("Hello");
|
|
var xDisplay = xSB.ToString();
|
|
Console.WriteLine(xDisplay.Length);
|
|
Console.WriteLine(xDisplay);
|
|
}
|
|
|
|
protected override void Run() {
|
|
// This first line causes both Cosmos and VS to lock up
|
|
//var x = BlockDevice.Devices[0];
|
|
//var v = BlockDevice.Devices.Count;
|
|
// Next line barfs. No reflection?
|
|
//string y = x.GetType().ToString();
|
|
// Next line cause Run to restart? Inteferes with loop?
|
|
//var z = (AtaPio)x;
|
|
// Next line barfs too
|
|
//var xATA = (AtaPio)BlockDevice.Devices[0];
|
|
|
|
Console.WriteLine("Block devices found: " + BlockDevice.Devices.Count);
|
|
|
|
var xATA = new AtaPio(Cosmos.Core.Global.BaseIOGroups.ATA1, Ata.ControllerIdEnum.Primary, Ata.BusPositionEnum.Master);
|
|
Console.WriteLine("--------------------------");
|
|
Console.WriteLine("Type: " + (xATA.DriveType == AtaPio.SpecLevel.ATA ? "ATA" : "ATAPI"));
|
|
Console.WriteLine("Serial No: " + xATA.SerialNo);
|
|
Console.WriteLine("Firmware Rev: " + xATA.FirmwareRev);
|
|
Console.WriteLine("Model No: " + xATA.ModelNo);
|
|
Console.WriteLine("Size: " + xATA.BlockCount * xATA.BlockSize / 1024 / 1024 + " MB");
|
|
|
|
var xFS = new Cosmos.System.Filesystem.FAT(BlockDevice.Devices[1]);
|
|
xFS.GetDir();
|
|
|
|
//var xWrite = new byte[512];
|
|
//for (int i = 0; i < 512; i++) {
|
|
// xWrite[i] = (byte)i;
|
|
//}
|
|
//xATA.WriteBlock(0, xWrite);
|
|
|
|
//var xRead = new byte[512];
|
|
//xATA.ReadBlock(0, xRead);
|
|
//string xDisplay = "";
|
|
//for (int i = 0; i < 512; i++) {
|
|
// xDisplay = xDisplay + xRead[i].ToHex();
|
|
//}
|
|
//Console.WriteLine(xDisplay);
|
|
Stop();
|
|
}
|
|
|
|
protected override void AfterRun() {
|
|
Console.Write("Done");
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
}
|