Merge remote-tracking branch 'refs/remotes/CosmosOS/master' into Dictionary

This commit is contained in:
kaleb 2016-12-01 22:57:58 +10:00
commit 6a72e0ef80
7 changed files with 113 additions and 81 deletions

View file

@ -15,7 +15,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Profile>Bochs</Profile>
<Profile>VMware</Profile>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
@ -26,13 +26,13 @@
<BuildTarget>PXE</BuildTarget>
<VMWareFlavor>Player</VMWareFlavor>
<StartCosmosGDB>False</StartCosmosGDB>
<VMwareEdition>Workstation</VMwareEdition>
<VMwareEdition>Player</VMwareEdition>
<VMwareDeploy>ISO</VMwareDeploy>
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
<Deployment>ISO</Deployment>
<Launch>Bochs</Launch>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<TraceAssemblies>User</TraceAssemblies>
<TraceAssemblies>All</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
<PXE_DebugEnabled>False</PXE_DebugEnabled>
@ -82,7 +82,7 @@
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<ISO_Name>User 001</ISO_Name>
<ISO_Description>Creates a bootable ISO image which can be burned to a DVD. After running the selected project, an explorer window will open containing the ISO file. The ISO file can then be burned to a CD or DVD and used to boot a physical or virtual system.</ISO_Description>
<USB_Name>Guess</USB_Name>
@ -129,7 +129,7 @@
<ISO_VisualStudioDebugPort>Pipe: Cosmos\Serial</ISO_VisualStudioDebugPort>
<PXE_ShowLaunchConsole>False</PXE_ShowLaunchConsole>
<PXE_VisualStudioDebugPort>Pipe: Cosmos\Serial</PXE_VisualStudioDebugPort>
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
<StackCorruptionDetectionEnabled>False</StackCorruptionDetectionEnabled>
<VMware_StackCorruptionDetectionEnabled>False</VMware_StackCorruptionDetectionEnabled>
<Bochs_Name>Guess</Bochs_Name>
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
@ -181,9 +181,10 @@
<USB_EnableBochsDebug>False</USB_EnableBochsDebug>
<StackCorruptionDetectionLevel>AllInstructions</StackCorruptionDetectionLevel>
<Bochs_StackCorruptionDetectionLevel>AllInstructions</Bochs_StackCorruptionDetectionLevel>
<VMware_StackCorruptionDetectionLevel>AllInstructions</VMware_StackCorruptionDetectionLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Profile>Bochs</Profile>
<Profile>VMware</Profile>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<Framework>MicrosoftNET</Framework>
@ -194,13 +195,13 @@
<BuildTarget>PXE</BuildTarget>
<VMWareFlavor>Player</VMWareFlavor>
<StartCosmosGDB>False</StartCosmosGDB>
<VMwareEdition>Workstation</VMwareEdition>
<VMwareEdition>Player</VMwareEdition>
<VMwareDeploy>ISO</VMwareDeploy>
<IgnoreDebugStubAttribute>False</IgnoreDebugStubAttribute>
<Deployment>ISO</Deployment>
<Launch>Bochs</Launch>
<Launch>VMware</Launch>
<DebugEnabled>True</DebugEnabled>
<TraceAssemblies>User</TraceAssemblies>
<TraceAssemblies>All</TraceAssemblies>
<PXE_Deployment>PXE</PXE_Deployment>
<PXE_Launch>None</PXE_Launch>
<PXE_DebugEnabled>False</PXE_DebugEnabled>
@ -250,7 +251,7 @@
<ISO_EnableGDB>False</ISO_EnableGDB>
<ISO_StartCosmosGDB>false</ISO_StartCosmosGDB>
<Name>Guess</Name>
<Description>Use Bochs emulator to deploy and debug.</Description>
<Description>Use VMware Player or Workstation to deploy and debug.</Description>
<ISO_Name>User 001</ISO_Name>
<ISO_Description>Creates a bootable ISO image which can be burned to a DVD. After running the selected project, an explorer window will open containing the ISO file. The ISO file can then be burned to a CD or DVD and used to boot a physical or virtual system.</ISO_Description>
<USB_Name>Guess</USB_Name>
@ -303,7 +304,7 @@
<VMware_ShowLaunchConsole>False</VMware_ShowLaunchConsole>
<ISO_ShowLaunchConsole>False</ISO_ShowLaunchConsole>
<PXE_ShowLaunchConsole>False</PXE_ShowLaunchConsole>
<StackCorruptionDetectionEnabled>True</StackCorruptionDetectionEnabled>
<StackCorruptionDetectionEnabled>False</StackCorruptionDetectionEnabled>
<VMware_StackCorruptionDetectionEnabled>False</VMware_StackCorruptionDetectionEnabled>
<Bochs_Name>Guess</Bochs_Name>
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
@ -355,6 +356,7 @@
<USB_EnableBochsDebug>False</USB_EnableBochsDebug>
<StackCorruptionDetectionLevel>AllInstructions</StackCorruptionDetectionLevel>
<Bochs_StackCorruptionDetectionLevel>AllInstructions</Bochs_StackCorruptionDetectionLevel>
<VMware_StackCorruptionDetectionLevel>AllInstructions</VMware_StackCorruptionDetectionLevel>
</PropertyGroup>
<ItemGroup>
<Content Include="Cosmos.bxrc">

View file

@ -10,7 +10,7 @@ namespace GuessKernel
public class GuessOS : Sys.Kernel
{
protected int mCount = 0;
protected int mMagicNo = 22;
public GuessOS()
@ -18,7 +18,7 @@ namespace GuessKernel
// Didnt check if tickcount is working yet.. can change this later
//var xRandom = new Random(234243534);
//mMagicNo = xRandom.Next(1, 100);
}
}
protected override void BeforeRun()
{

View file

@ -24,7 +24,7 @@ namespace zConsole
Frotz.os_.debug_mode = false;
//if (File.Exists("debug.log"))
// File.Delete("debug.log");
string fName = "";
string fName = args[0];
//while(!File.Exists(fName))
//{
// Console.WriteLine("Please type a path to a storyfile:");

View file

@ -119,6 +119,9 @@ Things that Core implements and exposes to HAL:
Core also manages consumers of its services to avoid conflicts and security to prevent a specific driver from accessing "everything".
Notes:
https://github.com/joeduffy/slice.net
### 1 HAL (Hardware Abstraction Layer)
Summary: Hardware control
@ -191,7 +194,7 @@ references.
## Graphics
0 IO/Memory access (Cosmos)
1 DirectX / Graphics Memory
1 DirectX / VESA / Graphics Memory
2 WinForms, WPF, Other UI, Canvas, JPG/PNG/GIF
3 Application

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using Cosmos.Common.Extensions;
using Cosmos.System.FileSystem;
using Cosmos.System.FileSystem.VFS;
@ -728,9 +729,10 @@ namespace Cosmos.Kernel.Tests.Fat
/// </summary>
private void TestFileStream()
{
mDebugger.Send("START TEST: Filestream:");
using (var xFS = new FileStream(@"0:\Kudzu.txt", FileMode.Create))
{
mDebugger.Send("START TEST: Filestream:");
mDebugger.Send("Start writing");
var xStr = "Test FAT Write.";
byte[] xWriteBuff = xStr.GetUtf8Bytes(0, (uint)xStr.Length);

View file

@ -1,128 +1,148 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cosmos.Common.Extensions {
public static class ToHexString {
namespace Cosmos.Common.Extensions
{
public static class ToHexString
{
//TODO: Can add several more overloads for other numbertypes, with and without width argument.
public static string ToHex(this byte n) {
return ConvertToHex((UInt32)n, 2);
}
public static string ToHex(this byte n, int aWidth) {
return ConvertToHex((UInt32)n, aWidth);
public static string ToHex(this byte n)
{
return ConvertToHex((uint)n, 2);
}
public static string ToHex(this int n) {
return ConvertToHex((UInt32)n);
}
public static string ToHex(this int n, int aWidth) {
return ConvertToHex((UInt32)n, aWidth);
public static string ToHex(this byte n, int aWidth)
{
return ConvertToHex((uint)n, aWidth);
}
public static string ToHex(this UInt16 n) {
return ConvertToHex((UInt32)n, 4);
}
public static string ToHex(this UInt16 n, int aWidth) {
return ConvertToHex((UInt32)n, aWidth);
public static string ToHex(this int n)
{
return ConvertToHex((uint)n, 4);
}
public static string ToHex(this uint aValue) {
public static string ToHex(this int n, int aWidth)
{
return ConvertToHex((uint)n, aWidth);
}
public static string ToHex(this ushort n)
{
return ConvertToHex((uint)n, 4);
}
public static string ToHex(this ushort n, int aWidth)
{
return ConvertToHex((uint)n, aWidth);
}
public static string ToHex(this uint aValue)
{
return ConvertToHex(aValue, 8);
}
public static string ToHex(this uint aValue, int aWidth) {
public static string ToHex(this uint aValue, int aWidth)
{
return ConvertToHex(aValue, aWidth);
}
public static string ToHex(this ulong aValue) {
public static string ToHex(this ulong aValue)
{
return ConvertToHex(aValue).PadLeft(16, '0');
}
public static string ToHex(this ulong aValue, int aWidth) {
public static string ToHex(this ulong aValue, int aWidth)
{
return ConvertToHex(aValue).PadLeft(aWidth, '0');
}
private static string GetPrefix() {
private static string GetPrefix()
{
return "0x";
}
private static string GetSuffix() {
private static string GetSuffix()
{
return "h";
}
private static string ConvertToHex(UInt32 num) {
private static string ConvertToHex(uint num)
{
string xHex = string.Empty;
if (num == 0) {
xHex = "0";
} else {
while (num != 0) {
//Note; char is converted to string because Cosmos crashes when adding char and string. Frode, 7.june.
//TODO: Is this still true? I think Cosmos can handle char + string just fine now.
xHex = SingleDigitToHex((byte)(num & 0xf)) + xHex;
num = num >> 4;
}
if (num == 0)
{
xHex = "0";
}
else
{
while (num != 0)
{
xHex = DigitToHexChar((byte)(num & 0xf)) + xHex;
num = num >> 4;
}
}
return xHex;
}
private static string ConvertToHex(UInt32 aValue, int aWidth) {
private static string ConvertToHex(uint aValue, int aWidth)
{
return ConvertToHex(aValue).PadLeft(aWidth, '0');
}
private static string ConvertToHex(UInt64 num) {
private static string ConvertToHex(ulong num)
{
string xHex = string.Empty;
while (num != 0) {
while (num != 0)
{
//Note; char is converted to string because Cosmos crashes when adding char and string. Frode, 7.june.
xHex = SingleDigitToHex((byte)(num & 0xf)) + xHex;
xHex = DigitToHexChar((byte)(num & 0xf)) + xHex;
num = num >> 4;
}
return xHex;
}
public static string SingleDigitToHex(byte d) {
switch (d) {
public static char DigitToHexChar(byte d)
{
switch (d)
{
case 0:
return "0";
return '0';
case 1:
return "1";
return '1';
case 2:
return "2";
return '2';
case 3:
return "3";
return '3';
case 4:
return "4";
return '4';
case 5:
return "5";
return '5';
case 6:
return "6";
return '6';
case 7:
return "7";
return '7';
case 8:
return "8";
return '8';
case 9:
return "9";
return '9';
case 10:
return "A";
return 'A';
case 11:
return "B";
return 'B';
case 12:
return "C";
return 'C';
case 13:
return "D";
return 'D';
case 14:
return "E";
return 'E';
case 15:
return "F";
return 'F';
}
return " ";
return ' ';
}
}
}

View file

@ -229,6 +229,7 @@ namespace Cosmos.System.FileSystem.FAT.Listing
//TODO: Change xLongName to StringBuilder
string xLongName = "";
string xName = "";
for (uint i = 0; i < xData.Length; i = i + 32)
{
byte xAttrib = xData[i + 11];
@ -292,7 +293,7 @@ namespace Cosmos.System.FileSystem.FAT.Listing
break;
case FatDirectoryEntryAttributeConsts.UnusedOrDeletedEntry:
// Empty slot, skip it
break;
continue;
default:
if (xStatus >= 0x20)
{
@ -338,6 +339,7 @@ namespace Cosmos.System.FileSystem.FAT.Listing
break;
}
}
uint xFirstCluster = (uint)(xData.ToUInt16(i + 20) << 16 | xData.ToUInt16(i + 26));
int xTest = xAttrib & (FatDirectoryEntryAttributeConsts.Directory | FatDirectoryEntryAttributeConsts.VolumeID);
@ -458,6 +460,7 @@ namespace Cosmos.System.FileSystem.FAT.Listing
if (mParent != null)
{
var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData();
if (xData.Length > 0)
{
var xValue = new byte[aEntryMetadata.DataLength];
@ -482,6 +485,7 @@ namespace Cosmos.System.FileSystem.FAT.Listing
if (mParent != null)
{
var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData();
if (xData.Length > 0)
{
var xValue = new byte[aEntryMetadata.DataLength];
@ -506,6 +510,7 @@ namespace Cosmos.System.FileSystem.FAT.Listing
Global.mFileSystemDebugger.SendInternal(aValue);
var xData = ((FatDirectoryEntry)mParent).GetDirectoryEntryData();
if (xData.Length > 0)
{
var xValue = new byte[aEntryMetadata.DataLength];