Re-enabled exit (doesn't work), renamed the tests stage to "Kernel", moved the boot message to Cosmos.Kernel.Stages.Kernel, made a fail (unhandled exception) command, Made the RSOD (again).

This commit is contained in:
moitoius_cp 2008-01-28 13:32:37 +00:00
parent ce3142b2aa
commit 5d24e7cca4
12 changed files with 88 additions and 71 deletions

View file

@ -10,7 +10,7 @@ namespace Cosmos.Hardware.Screen {
private static byte Color = 7;
public static unsafe void Clear() {
for (int i = 0; i < Columns * Lines; i++) {
for (int i = 0; i < Columns * (Lines + 1); i++) {
byte* xScreenPtr = (byte*)VideoAddr;
xScreenPtr += i*2;
*xScreenPtr = 0;

View file

@ -82,7 +82,7 @@
<Compile Include="Old\Staging\DefaultStageQueue.cs" />
<Compile Include="Old\Staging\IStage.cs" />
<Compile Include="Old\Staging\StageQueue.cs" />
<Compile Include="Old\Staging\Stages\TestStage.cs" />
<Compile Include="Old\Staging\Stages\KernelStage.cs" />
<Compile Include="StringFuncs.cs" />
<Compile Include="Temp\Kudzu\PCI.cs" />
</ItemGroup>

View file

@ -7,7 +7,7 @@ namespace Cosmos.Kernel.Staging {
public class DefaultStageQueue : StageQueue {
public DefaultStageQueue()
: base () {
Enqueue (new Cosmos.Kernel.Staging.Stages.TestStage ());
Enqueue (new Cosmos.Kernel.Staging.Stages.KernelStage ());
}
}
}

View file

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.Kernel.Staging.Stages {
public class KernelStage : StageBase {
#region IStage Members
public override string Name {
get {
return "Kernel";
}
}
public override void Initialize() {
System.Console.Clear();
System.Console.BackgroundColor = ConsoleColor.Black;
System.Console.ForegroundColor = ConsoleColor.Red;
System.Console.WriteLine("Cosmos Kernel. Copyright 2007-2008 The Cosmos Project.");
System.Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.Console.ForegroundColor = ConsoleColor.White;
}
public override void Teardown() {
}
#endregion
}
}

View file

@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.Kernel.Staging.Stages {
public class TestStage : StageBase {
#region IStage Members
public override string Name {
get {
return "Tests";
}
}
public override void Initialize() {
}
public override void Teardown() {
}
#endregion
}
}

View file

@ -27,8 +27,7 @@ namespace Cosmos.Shell.Console.Commands
public override void Execute(string param)
{
//throw new NotSupportedException();
//_exit();
_exit();
}
public override void Help()

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.Shell.Console.Commands
{
public class FailCommand : CommandBase
{
public override string Name
{
get { return "fail"; }
}
public override string Summary
{
get { return "Causes a kernel-level exception (RSOD)."; }
}
public override void Execute(string param)
{
throw new Exception("This is a test.");
}
public override void Help()
{
System.Console.WriteLine("fail");
System.Console.WriteLine(" Causes a kernel-level exception (RSOD).");
}
}
}

View file

@ -49,6 +49,7 @@
<Compile Include="Commands\DirCommand.cs" />
<Compile Include="Commands\EchoCommand.cs" />
<Compile Include="Commands\ExitCommand.cs" />
<Compile Include="Commands\FailCommand.cs" />
<Compile Include="Commands\GuessCommand.cs" />
<Compile Include="Commands\HelpCommand.cs" />
<Compile Include="Commands\MatthijsCommand.cs" />
@ -70,6 +71,10 @@
<Project>{EF1F8912-AE8D-40B3-9857-5A2852986710}</Project>
<Name>Cosmos.Build.Windows</Name>
</ProjectReference>
<ProjectReference Include="..\..\Cosmos.Hardware.PC\Cosmos.Hardware.PC.csproj">
<Project>{B024FADF-EF04-4602-A0F4-49016D68B2AF}</Project>
<Name>Cosmos.Hardware.PC</Name>
</ProjectReference>
<ProjectReference Include="..\Cosmos.Hardware\Cosmos.Hardware.csproj">
<Project>{CE50FE98-9AC4-4B4D-ADC7-31F6DCD28755}</Project>
<Name>Cosmos.Hardware</Name>

View file

@ -23,21 +23,11 @@ namespace Cosmos.Shell.Console {
Kernel.Staging.DefaultStageQueue stages = new Cosmos.Kernel.Staging.DefaultStageQueue();
stages.Enqueue(new Prompter());
System.Console.Clear();
System.Console.BackgroundColor = ConsoleColor.Black;
System.Console.ForegroundColor = ConsoleColor.Red;
System.Console.WriteLine("Cosmos Kernel. Copyright 2007-2008 The Cosmos Project.");
System.Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.Console.ForegroundColor = ConsoleColor.Green;
System.Console.WriteLine("Now Booting...");
System.Console.ForegroundColor = ConsoleColor.White;
System.Console.WriteLine("Success.");
System.Console.WriteLine(Kernel.StringFuncs.TimeString());
stages.Run();
System.Console.WriteLine("Done");
stages.Teardown();
// Halt system.
while (true) ;
}
}
}

View file

@ -27,7 +27,8 @@ namespace Cosmos.Shell.Console {
_commands.Add(new Commands.ClsCommand());
_commands.Add(new Commands.DirCommand());
_commands.Add(new Commands.EchoCommand());
//_commands.Add(new Commands.ExitCommand(Stop)); // TODO: Fix this.
_commands.Add(new Commands.ExitCommand(Stop)); // TODO: Fix this.
_commands.Add(new Commands.FailCommand());
_commands.Add(new Commands.GuessCommand());
_commands.Add(new Commands.HelpCommand(_commands));
_commands.Add(new Commands.TestsCommand());

View file

@ -29,6 +29,11 @@ namespace Cosmos.Shell.Console.Tests
Assert("0123456789"[5] == '5', "\"0123456789\"[5] == '5'");
Assert("a" != "b", "\"a\" != \"b\"");
Assert('a'.ToString() == "a", "'a'.ToString() == \"a\"");
Assert(("a" + "b") == "ab", "\"a\" + \"b\" == \"a\" + \"b\"");
StringBuilder builder = new StringBuilder("a");
builder.Append("b");
Assert(builder.ToString() == "ab", "(stringbuilder)");
}
}
}

View file

@ -11,37 +11,18 @@ namespace Indy.IL2CPU.Assembler {
//public const string CurrentExceptionDataMember = "__CURRENT_EXCEPTION__";
public static Exception CurrentException;
public static void PrintException() {
Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.White;
string xClearLine = new String(' ', Console.WindowWidth);
for (int i = 0; i < Console.WindowHeight; i++) {
Console.Write(" ");
}
//Console.Clear();
System.Console.WriteLine("Cosmos Kernel. Copyright 2008 The Cosmos Project.");
System.Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("BSOD's Rule!");
Console.WriteLine("");
Console.Write("Unhandled error occurred: ");
System.Diagnostics.Debugger.Break();
Console.WriteLine(CurrentException.ToString());
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("");
Console.BackgroundColor = ConsoleColor.DarkRed;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Clear();
Console.WriteLine("Cosmos Kernel. Copyright 2008 The Cosmos Project.");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("");
Console.WriteLine("An unhandled kernel exception occurred.");
Console.WriteLine("");
Console.WriteLine(CurrentException.ToString());
Console.WriteLine("");
Console.WriteLine("The Cosmos Project would appreciate your feedback about this issue.");
}
private static FieldDefinition mCurrentExceptionRef;