mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-10 02:02:30 +00:00
Keyboard works. Next is enabling code that should be enabled, and removing debug code.
This commit is contained in:
parent
44cdc7dc61
commit
68282aa557
7 changed files with 184 additions and 122 deletions
|
|
@ -21,17 +21,17 @@
|
|||
<Framework>MicrosoftNET</Framework>
|
||||
<UseInternalAssembler>False</UseInternalAssembler>
|
||||
<EnableGDB>True</EnableGDB>
|
||||
<DebugMode>Source</DebugMode>
|
||||
<DebugMode>IL</DebugMode>
|
||||
<TraceMode>User</TraceMode>
|
||||
<BuildTarget>PXE</BuildTarget>
|
||||
<VMWareFlavor>Player</VMWareFlavor>
|
||||
<StartCosmosGDB>False</StartCosmosGDB>
|
||||
<StartCosmosGDB>True</StartCosmosGDB>
|
||||
<VMwareEdition>Workstation</VMwareEdition>
|
||||
<VMwareDeploy>ISO</VMwareDeploy>
|
||||
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
|
||||
<Deployment>ISO</Deployment>
|
||||
<Launch>VMware</Launch>
|
||||
<DebugEnabled>False</DebugEnabled>
|
||||
<DebugEnabled>True</DebugEnabled>
|
||||
<TraceAssemblies>All</TraceAssemblies>
|
||||
<PXE_Deployment>PXE</PXE_Deployment>
|
||||
<PXE_Launch>None</PXE_Launch>
|
||||
|
|
@ -59,8 +59,8 @@
|
|||
<USB_StartCosmosGDB>false</USB_StartCosmosGDB>
|
||||
<VMware_Deployment>ISO</VMware_Deployment>
|
||||
<VMware_Launch>VMware</VMware_Launch>
|
||||
<VMware_DebugEnabled>False</VMware_DebugEnabled>
|
||||
<VMware_DebugMode>Source</VMware_DebugMode>
|
||||
<VMware_DebugEnabled>True</VMware_DebugEnabled>
|
||||
<VMware_DebugMode>IL</VMware_DebugMode>
|
||||
<VMware_IgnoreDebugStubAttribute>False</VMware_IgnoreDebugStubAttribute>
|
||||
<VMware_VMwareEdition>Workstation</VMware_VMwareEdition>
|
||||
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
|
||||
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
|
||||
<VMware_EnableGDB>True</VMware_EnableGDB>
|
||||
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
|
||||
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
|
||||
<ISO_Deployment>ISO</ISO_Deployment>
|
||||
<ISO_Launch>None</ISO_Launch>
|
||||
<ISO_DebugEnabled>False</ISO_DebugEnabled>
|
||||
|
|
@ -187,17 +187,17 @@
|
|||
<Framework>MicrosoftNET</Framework>
|
||||
<UseInternalAssembler>False</UseInternalAssembler>
|
||||
<EnableGDB>True</EnableGDB>
|
||||
<DebugMode>Source</DebugMode>
|
||||
<DebugMode>IL</DebugMode>
|
||||
<TraceMode>User</TraceMode>
|
||||
<BuildTarget>PXE</BuildTarget>
|
||||
<VMWareFlavor>Player</VMWareFlavor>
|
||||
<StartCosmosGDB>False</StartCosmosGDB>
|
||||
<StartCosmosGDB>True</StartCosmosGDB>
|
||||
<VMwareEdition>Workstation</VMwareEdition>
|
||||
<VMwareDeploy>ISO</VMwareDeploy>
|
||||
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
|
||||
<Deployment>ISO</Deployment>
|
||||
<Launch>VMware</Launch>
|
||||
<DebugEnabled>False</DebugEnabled>
|
||||
<DebugEnabled>True</DebugEnabled>
|
||||
<TraceAssemblies>All</TraceAssemblies>
|
||||
<PXE_Deployment>PXE</PXE_Deployment>
|
||||
<PXE_Launch>None</PXE_Launch>
|
||||
|
|
@ -225,8 +225,8 @@
|
|||
<USB_StartCosmosGDB>false</USB_StartCosmosGDB>
|
||||
<VMware_Deployment>ISO</VMware_Deployment>
|
||||
<VMware_Launch>VMware</VMware_Launch>
|
||||
<VMware_DebugEnabled>False</VMware_DebugEnabled>
|
||||
<VMware_DebugMode>Source</VMware_DebugMode>
|
||||
<VMware_DebugEnabled>True</VMware_DebugEnabled>
|
||||
<VMware_DebugMode>IL</VMware_DebugMode>
|
||||
<VMware_IgnoreDebugStubAttribute>False</VMware_IgnoreDebugStubAttribute>
|
||||
<VMware_VMwareEdition>Workstation</VMware_VMwareEdition>
|
||||
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
|
||||
|
|
@ -234,7 +234,7 @@
|
|||
<VMware_UseInternalAssembler>False</VMware_UseInternalAssembler>
|
||||
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
|
||||
<VMware_EnableGDB>True</VMware_EnableGDB>
|
||||
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
|
||||
<VMware_StartCosmosGDB>True</VMware_StartCosmosGDB>
|
||||
<ISO_Deployment>ISO</ISO_Deployment>
|
||||
<ISO_Launch>None</ISO_Launch>
|
||||
<ISO_DebugEnabled>False</ISO_DebugEnabled>
|
||||
|
|
|
|||
|
|
@ -26,8 +26,13 @@ namespace GuessKernel {
|
|||
private Debugger mDebugger = new Debugger("User", "Guess");
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
private struct MyStruct
|
||||
private class MyStruct
|
||||
{
|
||||
public MyStruct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MyStruct(short a, short b, short c, short d, short e)
|
||||
{
|
||||
A = a;
|
||||
|
|
@ -60,63 +65,63 @@ namespace GuessKernel {
|
|||
//xQueue.Enqueue(new MyStruct(1, 2, 3, 4, 5));
|
||||
//xQueue.Enqueue(new MyStruct(6, 7, 8, 9, 10));
|
||||
|
||||
var xTest = 3 % 8;
|
||||
Console.Write("Test: ");
|
||||
Console.WriteLine(xTest.ToString());
|
||||
//var xTest = 3 % 8;
|
||||
//Console.Write("Test: ");
|
||||
//Console.WriteLine(xTest.ToString());
|
||||
|
||||
//var xItem = xQueue.Dequeue();
|
||||
//Console.Write("Char: ");
|
||||
//Console.WriteLine(xResult.KeyChar);
|
||||
var xItem = new MyStruct
|
||||
{
|
||||
A = 1,
|
||||
B = 2,
|
||||
C = 3,
|
||||
D = 4,
|
||||
E = 5
|
||||
};
|
||||
////var xItem = xQueue.Dequeue();
|
||||
////Console.Write("Char: ");
|
||||
////Console.WriteLine(xResult.KeyChar);
|
||||
//var xItem = new MyStruct
|
||||
// {
|
||||
// A = 1,
|
||||
// B = 2,
|
||||
// C = 3,
|
||||
// D = 4,
|
||||
// E = 5
|
||||
// };
|
||||
|
||||
var xArray = new MyStruct[1];
|
||||
xArray[0] = xItem;
|
||||
//xArray[0] = new MyStruct(1, 2, 3, 4, 5);
|
||||
//var xArray = new MyStruct[1];
|
||||
//xArray[0] = xItem;
|
||||
////xArray[0] = new MyStruct(1, 2, 3, 4, 5);
|
||||
|
||||
xItem = xArray[0];
|
||||
Console.Write("A: ");
|
||||
Console.WriteLine(xItem.A);
|
||||
Console.Write("B: ");
|
||||
Console.WriteLine(xItem.B);
|
||||
Console.Write("C: ");
|
||||
Console.WriteLine(xItem.C);
|
||||
Console.Write("D: ");
|
||||
Console.WriteLine(xItem.D);
|
||||
Console.Write("E: ");
|
||||
Console.WriteLine(xItem.E);
|
||||
//xItem = xArray[0];
|
||||
//Console.Write("A: ");
|
||||
//Console.WriteLine(xItem.A);
|
||||
//Console.Write("B: ");
|
||||
//Console.WriteLine(xItem.B);
|
||||
//Console.Write("C: ");
|
||||
//Console.WriteLine(xItem.C);
|
||||
//Console.Write("D: ");
|
||||
//Console.WriteLine(xItem.D);
|
||||
//Console.Write("E: ");
|
||||
//Console.WriteLine(xItem.E);
|
||||
|
||||
//xItem = new MyStruct(6, 7, 8, 9, 10);
|
||||
////xItem = new MyStruct(6, 7, 8, 9, 10);
|
||||
|
||||
Console.WriteLine("Next: ");
|
||||
//xItem = xQueue.Dequeue();
|
||||
//Console.Write("Char: ");
|
||||
//Console.WriteLine(xResult.KeyChar);
|
||||
//Console.WriteLine("Next: ");
|
||||
////xItem = xQueue.Dequeue();
|
||||
////Console.Write("Char: ");
|
||||
////Console.WriteLine(xResult.KeyChar);
|
||||
|
||||
//var xArray = new MyStruct[0];
|
||||
//xArray[0] = new MyStruct(1, 2, 3, 4, 5);
|
||||
////var xArray = new MyStruct[0];
|
||||
////xArray[0] = new MyStruct(1, 2, 3, 4, 5);
|
||||
|
||||
xItem = GetValue(xArray, 0);
|
||||
Console.Write("A: ");
|
||||
Console.WriteLine(xItem.A);
|
||||
Console.Write("B: ");
|
||||
Console.WriteLine(xItem.B);
|
||||
Console.Write("C: ");
|
||||
Console.WriteLine(xItem.C);
|
||||
Console.Write("D: ");
|
||||
Console.WriteLine(xItem.D);
|
||||
Console.Write("E: ");
|
||||
Console.WriteLine(xItem.E);
|
||||
//xItem = GetValue(xArray, 0);
|
||||
//Console.Write("A: ");
|
||||
//Console.WriteLine(xItem.A);
|
||||
//Console.Write("B: ");
|
||||
//Console.WriteLine(xItem.B);
|
||||
//Console.Write("C: ");
|
||||
//Console.WriteLine(xItem.C);
|
||||
//Console.Write("D: ");
|
||||
//Console.WriteLine(xItem.D);
|
||||
//Console.Write("E: ");
|
||||
//Console.WriteLine(xItem.E);
|
||||
|
||||
|
||||
while (true)
|
||||
;
|
||||
//while (true)
|
||||
// ;
|
||||
|
||||
//Stop();
|
||||
mCount++;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace Cosmos.HAL
|
|||
}
|
||||
if (!aReleased)
|
||||
{
|
||||
ConsoleKeyInfo xKeyInfo;
|
||||
ConsoleKeyInfoEx xKeyInfo;
|
||||
if (!GetKey(xTheScancode, out xKeyInfo))
|
||||
{
|
||||
Global.Dbg.SendError("Keyboard", "error while getting scancode character!");
|
||||
|
|
@ -169,30 +169,30 @@ namespace Cosmos.HAL
|
|||
|
||||
#region digits
|
||||
|
||||
//AddKey(0x1, '`');
|
||||
//AddKey(0x1, '`',);
|
||||
//AddKey(0x10000, '~');
|
||||
//AddKey(0x29, '`', ConsoleKey.NoName);
|
||||
//AddKey(0x290000, '~', ConsoleKey.NoName);
|
||||
//AddKey(0x2, '1', ConsoleKey.D1);
|
||||
//AddKey(0x20000, '!', ConsoleKey.D1);
|
||||
//AddKey(0x3, '2', ConsoleKey.D2);
|
||||
//AddKey(0x30000, '@', ConsoleKey.D2);
|
||||
//AddKey(0x4, '3', ConsoleKey.D3);
|
||||
//AddKey(0x40000, '#', ConsoleKey.D3);
|
||||
//AddKey(0x5, '4', ConsoleKey.D4);
|
||||
//AddKey(0x50000, '$', ConsoleKey.D5);
|
||||
//AddKey(0x6, '5', ConsoleKey.D5);
|
||||
//AddKey(0x60000, '%', ConsoleKey.D5);
|
||||
//AddKey(0x7, '6', ConsoleKey.D6);
|
||||
//AddKey(0x70000, '^', ConsoleKey.D6);
|
||||
//AddKey(0x8, '7', ConsoleKey.D7);
|
||||
//AddKey(0x80000, '&', ConsoleKey.D7);
|
||||
//AddKey(0x9, '8', ConsoleKey.D8);
|
||||
//AddKey(0x90000, '*', ConsoleKey.D8);
|
||||
//AddKey(0xA, '9', ConsoleKey.D9);
|
||||
//AddKey(0xA0000, '(', ConsoleKey.D9);
|
||||
AddKey(0x29, '`', ConsoleKey.NoName);
|
||||
AddKey(0x290000, '~', ConsoleKey.NoName);
|
||||
AddKey(0x2, '1', ConsoleKey.D1);
|
||||
AddKey(0x20000, '!', ConsoleKey.D1);
|
||||
AddKey(0x3, '2', ConsoleKey.D2);
|
||||
AddKey(0x30000, '@', ConsoleKey.D2);
|
||||
AddKey(0x4, '3', ConsoleKey.D3);
|
||||
AddKey(0x40000, '#', ConsoleKey.D3);
|
||||
AddKey(0x5, '4', ConsoleKey.D4);
|
||||
AddKey(0x50000, '$', ConsoleKey.D5);
|
||||
AddKey(0x6, '5', ConsoleKey.D5);
|
||||
AddKey(0x60000, '%', ConsoleKey.D5);
|
||||
AddKey(0x7, '6', ConsoleKey.D6);
|
||||
AddKey(0x70000, '^', ConsoleKey.D6);
|
||||
AddKey(0x8, '7', ConsoleKey.D7);
|
||||
AddKey(0x80000, '&', ConsoleKey.D7);
|
||||
AddKey(0x9, '8', ConsoleKey.D8);
|
||||
AddKey(0x90000, '*', ConsoleKey.D8);
|
||||
AddKey(0xA, '9', ConsoleKey.D9);
|
||||
AddKey(0xA0000, '(', ConsoleKey.D9);
|
||||
AddKey(0xB, '0', ConsoleKey.D0);
|
||||
//AddKey(0xB0000, ')', ConsoleKey.D0);
|
||||
AddKey(0xB0000, ')', ConsoleKey.D0);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -419,20 +419,20 @@ namespace Cosmos.HAL
|
|||
// return xResult;
|
||||
//}
|
||||
|
||||
public bool GetKey(uint aScancode, out ConsoleKeyInfo keyInfo)
|
||||
public bool GetKey(uint aScancode, out ConsoleKeyInfoEx keyInfo)
|
||||
{
|
||||
ConsoleKey xKey;
|
||||
|
||||
if (!GetKeyValue(aScancode, out xKey))
|
||||
{
|
||||
keyInfo = new ConsoleKeyInfo();
|
||||
keyInfo = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
char xChar;
|
||||
if (!GetCharValue(aScancode, out xChar))
|
||||
{
|
||||
keyInfo = new ConsoleKeyInfo();
|
||||
keyInfo = null;
|
||||
return false;
|
||||
}
|
||||
Console.WriteLine("Returning key");
|
||||
|
|
@ -442,7 +442,7 @@ namespace Cosmos.HAL
|
|||
Console.WriteLine((int)xKey);
|
||||
Console.Write("Char = ");
|
||||
Console.WriteLine((int)xChar);
|
||||
keyInfo = new ConsoleKeyInfo(xChar, xKey, ShiftPressed, AltPressed, ControlPressed);
|
||||
keyInfo = new ConsoleKeyInfoEx(xChar, xKey, ShiftPressed, AltPressed, ControlPressed);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,48 @@ using System.Linq;
|
|||
using System.Text;
|
||||
|
||||
namespace Cosmos.HAL {
|
||||
public class ConsoleKeyInfoEx
|
||||
{
|
||||
// once Github issue #137 is fixed, replace this class with ConsoleKeyInfo struct.
|
||||
|
||||
public char KeyChar
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public ConsoleKey Key
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public ConsoleModifiers Modifiers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public ConsoleKeyInfoEx(char keyChar, ConsoleKey key, bool shift, bool alt, bool control)
|
||||
{
|
||||
this.KeyChar = keyChar;
|
||||
this.Key = key;
|
||||
this.Modifiers = (ConsoleModifiers)0;
|
||||
if (shift)
|
||||
{
|
||||
this.Modifiers |= ConsoleModifiers.Shift;
|
||||
}
|
||||
if (alt)
|
||||
{
|
||||
this.Modifiers |= ConsoleModifiers.Alt;
|
||||
}
|
||||
if (control)
|
||||
{
|
||||
this.Modifiers |= ConsoleModifiers.Control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Keyboard : Device {
|
||||
// TODO: MtW: I don't like the following line in the baseclass, but for now, lets keep it here.
|
||||
protected Core.IOGroup.Keyboard IO = Core.Global.BaseIOGroups.Keyboard;
|
||||
|
|
@ -11,9 +53,9 @@ namespace Cosmos.HAL {
|
|||
{
|
||||
if (mQueuedKeys != null)
|
||||
{
|
||||
Console.WriteLine("Skippign creation on key queue!");
|
||||
Console.WriteLine("Skipping creation of key queue!");
|
||||
}
|
||||
mQueuedKeys = new Queue<ConsoleKeyInfo>(32);
|
||||
mQueuedKeys = new Queue<ConsoleKeyInfoEx>(32);
|
||||
|
||||
Initialize();
|
||||
Core.INTs.SetIrqHandler(0x01, HandleIRQ);
|
||||
|
|
@ -37,9 +79,9 @@ namespace Cosmos.HAL {
|
|||
|
||||
protected abstract void HandleScancode(byte aScancode, bool aReleased);
|
||||
|
||||
private static Queue<ConsoleKeyInfo> mQueuedKeys;
|
||||
private static Queue<ConsoleKeyInfoEx> mQueuedKeys;
|
||||
|
||||
protected void Enqueue(ConsoleKeyInfo aKey)
|
||||
protected void Enqueue(ConsoleKeyInfoEx aKey)
|
||||
{
|
||||
mQueuedKeys.Enqueue(aKey);
|
||||
Global.Dbg.SendNumber("Keyboard", "Key enqueued. QueuedKeys.Count", (uint)mQueuedKeys.Count, 32);
|
||||
|
|
@ -49,18 +91,18 @@ namespace Cosmos.HAL {
|
|||
global::System.Console.WriteLine();
|
||||
}
|
||||
|
||||
public bool TryReadKey(out ConsoleKeyInfo oKey)
|
||||
public bool TryReadKey(out ConsoleKeyInfoEx oKey)
|
||||
{
|
||||
if (mQueuedKeys.Count > 0)
|
||||
{
|
||||
oKey = mQueuedKeys.Dequeue();
|
||||
return true;
|
||||
}
|
||||
oKey = default(ConsoleKeyInfo);
|
||||
oKey = default(ConsoleKeyInfoEx);
|
||||
return false;
|
||||
}
|
||||
|
||||
public ConsoleKeyInfo ReadKey()
|
||||
public ConsoleKeyInfoEx ReadKey()
|
||||
{
|
||||
while (mQueuedKeys.Count == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,13 @@ namespace Cosmos.IL2CPU.X86.IL {
|
|||
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) {
|
||||
var xOpType = (OpType)aOpCode;
|
||||
var xSize = SizeOfType(xOpType.Value);
|
||||
if (xOpType.Value.IsValueType && !xOpType.Value.IsPrimitive)
|
||||
{
|
||||
Ldelema.Assemble(Assembler, xSize, DebugEnabled);
|
||||
Ldobj.DoAssemble(xOpType.Value);
|
||||
return;
|
||||
}
|
||||
Ldelem_Ref.Assemble(Assembler, xSize, false, DebugEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,43 +15,51 @@ namespace Cosmos.IL2CPU.X86.IL
|
|||
public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
|
||||
{
|
||||
DoNullReferenceCheck(Assembler, DebugEnabled, 0);
|
||||
OpType xType = ( OpType )aOpCode;
|
||||
new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
|
||||
var xObjSize = GetStorageSize(xType.Value);
|
||||
OpType xType = (OpType)aOpCode;
|
||||
DoAssemble(xType.Value);
|
||||
}
|
||||
|
||||
public static void DoAssemble(Type type)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
new CPUx86.Pop {DestinationReg = CPUx86.Registers.EAX};
|
||||
var xObjSize = GetStorageSize(type);
|
||||
|
||||
switch (xObjSize % 4)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
new CPUx86.Xor { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EBX };
|
||||
new CPUx86.Mov { DestinationReg = CPUx86.Registers.BL, SourceIsIndirect = true, SourceReg = CPUx86.Registers.EAX, SourceDisplacement = (int)(xObjSize - 1) };
|
||||
//new CPUx86.ShiftLeft { DestinationReg = CPUx86.Registers.EBX, SourceValue = 24 };
|
||||
new CPUx86.Push { DestinationReg = CPUx86.Registers.EBX };
|
||||
break;
|
||||
}
|
||||
{
|
||||
new CPUx86.Xor {DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EBX};
|
||||
new CPUx86.Mov {DestinationReg = CPUx86.Registers.BL, SourceIsIndirect = true, SourceReg = CPUx86.Registers.EAX, SourceDisplacement = (int)(xObjSize - 1)};
|
||||
//new CPUx86.ShiftLeft { DestinationReg = CPUx86.Registers.EBX, SourceValue = 24 };
|
||||
new CPUx86.Push {DestinationReg = CPUx86.Registers.EBX};
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
new CPUx86.Xor { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EBX };
|
||||
new CPUx86.Mov { DestinationReg = CPUx86.Registers.BX, SourceIsIndirect = true, SourceReg = CPUx86.Registers.EAX, SourceDisplacement = (int)(xObjSize - 2) };
|
||||
//new CPUx86.ShiftLeft {DestinationReg = CPUx86.Registers.EBX, SourceValue = 16};
|
||||
new CPUx86.Push { DestinationReg = CPUx86.Registers.EBX };
|
||||
break;
|
||||
}
|
||||
{
|
||||
new CPUx86.Xor {DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EBX};
|
||||
new CPUx86.Mov {DestinationReg = CPUx86.Registers.BX, SourceIsIndirect = true, SourceReg = CPUx86.Registers.EAX, SourceDisplacement = (int)(xObjSize - 2)};
|
||||
//new CPUx86.ShiftLeft {DestinationReg = CPUx86.Registers.EBX, SourceValue = 16};
|
||||
new CPUx86.Push {DestinationReg = CPUx86.Registers.EBX};
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
break;
|
||||
}
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Exception( "Remainder not supported!" );
|
||||
throw new Exception("Remainder not supported!");
|
||||
}
|
||||
|
||||
xObjSize -= (xObjSize % 4);
|
||||
|
||||
for (int i = 1; i <= (xObjSize / 4); i++)
|
||||
{
|
||||
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX, DestinationIsIndirect = true, DestinationDisplacement = (int)(xObjSize - (i * 4)) };
|
||||
new CPUx86.Push {DestinationReg = CPUx86.Registers.EAX, DestinationIsIndirect = true, DestinationDisplacement = (int)(xObjSize - (i * 4))};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cosmos.HAL;
|
||||
using Encoding = System.Text.Encoding;
|
||||
using Plug = Cosmos.IL2CPU.Plugs.PlugAttribute;
|
||||
|
||||
|
|
@ -303,7 +304,7 @@ namespace Cosmos.System.Plugs.System {
|
|||
|
||||
public static int Read() {
|
||||
// TODO special cases, if needed, that returns -1
|
||||
ConsoleKeyInfo xResult;
|
||||
ConsoleKeyInfoEx xResult;
|
||||
|
||||
if (HAL.Global.Keyboard.TryReadKey(out xResult))
|
||||
{
|
||||
|
|
@ -317,7 +318,7 @@ namespace Cosmos.System.Plugs.System {
|
|||
|
||||
// ReadKey() pure CIL
|
||||
|
||||
public static ConsoleKeyInfo ReadKey(Boolean intercept) {
|
||||
public static ConsoleKeyInfoEx ReadKey(Boolean intercept) {
|
||||
var key = Cosmos.HAL.Global.Keyboard.ReadKey();
|
||||
|
||||
if (false == intercept)
|
||||
|
|
@ -335,7 +336,7 @@ namespace Cosmos.System.Plugs.System {
|
|||
return null;
|
||||
}
|
||||
List<char> chars = new List<char>(32);
|
||||
ConsoleKeyInfo current;
|
||||
ConsoleKeyInfoEx current;
|
||||
int currentCount = 0;
|
||||
|
||||
while ((current = HAL.Global.Keyboard.ReadKey()).Key != ConsoleKey.Enter)
|
||||
|
|
|
|||
Loading…
Reference in a new issue