Ongoing changes.

This commit is contained in:
Matthijs ter Woord 2015-08-18 20:19:36 +02:00
parent bccf8cb64f
commit 0b5490a281
9 changed files with 52 additions and 21 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using Cosmos.Debug.Kernel;
using Sys = Cosmos.System;
namespace Cosmos.Compiler.Tests.SingleEchoTest

View file

@ -22,10 +22,10 @@ namespace Cosmos.TestRunner.Core
//engine.RunIL2CPUInProcess = true;
engine.RunWithGDB = false;
engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
//engine.AddKernel(typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel).Assembly.Location);
//engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location);
//engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location);
//engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location);
engine.AddKernel(typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel).Assembly.Location);
// known bugs, therefor disabled for now:
//engine.AddKernel(typeof(BoxingTests.Kernel).Assembly.Location);

View file

@ -40,8 +40,8 @@ namespace Cosmos.TestRunner.Core
{
var xArguments = new[]
{
"DebugEnabled:True",
"StackCorruptionDetectionEnabled:false",
"DebugEnabled:true",
"StackCorruptionDetectionEnabled:true",
"DebugMode:Source",
"TraceAssemblies:",
"DebugCom:1",

View file

@ -124,11 +124,16 @@ namespace Cosmos.HAL
{
TextScreen = textScreen;
}
if (keyboard != null)
{
Keyboard = keyboard;
}
Global.Dbg.Send("Before Core.Global.Init");
if (keyboard == null)
{
Core.Global.Dbg.Send("No keyboard specified!");
Keyboard = new PS2Keyboard();
}
else
{
Keyboard = keyboard;
}
Global.Dbg.Send("Before Core.Global.Init");
Core.Global.Init();
Global.Dbg.Send("Static Devices");
InitStaticDevices();

View file

@ -14,9 +14,13 @@ namespace Cosmos.HAL {
Debugger.DoSend("Skipping creation of key queue!");
}
mQueuedKeys = new Queue<KeyEvent>(32);
Debugger.DoSend("mQueuedKeys created");
SetKeyLayout(new US_Standard());
Debugger.DoSend("Keylayout set");
Initialize();
Debugger.DoSend("Initialized");
UpdateLeds();
Debugger.DoSend("Leds updated");
}
/// <summary>

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using Cosmos.Common.Extensions;
using Cosmos.Core;
using Cosmos.Debug.Kernel;
namespace Cosmos.HAL
{
@ -31,15 +32,16 @@ namespace Cosmos.HAL
public override void UpdateLeds()
{
IO.Port60.Byte = 0xED;
while ((new IOPort(0x64).Byte & 2) != 0)
{
}
var led_status = (Global.ScrollLock ? 1 : 0) | ((Global.NumLock ? 1 : 0) << 1) | ((Global.CapsLock ? 1 : 0) << 2);
IO.Port60.Byte = (byte)led_status;
while ((new IOPort(0x64).Byte & 2) != 0)
{
}
// for now, lets not do this..
//IO.Port60.Byte = 0xED;
//while ((new IOPort(0x64).Byte & 2) != 0)
//{
//}
//var led_status = (Global.ScrollLock ? 1 : 0) | ((Global.NumLock ? 1 : 0) << 1) | ((Global.CapsLock ? 1 : 0) << 2);
//IO.Port60.Byte = (byte)led_status;
//while ((new IOPort(0x64).Byte & 2) != 0)
//{
//}
}
protected override void HandleScancode(byte aScancode, bool aReleased)
@ -107,6 +109,10 @@ namespace Cosmos.HAL
public bool GetKey(byte aScancode, bool released, out KeyEvent keyInfo)
{
if (KeyLayout == null)
{
Debugger.DoSend("No KeyLayout");
}
keyInfo = KeyLayout.ConvertScanCode(aScancode, ControlPressed, ShiftPressed, AltPressed, Global.NumLock, Global.CapsLock, Global.ScrollLock);
return keyInfo != null;
}

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cosmos.Debug.Kernel;
namespace Cosmos.HAL
{
@ -37,6 +38,11 @@ namespace Cosmos.HAL
for (var index = 0; index < _keys.Count; index++)
{
var t = _keys[index];
if (t == null)
{
Debugger.DoSend("Key received but item is NULL");
continue;
}
if (t.Scancode == scan)
{
found = true;

View file

@ -37,6 +37,7 @@ namespace Cosmos.IL2CPU.X86.IL
new CPUx86.Pop {DestinationReg = CPUx86.Registers.EDX};
// convert to real memory address
new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.RegistersEnum.EDX, SourceIsIndirect = true };
new CPUx86.Add {DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EAX};
var xSizeLeft = aElementSize;

View file

@ -1,11 +1,19 @@
namespace Cosmos.System
using Cosmos.Debug.Kernel;
namespace Cosmos.System
{
// This class exists purely for testing purposes.
internal static class TestingHelpers
{
internal static void KeyboardAddFakeScanCode(byte aScanCode, bool aReleased)
{
Debugger.DoSend("Before HandleFakeScanCode");
if (HAL.Global.Keyboard == null)
{
Debugger.DoSend("No Keyboard set!");
}
HAL.Global.Keyboard.HandleFakeScanCode(aScanCode, aReleased);
Debugger.DoSend("After HandleFakeScanCode");
}
}
}