From c420179ec79272f78e2ff1b013fa08e92293f43b Mon Sep 17 00:00:00 2001
From: moitoius_cp <7bd20ad30720b36bd251fb928c419f8754d57bfcCkJyHhZD>
Date: Tue, 1 Jan 2008 16:12:32 +0000
Subject: [PATCH]
---
source/Cosmos/Cosmos.Kernel.Plugs/Console.cs | 20 +++++++++++++++++++
source/Cosmos/Cosmos.Kernel/CPU.cs | 1 +
.../Cosmos.Kernel/Staging/Stages/TestStage.cs | 2 +-
.../Commands/FSTestCommand.cs | 17 ++++++++++++++++
.../Cosmos.Shell.Console/Commands/ICommand.cs | 19 ++++++++++++++++++
.../Cosmos.Shell.Console.csproj | 5 ++---
.../Cosmos/Cosmos.Shell.Console/Prompter.cs | 7 +++++++
7 files changed, 67 insertions(+), 4 deletions(-)
create mode 100644 source/Cosmos/Cosmos.Shell.Console/Commands/FSTestCommand.cs
create mode 100644 source/Cosmos/Cosmos.Shell.Console/Commands/ICommand.cs
diff --git a/source/Cosmos/Cosmos.Kernel.Plugs/Console.cs b/source/Cosmos/Cosmos.Kernel.Plugs/Console.cs
index 48e87a96e..2f41173ba 100644
--- a/source/Cosmos/Cosmos.Kernel.Plugs/Console.cs
+++ b/source/Cosmos/Cosmos.Kernel.Plugs/Console.cs
@@ -27,8 +27,28 @@ namespace Cosmos.Kernel.Plugs {
TextScreen.NewLine();
}
+ public static void Write(char[] buffer) {
+ for (int i = 0; i < buffer.Length; i++)
+ Write (buffer[i]);
+ }
+
+ public static void WriteLine(char[] buffer) {
+ Write (buffer);
+ WriteLine ();
+ }
+
public static void WriteLine() {
TextScreen.NewLine();
}
+
+ public static string ReadLine() {
+ char current;
+ string result = "";
+ while ((current = Keyboard.ReadChar ()) != 'a') {
+ result += new string (new char[] { current });
+ Write (current);
+ }
+ return result;
+ }
}
}
diff --git a/source/Cosmos/Cosmos.Kernel/CPU.cs b/source/Cosmos/Cosmos.Kernel/CPU.cs
index d11aa7233..bae5d09a2 100644
--- a/source/Cosmos/Cosmos.Kernel/CPU.cs
+++ b/source/Cosmos/Cosmos.Kernel/CPU.cs
@@ -34,6 +34,7 @@ namespace Cosmos.Kernel {
Console.Write("Creating IDT...");
Hardware.CPU.CreateIDT();
Console.WriteLine("Done");
+ Keyboard.Initialize ();
TestATA();
}
diff --git a/source/Cosmos/Cosmos.Kernel/Staging/Stages/TestStage.cs b/source/Cosmos/Cosmos.Kernel/Staging/Stages/TestStage.cs
index e10d242ba..42bec177f 100644
--- a/source/Cosmos/Cosmos.Kernel/Staging/Stages/TestStage.cs
+++ b/source/Cosmos/Cosmos.Kernel/Staging/Stages/TestStage.cs
@@ -13,7 +13,7 @@ namespace Cosmos.Kernel.Staging.Stages {
}
public override void Initialize() {
- CPU.TestATA ();
+ //CPU.TestATA ();
}
public override void Teardown() {
diff --git a/source/Cosmos/Cosmos.Shell.Console/Commands/FSTestCommand.cs b/source/Cosmos/Cosmos.Shell.Console/Commands/FSTestCommand.cs
new file mode 100644
index 000000000..3afe38d4c
--- /dev/null
+++ b/source/Cosmos/Cosmos.Shell.Console/Commands/FSTestCommand.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Cosmos.Shell.Console.Commands {
+ public class FSTestCommand : ICommand {
+ public override string Name {
+ get {
+ return "fstest";
+ }
+ }
+
+ public override void Execute() {
+ System.Console.WriteLine ("Testing...");
+ }
+ }
+}
diff --git a/source/Cosmos/Cosmos.Shell.Console/Commands/ICommand.cs b/source/Cosmos/Cosmos.Shell.Console/Commands/ICommand.cs
new file mode 100644
index 000000000..59438b90d
--- /dev/null
+++ b/source/Cosmos/Cosmos.Shell.Console/Commands/ICommand.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Cosmos.Shell.Console.Commands {
+ ///
+ /// Represents a command.
+ ///
+ public abstract class ICommand {
+ ///
+ /// Gets the name of the command (must be lowercase).
+ ///
+ public abstract string Name {
+ get;
+ }
+
+ public abstract void Execute();
+ }
+}
diff --git a/source/Cosmos/Cosmos.Shell.Console/Cosmos.Shell.Console.csproj b/source/Cosmos/Cosmos.Shell.Console/Cosmos.Shell.Console.csproj
index 7a6c4fc86..bed8f22ba 100644
--- a/source/Cosmos/Cosmos.Shell.Console/Cosmos.Shell.Console.csproj
+++ b/source/Cosmos/Cosmos.Shell.Console/Cosmos.Shell.Console.csproj
@@ -41,6 +41,8 @@
+
+
@@ -51,9 +53,6 @@
Cosmos.Kernel
-
-
-