rendered paste bodyusing System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using Hard = Cosmos.Hardware;
using Core = Cosmos.Core;
namespace ViewKernel
{
public class Kernel : Sys.Kernel
{
Core.CPU cpu = new Core.CPU();
public Kernel() : base()
{
Sys.Global.Dbg.Send("test");
}
protected override void BeforeRun()
{
/* BUG :: CONSOLE COLOR */
/*
Error 1 Plug needed. System.Boolean Microsoft.Win32.Win32Native.GetConsoleScreenBufferInfo(System.IntPtr, &Microsoft.Win32.Win32Native+CONSOLE_SCREEN_BUFFER_INFO)
at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 663
at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 779
at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 284
at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 239 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets 32 10 ViewMain
*/
//printc("Matheus", ConsoleColor.Gray);
//printc("MK3", ConsoleColor.Blue);
//printc(".os", ConsoleColor.Red);
//printc(" funcionando");
breakln();
println(" Coisas funcionando: ");
traceln();
println(" [*] Console");
println(" [*] Funcoes (print/breakln/traceln)");
println(" [*] Entrada de teclado");
breakln();
println(" [ ] Cores");
println(" [ ] Sistema de arquivos");
println(" [ ] Aplicativos");
println(" [ ] Modo protegido");
println(" [ ] VGA");
traceln();
print("Carregando Sistema...");
for (int i = 0; i < 10; i++)
{
print(".");
}
ClearScreen();
println("Sistema Pronto!");
traceln();
}
protected override void Run()
{
breakln();
breakln();
println("+-------------------------+");
println("| BREAK |");
println("+-------------------------+");
breakln();
println("KERNEL->Ram()::" + sizecalc(Core.CPU.GetAmountOfRAM()));
println("KERNEL->End()::" + Core.CPU.GetEndOfKernel());
println("CPU->Halt()");
cpu.Halt();
}
#region Funções do SO
public static string sizecalc(uint size)
{
uint sz = size;
string st = sz + " bytes";
if (sz > 1024)
{
sz = sz / 1024;
st = sz + " KB";
}
if (sz > 1024)
{
sz = sz / 1024;
st = sz + " MB";
}
if (sz > 1024)
{
sz = sz / 1024;
st = sz + " GB";
}
return st;
}
public static void printc(string what)
{
printc(what, Console.ForegroundColor);
}
public static void printc(string what, ConsoleColor color)
{
ConsoleColor cc = Console.ForegroundColor;
Console.ForegroundColor = color;
Console.Write(what);
Console.ForegroundColor = cc;
}
public static void print(string what)
{
Console.Write(what);
}
public static void println(string what)
{
Console.WriteLine(what);
}
public static void breakln()
{
println("");
}
public static void traceln()
{
println("=-------------------------=");
}
public static void ClearScreen()
{
Console.Clear();
}
#endregion
}
}